Additions and Local Backup

This commit is contained in:
2022-03-02 11:42:17 -05:00
parent 2d53e6d623
commit e8a1018b1c
15 changed files with 3777 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/node_modules
+56
View File
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aviation Assistant Link - Connected</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body onload="pullInformation()">
<div id="main">
<div id="status">
<img src="images/deviceicon.png" height="200px">
<h2 id="aa_header"></h3><br>
<h3 id="aa_version"></h3>
<h3 id="aa_ip"></h3>
<h3 id="aa_connected"></span> Connected</h3>
<!-- FAB button with ripple -->
<button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect" id="power">
<i class="material-icons">power_settings_new</i>
</button>
</div>
<div id="main1" onclick="mainUI()">
<span class="material-icons" id="main1_icon">
stay_primary_landscape
</span>
<span id="main1_text">Enter Main UI</span>
</div>
<div id="main2">
<span class="material-icons" id="main2_icon">
table_view
</span>
<span id="main2_text">Table View</span>
</div>
<div id="main3">
<span class="material-icons" id="main3_icon">
developer_mode
</span>
<span id="main3_text">Developers Dashboard</span>
</div>
<div id="main4" onclick="logout()">
<span class="material-icons" id="main4_icon">
logout
</span>
<span id="main4_text">Logout</span>
</div>
</div>
<script src="js/renderer.js"></script>
<script src="js/script.js"></script>
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="css/icon.css">
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v125/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
+261
View File
@@ -0,0 +1,261 @@
#main_logo {
display: flex;
justify-content: center;
}
html {
font-family: Arial, Helvetica, sans-serif;
height: 100%;
margin: 0;
padding: 0;
}
#logo_img {
margin-top: 30px;
}
#aa_header {
display: inline;
}
#aa_version {
display: inline;
position: relative;
top: -95px;
left: 155px;
font-size: 16px;
color: gray;
}
#aa_ip {
display: inline;
position: relative;
top: -75px;
left: -227px;
font-size: 16px;
color: gray;
}
#iframe {
width: 99.99999%;
height: 99.9999%;
border: none
}
#iframe_div {
width: 100%;
height: 100%;
}
#aa_connected {
display: inline;
position: relative;
top: -55px;
left: -295px;
font-size: 16px;
color: green;
}
#power {
position: absolute;
top: 5%;
right: 6%;
}
#status {
margin-top: 25px;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
width: 90%;
display: block;
margin-left: auto;
margin-right: auto;
}
#main1 {
cursor: pointer;
display: inline-block;
background-color: white;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
position: absolute;
left: 2%;
width: 38%;
margin: 3%;
height: 100px;
padding: 5px;
}
#main1_icon {
font-size: 100px;
position: absolute;
left: 5px;
top: 5px;
font-weight: lighter;
}
#main1_text {
position: absolute;
left: 120px;
font-size: 26px;
top: 40%;
}
#main2 {
cursor: pointer;
display: inline-block;
background-color: white;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
position: absolute;
right: 2%;
width: 38%;
margin: 3%;
height: 100px;
padding: 5px;
}
#main2_icon {
font-size: 100px;
position: absolute;
left: 5px;
top: 5px;
font-weight: lighter;
}
#main2_text {
position: absolute;
left: 120px;
font-size: 26px;
top: 40%;
}
#main3 {
cursor: pointer;
display: inline-block;
background-color: white;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
width: 38%;
margin: 3%;
height: 100px;
padding: 5px;
position: absolute;
left: 2%;
bottom: 2%;
}
#main3_icon {
font-size: 90px;
position: absolute;
top: 10px;
font-weight: lighter;
}
#main3_text {
position: absolute;
left: 120px;
font-size: 26px;
top: 25%;
line-height: 30px;
}
#main4 {
cursor: pointer;
cursor: pointer;
display: inline-block;
background-color: white;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
width: 38%;
margin: 3%;
height: 100px;
padding: 5px;
position: absolute;
right: 2%;
bottom: 2%;
}
#main4_icon {
font-size: 100px;
position: absolute;
left: 5px;
top: 5px;
font-weight: lighter;
}
#main4_text {
position: absolute;
left: 120px;
font-size: 26px;
top: 40%;
}
#hostname_input {
display: block;
margin-left: auto;
margin-right: auto;
}
#username_input {
display: block;
margin-left: auto;
margin-right: auto;
}
#password_input {
display: block;
margin-left: auto;
margin-right: auto;
}
#login_button {
display: block;
margin-left: auto;
margin-right: auto;
}
#hostname_connect {
display: block;
margin-left: auto;
margin-right: auto;
}
.cet-titlebar,
.cet-titlebar>* {
font-weight: bold;
}
#logo_img {
display: block;
margin-left: auto;
margin-right: auto;
}
#title {
text-align: center;
}
#floating_nav {
z-index: 1;
width: 158px;
height: 50px;
border-radius: 8px;
background-color: rgba(255,255,255,1);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 9px 20px 0 rgba(0, 0, 0, .7);
position: absolute;
bottom: 10px;
left: 10px;
}
#back {
margin: 5px;
}
#forward {
margin: 5px;
}
#refresh {
margin: 5px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

