Start of Backend Stuff
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
from flask import Flask, json, request
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
name = "Aviation Assistant v2"
|
||||
software_version = "v.2.7.2-aaf68f9bf2b51806300f7830f67f5254f04a90a2"
|
||||
|
||||
@app.route('/brightness',methods = ['POST'])
|
||||
def brightness():
|
||||
if request.method == 'POST':
|
||||
json = request.get_json()
|
||||
if json['level'] < 255 and json['level'] > 15:
|
||||
status = os.popen('echo '+str(json['level'])+' > /sys/class/backlight/rpi_backlight/brightness').read()
|
||||
elif json['level'] == 256:
|
||||
status = os.popen('sudo cat /sys/class/backlight/rpi_backlight/brightness').read()
|
||||
return status
|
||||
|
||||
@app.route('/information',methods = ['GET'])
|
||||
def information():
|
||||
ip = os.popen("ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'").read()
|
||||
wifi_ip, bluetooth_ip, dump1090_version, bt_connection, tar1090_version = "N/A"
|
||||
json = {
|
||||
"name": name,
|
||||
"software_version": version,
|
||||
"wifi_ip": ip,
|
||||
"bluetooth_ip": bt_ip,
|
||||
"dump1090_version": dump1090_ver,
|
||||
"bt_connection": bt_connection,
|
||||
"tar1090_version": tar1090_version
|
||||
}
|
||||
return json
|
||||
|
||||
@app.route('/alive',methods = ['GET'])
|
||||
def alive():
|
||||
return True
|
||||
|
||||
|
||||
@app.after_request
|
||||
def after_request(response):
|
||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
||||
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
|
||||
response.headers.add('Access-Control-Allow-Methods', 'POST')
|
||||
return response
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
+135
-149
@@ -1,154 +1,140 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>Aviation Assistant V2</title>
|
||||
<link rel="canonical" href="https://simplepwa.com" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Aviation Assistant V2</title>
|
||||
<link rel="canonical" href="https://simplepwa.com" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Icons and Colors -->
|
||||
<meta name="apple-mobile-web-app-title" content="AA V2">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="application-name" content="Aviation Assistant V2">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
|
||||
<link rel="manifest" href="./manifest.json">
|
||||
<link rel="mask-icon" href="./safari-pinned-tab.svg" color="#000000">
|
||||
<link rel="shortcut icon" href="./favicon.ico">
|
||||
<meta name="msapplication-TileColor" content="#000000">
|
||||
<meta name="msapplication-TileImage" content="./mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="./browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<!-- Icons and Colors -->
|
||||
<meta name="apple-mobile-web-app-title" content="AA V2" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="application-name" content="Aviation Assistant V2" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="mask-icon" href="./safari-pinned-tab.svg" color="#000000" />
|
||||
<link rel="shortcut icon" href="./favicon.ico" />
|
||||
<meta name="msapplication-TileColor" content="#000000" />
|
||||
<meta name="msapplication-TileImage" content="./mstile-144x144.png" />
|
||||
<meta name="msapplication-config" content="./browserconfig.xml" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.grey-teal.min.css">
|
||||
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.grey-teal.min.css" />
|
||||
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
|
||||
<!-- Javscript -->
|
||||
<script>
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", () => {
|
||||
navigator.serviceWorker && navigator.serviceWorker.register("./sw.js");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script defer src="./main.js"></script>
|
||||
</head>
|
||||
<div id="header">
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="main()">
|
||||
tar1090
|
||||
</button>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="window.location.href = 'shortcuts://run-shortcut?name=OpenADSBWebLaunch'">
|
||||
OpenADSB
|
||||
</button>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="settings()">
|
||||
Settings
|
||||
</button>
|
||||
<!-- Javscript -->
|
||||
<script>
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", () => {
|
||||
navigator.serviceWorker && navigator.serviceWorker.register("./sw.js");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script defer src="./main.js"></script>
|
||||
</head>
|
||||
<body onload="onload()">
|
||||
<div id="loading" >
|
||||
<img id="loading_icon" src="images/loading.gif">
|
||||
<br>Connecting to Aviation Assistant<br>Please Wait.
|
||||
</div>
|
||||
<div id="main_tab">
|
||||
<iframe src="http://aa.local/tar1090"></iframe>
|
||||
</div>
|
||||
<div id="settings" style="display: none;">
|
||||
<h2>Settings</h2>
|
||||
<div id="header" style="display: none">
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="main()">tar1090</button>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="window.location.href = 'shortcuts://run-shortcut?name=OpenADSBWebLaunch'">OpenADSB</button>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised" onclick="settings()">Settings</button>
|
||||
</div>
|
||||
<div id="main_tab" style="display: none">
|
||||
<iframe src="http://aa.local/tar1090"></iframe>
|
||||
</div>
|
||||
<div id="settings" style="display: none">
|
||||
<h2>Settings</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h6>Aviation Assistant Configuration Settings</h6>
|
||||
<table id="settings_list" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="mdl-data-table__cell--non-numeric">Configuration Variable</th>
|
||||
<th class="mdl-data-table__cell--non-numeric">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Wifi Network</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">PeaseWifi-Slow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Bluetooth Connection</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">CONNECTED</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">WIFI IP</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">192.168.0.26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Bluetooth IP</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">172.20.1.1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Dump1090 Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">ver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">tar1090 Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">dafba99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Aviation Assistant Software Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">v.0.1</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<div id="wifi-card" class="demo-card-square mdl-card mdl-shadow--2dp">
|
||||
<div class="mdl-card__title mdl-card--expand">
|
||||
<h2 class="mdl-card__title-text">Wifi Settings</h2>
|
||||
</div>
|
||||
<div class="mdl-card__supporting-text">
|
||||
<form action="#">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="sample3">
|
||||
<label class="mdl-textfield__label" for="sample3">Wifi Network Name</label>
|
||||
</div>
|
||||
</form>
|
||||
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
|
||||
<input type="checkbox" id="checkbox-1" class="mdl-checkbox__input">
|
||||
<span class="mdl-checkbox__label">Password Required</span>
|
||||
</label>
|
||||
<form action="#">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="sample3">
|
||||
<label class="mdl-textfield__label" for="sample3">Password.</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="mdl-card__actions mdl-card--border">
|
||||
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
|
||||
Connect To Wifi
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="demo-card-square mdl-card mdl-shadow--2dp" id="buttons_card">
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">
|
||||
Reboot
|
||||
</button><br>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">
|
||||
Poweroff
|
||||
</button><br>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">
|
||||
Update
|
||||
</button><br>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">
|
||||
Licenses / Credits
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h6>Aviation Assistant Configuration Settings</h6>
|
||||
<table id="settings_list" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="mdl-data-table__cell--non-numeric">Configuration Variable</th>
|
||||
<th class="mdl-data-table__cell--non-numeric">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Wifi Network</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">PeaseWifi-Slow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Bluetooth Connection</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">CONNECTED</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">WIFI IP</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">192.168.0.26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Bluetooth IP</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">172.20.1.1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Dump1090 Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">ver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">tar1090 Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">dafba99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">Aviation Assistant Software Version</td>
|
||||
<td class="mdl-data-table__cell--non-numeric">v.0.1</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<div id="wifi-card" class="demo-card-square mdl-card mdl-shadow--2dp">
|
||||
<div class="mdl-card__title mdl-card--expand">
|
||||
<h2 class="mdl-card__title-text">Wifi Settings</h2>
|
||||
</div>
|
||||
<div class="mdl-card__supporting-text">
|
||||
<form action="#">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="sample3" />
|
||||
<label class="mdl-textfield__label" for="sample3">Wifi Network Name</label>
|
||||
</div>
|
||||
</form>
|
||||
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
|
||||
<input type="checkbox" id="checkbox-1" class="mdl-checkbox__input" />
|
||||
<span class="mdl-checkbox__label">Password Required</span>
|
||||
</label>
|
||||
<form action="#">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="sample3" />
|
||||
<label class="mdl-textfield__label" for="sample3">Password.</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="mdl-card__actions mdl-card--border">
|
||||
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect"> Connect To Wifi </a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="demo-card-square mdl-card mdl-shadow--2dp" id="buttons_card">
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">Reboot</button><br />
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">Poweroff</button><br />
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">Update</button><br />
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised">Licenses / Credits</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,4 +6,20 @@ function main() {
|
||||
function settings() {
|
||||
document.getElementById("main_tab").style.display = "none";
|
||||
document.getElementById("settings").style.display = "block";
|
||||
}
|
||||
|
||||
function onload() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "http://aa.local:5000/alive", true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4 && xhr.status != 0) {
|
||||
document.getElementById("loading").style.display = "none"
|
||||
document.getElementById("header").style.display = "block"
|
||||
document.getElementById("main_tab").style.display = "block"
|
||||
} else if (xhr.readyState == 4) {
|
||||
setTimeout(onload(), 1000000000)
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
+74
-47
@@ -1,72 +1,99 @@
|
||||
html, body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-family: helvetica, arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
@font-face {
|
||||
font-family: SF-Pro;
|
||||
src: url("./SF-Pro.ttf");
|
||||
}
|
||||
|
||||
html * {
|
||||
font-family: SF-Pro !important;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
-webkit-touch-callout: none; /* iOS Safari */
|
||||
-webkit-user-select: none; /* Safari */
|
||||
user-select: none; /* Non-prefixed version, currently */
|
||||
}
|
||||
|
||||
#header {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 2%;
|
||||
top: 10px;
|
||||
border-radius: 8px;
|
||||
z-index: 1;
|
||||
background-color: rgba(255,255,255,.7);
|
||||
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 2%;
|
||||
top: 10px;
|
||||
border-radius: 8px;
|
||||
z-index: 1;
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#main_tab {
|
||||
height: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#main_tab > iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#settings > h2 {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#wifi-card {
|
||||
margin-left: 2%;
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.demo-card-square.mdl-card {
|
||||
width: 320px;
|
||||
height: 320px;
|
||||
}
|
||||
width: 320px;
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
.demo-card-square > .mdl-card__title {
|
||||
color: #fff;
|
||||
background:
|
||||
url('../assets/demos/dog.png') bottom right 15% no-repeat #46B6AC;
|
||||
}
|
||||
color: #fff;
|
||||
background: url("../assets/demos/dog.png") bottom right 15% no-repeat #46b6ac;
|
||||
}
|
||||
|
||||
#settings_list {
|
||||
margin-left: 2%;
|
||||
}
|
||||
#settings_list {
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
#settings > table > tbody > tr > td {
|
||||
padding-right: 10px;
|
||||
text-align: center;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#buttons_card > button {
|
||||
width: 200px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#settings > table > tbody > tr > td {
|
||||
padding-right: 10px;
|
||||
#buttons_card {
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
#loading_icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
text-align: center;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#buttons_card > button {
|
||||
width: 200px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#buttons_card {
|
||||
width: 260px;
|
||||
}
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
@@ -44,6 +44,7 @@ self.addEventListener("install", event => {
|
||||
"safari-pinned-tab.svg", // Favicon, Safari pinned tab
|
||||
"share.jpg", // Social media sharing
|
||||
"style.css", // Main CSS file
|
||||
"SF-Pro.ttf", // Main Font File
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user