First push

master
Guus van Meerveld 4 years ago
commit e475263671

2
.gitignore vendored

@ -0,0 +1,2 @@
node_modules
.vscode

@ -0,0 +1,74 @@
const { app, BrowserWindow, globalShortcut, shell } = require('electron');
const { autoUpdater, dialog } = require('electron')
const AutoLaunch = require('auto-launch');
var autoLaunch = new AutoLaunch({
name: 'MasterKey',
path: '/Applications/MasterKey.app',
});
let loadingScreen;
const createLoadingScreen = () => {
loadingScreen = new BrowserWindow({
width: 200,
height: 400,
frame: false,
backgroundColor: '#212121'
});
loadingScreen.setResizable(false);
loadingScreen.on('closed', () => (loadingScreen = null));
loadingScreen.loadFile('public/pages/loadscreen.html')
};
function createWindow() {
const win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
webviewTag: true,
enableRemoteModule: true
},
frame: false,
backgroundColor: '#212121',
'minWidth': 600,
'minHeight': 600,
})
win.loadFile('public/index.html')
globalShortcut.register('CommandOrControl+I+Shift', () => {
if (win.isFocused()) {
win.webContents.openDevTools()
}
})
win.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});
win.removeMenu()
win.webContents.on('dom-ready', () => {
if (loadingScreen) {
loadingScreen.close();
}
win.show()
})
}
app.whenReady().then(() => {
createLoadingScreen()
createWindow()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

1595
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,20 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron .",
"ndb": "ndb ."
},
"author": "",
"license": "ISC",
"dependencies": {
"auto-launch": "^5.0.5",
"custom-electron-titlebar": "^3.2.3",
"electron": "^9.1.1",
"electron-json-storage": "^4.2.0",
"ndb": "^1.1.5",
"update-electron-app": "^1.5.0"
}
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MasterKey</title>
<link rel="stylesheet" href="stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="stylesheets/index.css">
<link rel="stylesheet" href="stylesheets/main.css">
</head>
<body>
<div class="wrapper">
<webview id="main-page" nodeintegration src="pages/home.html"></webview>
</div>
<div class="nav-left position-absolute">
<ul class="nav-list-top nav-list p-0 text-center position-absolute m-0">
<li title="Home" class="nav-item" id="home">
<svg width="3em" height="3em" viewBox="0 0 16 16" class="mr-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M2 13.5V7h1v6.5a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5V7h1v6.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5zm11-11V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z" />
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z" />
</svg>
</li>
<li title="Keybinds" class="nav-item" id="keybinds">
<svg width="3em" height="3em" viewBox="0 0 16 16" class="bi bi-keyboard" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M14 5H2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1zM2 4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H2z" />
<path d="M13 10.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm0-2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-5 0A.25.25 0 0 1 8.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 8 8.75v-.5zm2 0a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-.5zm1 2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-5-2A.25.25 0 0 1 6.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 6 8.75v-.5zm-2 0A.25.25 0 0 1 4.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 4 8.75v-.5zm-2 0A.25.25 0 0 1 2.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 2 8.75v-.5zm11-2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-2 0a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-2 0A.25.25 0 0 1 9.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 9 6.75v-.5zm-2 0A.25.25 0 0 1 7.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 7 6.75v-.5zm-2 0A.25.25 0 0 1 5.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 5 6.75v-.5zm-3 0A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 6.75v-.5zm0 4a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm2 0a.25.25 0 0 1 .25-.25h5.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-5.5a.25.25 0 0 1-.25-.25v-.5z" />
</svg>
</li>
<li title="Macro's" class="nav-item" id="macros">
<svg width="3em" height="3em" viewBox="0 0 16 16" class="bi bi-wrench" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M.102 2.223A3.004 3.004 0 0 0 3.78 5.897l6.341 6.252A3.003 3.003 0 0 0 13 16a3 3 0 1 0-.851-5.878L5.897 3.781A3.004 3.004 0 0 0 2.223.1l2.141 2.142L4 4l-1.757.364L.102 2.223zm13.37 9.019L13 11l-.471.242-.529.026-.287.445-.445.287-.026.529L11 13l.242.471.026.529.445.287.287.445.529.026L13 15l.471-.242.529-.026.287-.445.445-.287.026-.529L15 13l-.242-.471-.026-.529-.445-.287-.287-.445-.529-.026z" />
</svg>
</li>
</ul>
<ul class="nav-list nav-list-bottom p-0 text-center position-absolute m-0">
<li title="Account" class="nav-item" id="account">
<svg width="3em" height="3em" viewBox="0 0 16 16" class="bi bi-person" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M13 14s1 0 1-1-1-4-6-4-6 3-6 4 1 1 1 1h10zm-9.995-.944v-.002.002zM3.022 13h9.956a.274.274 0 0 0 .014-.002l.008-.002c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664a1.05 1.05 0 0 0 .022.004zm9.974.056v-.002.002zM8 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0z" />
</svg>
</li>
<li title="Settings" class="nav-item" id="settings">
<svg width="3em" height="3em" viewBox="0 0 16 16" class="bi bi-sliders" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M14 3.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM11.5 5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM7 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM4.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm9.5 3.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM11.5 15a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z" />
<path fill-rule="evenodd" d="M9.5 4H0V3h9.5v1zM16 4h-2.5V3H16v1zM9.5 14H0v-1h9.5v1zm6.5 0h-2.5v-1H16v1zM6.5 9H16V8H6.5v1zM0 9h2.5V8H0v1z" />
</svg>
</li>
</ul>
</div>
<script src="javascripts/index.js"></script>
</body>
</html>

@ -0,0 +1,12 @@
fetch("https://accounts.masterkey.com")
.then(() => {
console.log("yeet");
})
.catch(() => {
document.getElementById('error').classList.remove('d-none')
document.getElementById('error').classList.add('d-flex')
})
.finally(() => {
document.getElementById('loader').classList.add('d-none')
document.getElementById('loader').classList.remove('d-flex')
})

@ -0,0 +1,21 @@
const customTitlebar = require('custom-electron-titlebar');
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex('#212121'),
unfocusEffect: true,
overflow: "auto",
menu: null,
titleHorizontalAlignment: 'left'
});
document.querySelectorAll(".nav-item").forEach(x => {
x.addEventListener('click', e => {
if (document.getElementById("main-page").getAttribute('src').indexOf(x.id) < 0) {
document.getElementById("main-page").setAttribute('src', "pages/" + x.id + ".html")
document.querySelectorAll(".nav-item").forEach(y => {
y.classList.remove('active')
})
x.classList.add('active')
}
})
})