+59
View File
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title id="title">Aviation Assistant Link</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body onload="document.getElementById('login_button').click()">
<div id="main">
<img id="logo_img" src="images/logo.png"><br>
<h3 id="title">Aviation Assistant Link</h3>
<form action="#">
<div class="mdl-textfield mdl-js-textfield" id="hostname_input">
<input class="mdl-textfield__input" type="text" id="hostname">
<label class="mdl-textfield__label" for="hostname">Aviation Assistant Device Hostname</label>
</div>
<!-- Raised button with ripple -->
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" id="hostname_connect" onclick="connectToHostname()">
Connect
</button>
</form>
</div>
<div id="login" style="display: none;">
<img id="logo_img" src="images/logo.png"><br>
<h3 id="title">Aviation Assistant Login</h3>
<form action="#">
<div class="mdl-textfield mdl-js-textfield" id="username_input">
<input class="mdl-textfield__input" type="text" id="username">
<label class="mdl-textfield__label" for="hostname">Username</label>
</div>
<div class="mdl-textfield mdl-js-textfield" id="password_input">
<input class="mdl-textfield__input" type="password" id="password">
<label class="mdl-textfield__label" for="hostname">Password</label>
</div>
<!-- Raised button with ripple -->
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" id="login_button"
onclick="login()">
Log In
</button>
</form>
</div>
<div id="toast" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>
<script src="js/renderer.js"></script>
<script src="js/script.js"></script>
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="css/icon.css">
</body>
</html>
+117
View File
@@ -0,0 +1,117 @@
// Modules to control application life and create native browser window
const {
app,
BrowserWindow,
Menu,
webContents
} = require('electron');
var mainWindow
const path = require('path');
const {
setupTitlebar,
attachTitlebarToWindow
} = require('custom-electron-titlebar/main');
// setup the titlebar main process
setupTitlebar();
createWindow = () => {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
titleBarStyle: 'hidden',
//frame: false, // needed if process.versions.electron < 14
webPreferences: {
preload: path.join(__dirname, '/js/preload.js')
}
});
const menu = Menu.buildFromTemplate(exampleMenuTemplate());
Menu.setApplicationMenu(menu);
// and load the index.html of the app.
mainWindow.loadFile('index.html');
// Open the DevTools.
// mainWindow.webContents.openDevTools()
//attach fullscreen(f11 and not 'maximized') && focus listeners
attachTitlebarToWindow(mainWindow);
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit();
})
const exampleMenuTemplate = () => [{
label: "File",
submenu: [{
label: "Connect to AA Protocol Device",
click: async () => {
var contents = mainWindow.webContents
contents.loadFile('index.html')
}
},
{
label: "Quit",
click: () => app.quit()
}
]
},
{
label: "Edit",
submenu: [{
label: "Back",
click: async () => {
var contents = mainWindow.webContents
contents.goBack()
}
},
{
label: "Forward",
click: async () => {
var contents = mainWindow.webContents
contents.goForward()
}
}
]
},
{
label: "Advanced",
submenu: [{
role: "reload"
},
{
role: "forceReload"
},
{
type: "separator"
},
{
role: "toggleDevTools"
},
{
label: "Quit",
click: () => app.quit()
}
]
}
];
+22
View File
@@ -0,0 +1,22 @@
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { Titlebar, Color } = require('custom-electron-titlebar');
const path = require('path');
let titlebar
window.addEventListener('DOMContentLoaded', () => {
titlebar = new Titlebar({
backgroundColor: Color.fromHex("#FFFFFF"),
itemBackgroundColor: Color.fromHex("#FFFFFF"),
//svgColor: Color.WHITE
icon: path.join(__dirname, '../images', '/icon.jpg')
//menu: null // = do not automatically use Menu.applicationMenu
})
})
function changeTitlebar(hex){
titlebar.updateBackground(Color.fromHex(hex));
}
+6
View File
@@ -0,0 +1,6 @@
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
+74
View File
@@ -0,0 +1,74 @@
function connectToHostname() {
document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Connecting to Host....'});
var xmlhttp = new XMLHttpRequest();
xmlhttp.timeout = 5000;
xmlhttp.onerror = function() { document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Failed to Connect'}); }
xmlhttp.ontimeout = function () { document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Failed to Connect'}); };
xmlhttp.onload = function() {
document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Connected to Host!'});
document.getElementById("login").style.display = "block"
document.getElementById("main").style.display = "none"
}
xmlhttp.open("GET","http://"+document.getElementById("hostname").value+":5000/connection",true);
xmlhttp.send();
}
function login() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:5000/authentication", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.response == "OK") {
document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Authentication Success'});
window.location = "connected.html"
} else {
document.querySelector('#toast').MaterialSnackbar.showSnackbar({message: 'Invalid Login'});
}
}
}
xhr.send(JSON.stringify({
username: document.getElementById("username").value,
password: document.getElementById("password").value
}));
}
function logout() {
window.location = "index.html"
}
function mainUI() {
window.location = "sub_pages/ui.html"
// ABOVE IS TESTING, USE BELOW FOR PRODUCTION
// document.getElementById("iframe").setAttribute("src","http://"+document.getElementById("aa_ip").innerHTML+"/dump1090/gmap.html")
}
function pullInformation() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://127.0.0.1:5000/information", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.response)
data = JSON.parse(xhr.response)
document.getElementById("aa_header").innerHTML = data['name']
document.getElementById("aa_version").innerHTML = data['version']
document.getElementById("aa_ip").innerHTML = data['ip']
}
}
xhr.send();
}
function loadIP() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://127.0.0.1:5000/information", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.response)
data = JSON.parse(xhr.response)
document.getElementById("iframe").setAttribute("src","http://"+data['ip']+"/gmap.html")
}
}
xhr.send();
}
+3098
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
{
"name": "AviationAssistantLink",
"version": "1.0.0",
"description": "Aviation Assistant Link",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/LAX18/AviationAssistantLink.git"
},
"keywords": [],
"author": "LAX18",
"license": "ISC",
"bugs": {
"url": "https://github.com/LAX18/AviationAssistantLink/issues"
},
"homepage": "https://github.com/LAX18/AviationAssistantLink#readme",
"dependencies": {
"custom-electron-titlebar": "^4.1.0",
"electron": "^17.0.1",
"material-components-web": "^13.0.0",
"material-design-lite": "^1.3.0"
}
}
+33
View File
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aviation Assistant Link - UI Connected</title>
<link rel="stylesheet" href="../css/style.css">
</head>
<body onload="loadIP()">
<div id="iframe_div">
<iframe id="iframe"></iframe>
</div>
<div id="floating_nav">
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab" id="back" onclick="window.history.back();">
<i class="material-icons">arrow_back_ios</i>
</button>
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab" id="forward" onclick="window.history.forward();">
<i class="material-icons">arrow_forward_ios</i>
</button>
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab" id="refresh" onclick="document.getElementById('iframe').src = document.getElementById('iframe').src">
<i class="material-icons">refresh</i>
</button>
</div>
<script src="../js/renderer.js"></script>
<script src="../js/script.js"></script>
<link rel="stylesheet" href="../node_modules/material-design-lite/material.min.css">
<script src="../node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="../css/icon.css">
</body>
</html>