@ -0,0 +1,28 @@
document.querySelectorAll('.keybind-input').forEach(x => {
x.addEventListener('click', e => {
document.addEventListener('keyup', keyup)
document.addEventListener('keydown', keydown)
setTimeout(() => document.addEventListener('click', submit), 10)
})
function keydown(f) {
var key = f.key.toUpperCase()
if (x.id) {
x.value = key
x.removeAttribute('id')
}
if (x.value.indexOf(key) < 0) {
x.value += " + " + key
}
}
function keyup(f) {
var key = f.key.toUpperCase()
if (x.value.indexOf(key) > -1) {
x.id = true
}
}
function submit() {
document.removeEventListener('keyup', keyup)
document.removeEventListener('keydown', keydown)
document.removeEventListener('click', submit)
}
})

@ -0,0 +1,6 @@
const { storage } = require('electron-json-storage');
document.getElementById("minimize-label").addEventListener('click', e => {
storage.set('settings', { minimize: document.getElementById("minimize").checked })
document.getElementById("minimize-label").innerHTML = storage.get('settings');
})

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Account</title>
<link rel="stylesheet" href="../stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="../stylesheets/main.css">
</head>
<body>
<div class="w-100 h-100 position-absolute d-flex justify-content-center align-items-center" id="loader">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<div class="error container-fluid text-center d-none align-items-center h-100" id="error">
<div class="w-100">
<h1>
<svg width="4em" height="4em" viewBox="0 0 16 16" class="bi bi-wifi-off" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M10.706 3.294A12.545 12.545 0 0 0 8 3 12.44 12.44 0 0 0 .663 5.379a.485.485 0 0 0-.048.736.518.518 0 0 0 .668.05A11.448 11.448 0 0 1 8 4c.63 0 1.249.05 1.852.148l.854-.854zM8 6c-1.905 0-3.68.56-5.166 1.526a.48.48 0 0 0-.063.745.525.525 0 0 0 .652.065 8.448 8.448 0 0 1 3.51-1.27L8 6zm2.596 1.404l.785-.785c.63.24 1.228.545 1.785.907a.482.482 0 0 1 .063.745.525.525 0 0 1-.652.065 8.462 8.462 0 0 0-1.98-.932zM8 10l.934-.933a6.454 6.454 0 0 1 2.012.637c.285.145.326.524.1.75l-.015.015a.532.532 0 0 1-.611.09A5.478 5.478 0 0 0 8 10zm4.905-4.905l.747-.747c.59.3 1.153.645 1.685 1.03a.485.485 0 0 1 .048.737.518.518 0 0 1-.668.05 11.496 11.496 0 0 0-1.812-1.07zM9.02 11.78c.238.14.236.464.04.66l-.706.706a.5.5 0 0 1-.708 0l-.707-.707c-.195-.195-.197-.518.04-.66A1.99 1.99 0 0 1 8 11.5c.373 0 .722.102 1.02.28zm4.355-9.905a.53.53 0 1 1 .75.75l-10.75 10.75a.53.53 0 0 1-.75-.75l10.75-10.75z" />
</svg>
</h1>
<h3 class="display-4">Could not connect with the MasterKey service</h3>
<h5>Please check your internet connection or go to the <a href="https://status.masterkey.com" target="_blank">status page</a></h5>
</div>
</div>
<script src="../javascripts/account.js"></script>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="../stylesheets/main.css">
</head>
<body>
yeet
</body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Keybinds</title>
<link rel="stylesheet" href="../stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="../stylesheets/main.css">
<link rel="stylesheet" href="../stylesheets/keybinds.css">
</head>
<body>
<div class="container pt-3 h-100">
<h1>
Keybinds
<button class="btn btn-info float-right mt-4">Create new keybind</button>
</h1>
<hr class="dark">
<div class="card-dark">
<div class="row p-3">
<div class="action col">
<span class="bold text-muted">ACTION</span>
<div class="row mt-2">
<div class="col">
<select name="" id="" class="form-control bg-dark border-0">
<option value="">Category</option>
</select>
</div>
<div class="col">
<select name="" id="" class="form-control bg-dark border-0">
<option value="">Action</option>
</select>
</div>
</div>
</div>
<div class="keybind col">
<span class="bold text-muted">KEYBIND</span>
<input type="text" readonly value="Unset, click to set" class="keybind-input form-control bg-dark border-0 mt-2">
</div>
</div>
</div>
<hr class="dark">
<div class="card-dark">
<div class="row p-3">
<div class="action col">
<span class="bold text-muted">ACTION</span>
<div class="row mt-2">
<div class="col">
<select name="" id="" class="form-control bg-dark border-0">
<option value="">Category</option>
</select>
</div>
<div class="col">
<select name="" id="" class="form-control bg-dark border-0">
<option value="">Action</option>
</select>
</div>
</div>
</div>
<div class="keybind col">
<span class="bold text-muted">KEYBIND</span>
<input type="text" readonly value="Unset, click to set"
class="keybind-input form-control bg-dark border-0 mt-2">
</div>
</div>
</div>
</div>
<script src="../javascripts/keybinds.js"></script>
</body>
</html>

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="../stylesheets/main.css">
<link rel="stylesheet" href="../stylesheets/bootstrap.min.css">
<style>
html {
min-height: 100vh;
min-width: 100vw;
-webkit-app-region: drag;
}
body {
background-color: #212121;
}
</style>
</head>
<body class="d-flex justify-content-center align-items-center text-center">
<div>
<p>MasterKey is starting...</p>
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</body>
</html>

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Settings</title>
<link rel="stylesheet" href="../stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="../stylesheets/main.css">
<link rel="stylesheet" href="../stylesheets/material-switches.css">
</head>
<body>
<div class="container pt-3 h-100">
<h1>Settings</h1>
<hr class="dark">
<h5 class="bold text-muted">ACCOUNT SETTINGS</h5>
<hr class="dark">
<h5 class="bold text-muted">PROFILES</h5>
<hr class="dark">
<h5 class="bold text-muted">SYSTEM</h5>
<h4>
Start up with the system
<span class="material-switch">
<input type="checkbox" id="autostart" class="form-check-label" name="autostart" value="true">
<label for="autostart" class="label-primary ml-3"></label>
</span>
</h4>
<span class="text-muted">MasterKey will start together with the rest of your system.</span>
<br>
<br>
<h4>
Minimize when closed
<span class="material-switch" id="minimize-label">
<input type="checkbox" id="minimize" class="form-check-label" name="minimize" value="true">
<label for="minimize" class="label-primary ml-3"></label>
</span>
</h4>
<span class="text-muted">Leave MasterKey running in the background when you press X.</span>
</div>
<script src="../javascripts/settings.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,86 @@
.wrapper {
position: absolute;
height: calc(100vh - 30px);
right: 0;
}
#main-page {
width: 100%;
height: 100%;
}
.nav-left {
background-color: #292929;
position: absolute;
}
@media (max-width:749px) {
.nav-left {
width: 100vw;
bottom: 0;
height: 5rem;
}
.nav-list li {
margin-right: 2rem;
margin-bottom: 1rem;
}
.nav-list-top {
left: 2rem;
}
.nav-list-bottom {
right: 2rem;
}
.wrapper {
width: 100vw;
height: calc(100vh - 7.5rem);
}
}
@media (min-width:750px) {
.wrapper {
min-width: calc(100vw - 10rem);
width: 85vw;
max-width: calc(100vw - 6rem);
}
.nav-left {
top: 0;
height: calc(100vh - 30px);
min-width: 6rem;
width: 15vw;
max-width: 10rem;
}
li.active {
border-left: 3px solid #efefef;
padding-left: -3px;
}
.nav-list-top {
top: 2rem;
}
.nav-list li {
width: 100%;
margin-bottom: 2rem;
}
.nav-list {
width: 100%;
}
}
.nav-list {
list-style-type: none;
bottom: 0;
}
.nav-list li {
float: left;
cursor: pointer;
}

@ -0,0 +1,10 @@
.card-dark {
background-color: rgb(39, 39, 39);
width: 100%;
border-radius: 5px;
box-sizing: border-box;
}
input {
cursor: pointer;
}

@ -0,0 +1,57 @@
::-webkit-scrollbar {
background-color: #1d1e1e;
color: #c3c1bd;
}
::-webkit-scrollbar-thumb {
background-color: #2b2c2d;
}
::-webkit-scrollbar-thumb:hover {
background-color: #333536;
}
::-webkit-scrollbar-thumb:active {
background-color: #3e4041;
}
::-webkit-scrollbar-corner {
background-color: #191a1a;
}
html {
min-height: 100vh;
}
body {
height: 100vh;
background-color: #212121;
}
@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Light.ttf') format('truetype')
}
* {
color: #efefef!important;
font-family: 'Roboto', sans-serif;
}
a {
color: rgb(76, 172, 252)!important;
}
h1 {
font-weight: 300;
font-size: 4rem;
}
.dark {
background-color: #333333;
}
@font-face {
font-family: 'Roboto Bold';
src: url('../fonts/Roboto-Bold.ttf') format('truetype')
}
.bold {
font-family: 'Roboto Bold'
}

@ -0,0 +1,50 @@
.material-switch > input[type="checkbox"] {
display: none;
}
.material-switch > label {
cursor: pointer;
margin-top: .8rem;
float: right;
height: 0px;
position: relative;
width: 40px;
}
.material-switch > label::before {
background: rgb(0, 0, 0);
box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
border-radius: 8px;
content: '';
height: 16px;
margin-top: -8px;
position:absolute;
opacity: 0.3;
transition: all 0.4s ease-in-out;
width: 40px;
}
.material-switch > label::after {
background: #efefef;
border-radius: 16px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
content: '';
height: 24px;
left: -4px;
margin-top: -8px;
position: absolute;
top: -4px;
transition: all 0.3s ease-in-out;
width: 24px;
}
.material-switch > input[type="checkbox"]:checked + label::before {
background: #17a2b8;
opacity: 0.5;
}
.material-switch > input[type="checkbox"]:checked + label::after {
background: #17a2b8;
left: 20px;
}
.material-switch {
display: inline-block;
}