switching back to flask because python simple
parent
57f218f3bc
commit
0f4a23f600
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -96,3 +96,60 @@ function writeSrc(className, data) {
|
|||
e.src = data;
|
||||
});
|
||||
}
|
||||
|
||||
function timeSince(date) {
|
||||
|
||||
let seconds = Math.floor((new Date() - date) / 1000);
|
||||
|
||||
let interval = seconds / 31536000;
|
||||
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " years";
|
||||
}
|
||||
interval = seconds / 2592000;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " months";
|
||||
}
|
||||
interval = seconds / 86400;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " days";
|
||||
}
|
||||
interval = seconds / 3600;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " hours";
|
||||
}
|
||||
interval = seconds / 60;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " minutes";
|
||||
}
|
||||
return Math.floor(seconds) + " seconds";
|
||||
}
|
||||
|
||||
function timeSinceString(date) {
|
||||
|
||||
date = Date.parse(date);
|
||||
let seconds = Math.floor((new Date() - date) / 1000);
|
||||
|
||||
let interval = seconds / 31536000;
|
||||
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " years";
|
||||
}
|
||||
interval = seconds / 2592000;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " months";
|
||||
}
|
||||
interval = seconds / 86400;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " days";
|
||||
}
|
||||
interval = seconds / 3600;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " hours";
|
||||
}
|
||||
interval = seconds / 60;
|
||||
if (interval > 1) {
|
||||
return Math.floor(interval) + " minutes";
|
||||
}
|
||||
return Math.floor(seconds) + " seconds";
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
|
||||
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
||||
<title>API Reference</title>
|
||||
</head>
|
||||
<body>
|
||||
<rapi-doc
|
||||
|
|
@ -10,7 +11,7 @@
|
|||
primary-color = "#bc1f2d"
|
||||
show-header = "false"
|
||||
show-info = "true"
|
||||
spec-url = "http://3.141.15.55/api/api_spec.json"
|
||||
spec-url = "{% include 'api_url.html' %}/api/api_spec.json"
|
||||
default-schema-tab = 'example'
|
||||
|
||||
>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
http://velconnect.crabdance.com
|
||||
|
|
@ -1,17 +1,9 @@
|
|||
<html>
|
||||
{% extends 'single.html' %}
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
{% block content %}
|
||||
|
||||
|
||||
<style>
|
||||
<style>
|
||||
body {
|
||||
background-color: #333;
|
||||
font-size: 1.2em;
|
||||
|
|
@ -23,13 +15,9 @@
|
|||
font-family: arial, sans-serif;
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="centered">
|
||||
</style>
|
||||
<div class="centered">
|
||||
🤮 FAIL 🤡
|
||||
</div>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,20 +1,10 @@
|
|||
<html>
|
||||
{% extends 'single.html' %}
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
{% block content %}
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/static/css/spectre.min.css">
|
||||
<script src="/static/js/util.js"></script>
|
||||
<style>
|
||||
<style>
|
||||
.container {
|
||||
max-width: 30em;
|
||||
}
|
||||
|
|
@ -32,21 +22,18 @@
|
|||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div id="loading" class="loading loading-lg"></div>
|
||||
<div id="failure" style="display: none;">☹️</div>
|
||||
<div id="loading"><br><br>
|
||||
<div class="loading loading-lg"></div>
|
||||
</div>
|
||||
<div id="failure" style="display: none;"><br><br><br>☹️</div>
|
||||
|
||||
|
||||
<div id="headset_details" style="display: none;">
|
||||
<div id="headset_details" style="display: none;">
|
||||
<div class="panel card">
|
||||
<div class="panel-header text-center">
|
||||
<figure class="avatar avatar-lg"><img src="/static/favicons/android-chrome-192x192.png"
|
||||
alt="Avatar"></figure>
|
||||
<figure class="avatar avatar-lg"><img src="/static/favicons/android-chrome-192x192.png" alt="Avatar"></figure>
|
||||
<div class="panel-title h5 mt-10">Headset Info</div>
|
||||
<div class="panel-subtitle hw_id">---</div>
|
||||
</div>
|
||||
|
|
@ -64,14 +51,14 @@
|
|||
<br>
|
||||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">First Added</div>
|
||||
<div class="tile-title text-bold">First Seen</div>
|
||||
<div class="tile-subtitle date_created">---</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">Last Used</div>
|
||||
<div class="tile-title text-bold">Last Login</div>
|
||||
<div class="tile-subtitle last_used">---</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -101,7 +88,7 @@
|
|||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">User Color</div>
|
||||
<input class="btn user_color" type="color" id="user_color" placeholder="#ffffff">
|
||||
<input class="btn user_color coloris" type="text" id="user_color" placeholder="#ffffff">
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_user_color"
|
||||
|
|
@ -112,7 +99,7 @@
|
|||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">Carpet Color</div>
|
||||
<input class="btn carpet_color" type="color" id="carpet_color" placeholder="#ffffff">
|
||||
<input class="btn carpet_color coloris" type="text" id="carpet_color" placeholder="#ffffff">
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color"
|
||||
|
|
@ -123,10 +110,10 @@
|
|||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="text/javascript" src="/static/js/coloris.min.js"></script>
|
||||
<script>
|
||||
|
||||
let submit_button = document.getElementById('submit_pairing_code');
|
||||
let pair_code_input = document.getElementById('pair_code');
|
||||
|
|
@ -141,17 +128,16 @@
|
|||
|
||||
// check cookie
|
||||
let hw_id = getCookie('hw_id');
|
||||
loading.style.display = "none";
|
||||
if (hw_id != "") {
|
||||
|
||||
httpGetAsync('/api/get_state/' + hw_id, (resp) => {
|
||||
httpGetAsync('{% include "api_url.html" %}/api/get_state/' + hw_id, (resp) => {
|
||||
console.log(resp);
|
||||
let respData = JSON.parse(resp);
|
||||
|
||||
writeClass('hw_id', respData['user']['hw_id']);
|
||||
writeValue('current_room', respData['user']['current_room']);
|
||||
writeClass('date_created', respData['user']['date_created']);
|
||||
writeClass('last_used', respData['user']['last_used']);
|
||||
writeClass('date_created', respData['user']['date_created'] + "<br>" + timeSinceString(respData['user']['date_created']) + " ago");
|
||||
writeClass('last_used', respData['user']['last_used'] + "<br>" + timeSinceString(respData['user']['last_used']) + " ago");
|
||||
writeValue('user_color', respData['user']['user_color']);
|
||||
writeValue('user_name', respData['user']['user_name']);
|
||||
if (respData['room']) {
|
||||
|
|
@ -159,40 +145,42 @@
|
|||
writeValue('carpet_color', respData['room']['carpet_color']);
|
||||
}
|
||||
|
||||
loading.style.display = "none";
|
||||
headset_details.style.display = "block";
|
||||
}, (status) => {
|
||||
loading.style.display = "none";
|
||||
failure.style.display = "block";
|
||||
});
|
||||
|
||||
function setUserData(endpoint, data) {
|
||||
httpPostAsync('/api/set_headset_details/' + hw_id + '/' + endpoint,
|
||||
httpPostAsync('{% include "api_url.html" %}/api/set_headset_details/' + hw_id + '/' + endpoint,
|
||||
data,
|
||||
(resp) => {console.log('success');},
|
||||
(status) => {console.log('fail');}
|
||||
(resp) => { console.log('success'); },
|
||||
(status) => { console.log('fail'); }
|
||||
);
|
||||
}
|
||||
function setRoomData(endpoint, data) {
|
||||
httpPostAsync('/api/set_room_details/' + current_room.value + '/' + endpoint,
|
||||
httpPostAsync('{% include "api_url.html" %}/api/set_room_details/' + current_room.value + '/' + endpoint,
|
||||
data,
|
||||
(resp) => {console.log('success');},
|
||||
(status) => {console.log('fail');}
|
||||
(resp) => { console.log('success'); },
|
||||
(status) => { console.log('fail'); }
|
||||
);
|
||||
}
|
||||
|
||||
set_room_id.addEventListener('click', () => {
|
||||
setUserData('current_room', {"current_room": current_room.value});
|
||||
setUserData('current_room', { "current_room": current_room.value });
|
||||
});
|
||||
document.getElementById('set_user_color').addEventListener('click', () => {
|
||||
setUserData('user_color', {"user_color": document.getElementById('user_color').value});
|
||||
setUserData('user_color', { "user_color": document.getElementById('user_color').value });
|
||||
});
|
||||
document.getElementById('set_user_name').addEventListener('click', () => {
|
||||
setUserData('user_name', {"user_name": document.getElementById('user_name').value});
|
||||
setUserData('user_name', { "user_name": document.getElementById('user_name').value });
|
||||
});
|
||||
document.getElementById('set_tv_url').addEventListener('click', () => {
|
||||
setRoomData('tv_url', {"tv_url": document.getElementById('tv_url').value});
|
||||
setRoomData('tv_url', { "tv_url": document.getElementById('tv_url').value });
|
||||
});
|
||||
document.getElementById('set_carpet_color').addEventListener('click', () => {
|
||||
setRoomData('carpet_color', {"carpet_color": document.getElementById('carpet_color').value});
|
||||
setRoomData('carpet_color', { "carpet_color": document.getElementById('carpet_color').value });
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
@ -204,7 +192,23 @@
|
|||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
Coloris({
|
||||
el: '.coloris',
|
||||
swatches: [
|
||||
'#264653',
|
||||
'#2a9d8f',
|
||||
'#e9c46a',
|
||||
'#f4a261',
|
||||
'#e76f51',
|
||||
'#d62828',
|
||||
'#023e8a',
|
||||
'#0077b6',
|
||||
'#0096c7',
|
||||
'#00b4d8',
|
||||
'#48cae4',
|
||||
]
|
||||
});
|
||||
|
||||
</html>
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
@ -1,20 +1,8 @@
|
|||
<html>
|
||||
{% extends 'single.html' %}
|
||||
|
||||
<head>
|
||||
{% block content %}
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/static/css/spectre.min.css">
|
||||
<script src="/static/js/util.js"></script>
|
||||
<style>
|
||||
<style>
|
||||
:root {
|
||||
--primary-color: #bc1f2d;
|
||||
}
|
||||
|
|
@ -40,18 +28,10 @@
|
|||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- <div class="hero bg-gray">
|
||||
<div class="hero-body">
|
||||
<h1>Pair your headset.</h1>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card">
|
||||
<div class="card-image">
|
||||
<img src="/static/img/pair_code_screenshot.png" class="img-responsive">
|
||||
</div>
|
||||
|
|
@ -66,15 +46,15 @@
|
|||
<input class="btn" type="text" id="pair_code" placeholder="0000">
|
||||
<button class="btn btn-primary" id="submit_pairing_code">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
|
||||
let submit_button = document.getElementById('submit_pairing_code');
|
||||
let pair_code_input = document.getElementById('pair_code');
|
||||
submit_button.addEventListener('click', () => {
|
||||
httpGetAsync('/api/pair_headset/' + pair_code_input.value, (resp) => {
|
||||
httpGetAsync("{% include 'api_url.html' %}/api/pair_headset/" + pair_code_input.value, (resp) => {
|
||||
console.log(resp);
|
||||
let respData = JSON.parse(resp);
|
||||
if (respData['hw_id'] != '') {
|
||||
|
|
@ -85,7 +65,5 @@
|
|||
window.location.href = "/failure";
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title></title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/spectre.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/spectre-exp.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/spectre-icons.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/coloris.min.css">
|
||||
<script src="/static/js/util.js"></script>
|
||||
<style>
|
||||
.container {
|
||||
max-width: 30em;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin: 1em;
|
||||
box-shadow: 0 0 2em #0003;
|
||||
}
|
||||
|
||||
input.btn {
|
||||
cursor: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,17 +1,9 @@
|
|||
<html>
|
||||
{% extends 'single.html' %}
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
{% block content %}
|
||||
|
||||
|
||||
<style>
|
||||
<style>
|
||||
body {
|
||||
background-color: #333;
|
||||
font-size: 1.2em;
|
||||
|
|
@ -23,13 +15,9 @@
|
|||
font-family: arial, sans-serif;
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="centered">
|
||||
</style>
|
||||
<div class="centered">
|
||||
🎉 SUCCESS 🎉
|
||||
</div>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
|
||||
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
||||
<title>API Reference</title>
|
||||
</head>
|
||||
<body>
|
||||
<rapi-doc
|
||||
|
|
|
|||
|
|
@ -1,17 +1,8 @@
|
|||
<html>
|
||||
---
|
||||
title: "FAILURE"
|
||||
---
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
|
||||
<style>
|
||||
<style>
|
||||
body {
|
||||
background-color: #333;
|
||||
font-size: 1.2em;
|
||||
|
|
@ -23,13 +14,8 @@
|
|||
font-family: arial, sans-serif;
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="centered">
|
||||
<div class="centered">
|
||||
🤮 FAIL 🤡
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</div>
|
||||
|
|
@ -1,20 +1,7 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/css/spectre.min.css">
|
||||
<script src="/js/util.js"></script>
|
||||
<style>
|
||||
---
|
||||
title: VEL Connect
|
||||
---
|
||||
<style>
|
||||
.container {
|
||||
max-width: 30em;
|
||||
}
|
||||
|
|
@ -32,21 +19,16 @@
|
|||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div id="loading" class="loading loading-lg"></div>
|
||||
<div id="failure" style="display: none;">☹️</div>
|
||||
<div id="loading"><br><br><div class="loading loading-lg"></div></div>
|
||||
<div id="failure" style="display: none;"><br><br><br>☹️</div>
|
||||
|
||||
|
||||
<div id="headset_details" style="display: none;">
|
||||
<div id="headset_details" style="display: none;">
|
||||
<div class="panel card">
|
||||
<div class="panel-header text-center">
|
||||
<figure class="avatar avatar-lg"><img src="/favicons/android-chrome-192x192.png"
|
||||
alt="Avatar"></figure>
|
||||
<figure class="avatar avatar-lg"><img src="/favicons/android-chrome-192x192.png" alt="Avatar"></figure>
|
||||
<div class="panel-title h5 mt-10">Headset Info</div>
|
||||
<div class="panel-subtitle hw_id">---</div>
|
||||
</div>
|
||||
|
|
@ -101,7 +83,7 @@
|
|||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">User Color</div>
|
||||
<input class="btn user_color" type="color" id="user_color" placeholder="#ffffff">
|
||||
<input class="btn user_color coloris" type="text" id="user_color" placeholder="#ffffff">
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_user_color"
|
||||
|
|
@ -112,7 +94,7 @@
|
|||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">Carpet Color</div>
|
||||
<input class="btn carpet_color" type="color" id="carpet_color" placeholder="#ffffff">
|
||||
<input class="btn carpet_color coloris" type="text" id="carpet_color" placeholder="#ffffff">
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color"
|
||||
|
|
@ -123,10 +105,10 @@
|
|||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="text/javascript" src="/js/coloris.min.js"></script>
|
||||
<script>
|
||||
|
||||
let submit_button = document.getElementById('submit_pairing_code');
|
||||
let pair_code_input = document.getElementById('pair_code');
|
||||
|
|
@ -141,7 +123,6 @@
|
|||
|
||||
// check cookie
|
||||
let hw_id = getCookie('hw_id');
|
||||
loading.style.display = "none";
|
||||
if (hw_id != "") {
|
||||
|
||||
httpGetAsync('https://connect.vel.workers.dev/api/get_state/' + hw_id, (resp) => {
|
||||
|
|
@ -159,40 +140,42 @@
|
|||
writeValue('carpet_color', respData['room']['carpet_color']);
|
||||
}
|
||||
|
||||
loading.style.display = "none";
|
||||
headset_details.style.display = "block";
|
||||
}, (status) => {
|
||||
loading.style.display = "none";
|
||||
failure.style.display = "block";
|
||||
});
|
||||
|
||||
function setUserData(endpoint, data) {
|
||||
httpPostAsync('https://connect.vel.workers.dev/api/set_headset_details/' + hw_id + '/' + endpoint,
|
||||
data,
|
||||
(resp) => {console.log('success');},
|
||||
(status) => {console.log('fail');}
|
||||
(resp) => { console.log('success'); },
|
||||
(status) => { console.log('fail'); }
|
||||
);
|
||||
}
|
||||
function setRoomData(endpoint, data) {
|
||||
httpPostAsync('https://connect.vel.workers.dev/api/set_room_details/' + current_room.value + '/' + endpoint,
|
||||
data,
|
||||
(resp) => {console.log('success');},
|
||||
(status) => {console.log('fail');}
|
||||
(resp) => { console.log('success'); },
|
||||
(status) => { console.log('fail'); }
|
||||
);
|
||||
}
|
||||
|
||||
set_room_id.addEventListener('click', () => {
|
||||
setUserData('current_room', {"current_room": current_room.value});
|
||||
setUserData('current_room', { "current_room": current_room.value });
|
||||
});
|
||||
document.getElementById('set_user_color').addEventListener('click', () => {
|
||||
setUserData('user_color', {"user_color": document.getElementById('user_color').value});
|
||||
setUserData('user_color', { "user_color": document.getElementById('user_color').value });
|
||||
});
|
||||
document.getElementById('set_user_name').addEventListener('click', () => {
|
||||
setUserData('user_name', {"user_name": document.getElementById('user_name').value});
|
||||
setUserData('user_name', { "user_name": document.getElementById('user_name').value });
|
||||
});
|
||||
document.getElementById('set_tv_url').addEventListener('click', () => {
|
||||
setRoomData('tv_url', {"tv_url": document.getElementById('tv_url').value});
|
||||
setRoomData('tv_url', { "tv_url": document.getElementById('tv_url').value });
|
||||
});
|
||||
document.getElementById('set_carpet_color').addEventListener('click', () => {
|
||||
setRoomData('carpet_color', {"carpet_color": document.getElementById('carpet_color').value});
|
||||
setRoomData('carpet_color', { "carpet_color": document.getElementById('carpet_color').value });
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
@ -204,7 +187,22 @@
|
|||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
Coloris({
|
||||
el: '.coloris',
|
||||
swatches: [
|
||||
'#264653',
|
||||
'#2a9d8f',
|
||||
'#e9c46a',
|
||||
'#f4a261',
|
||||
'#e76f51',
|
||||
'#d62828',
|
||||
'#023e8a',
|
||||
'#0077b6',
|
||||
'#0096c7',
|
||||
'#00b4d8',
|
||||
'#48cae4',
|
||||
]
|
||||
});
|
||||
|
||||
</html>
|
||||
|
||||
</script>
|
||||
|
|
@ -1,20 +1,8 @@
|
|||
<html>
|
||||
---
|
||||
title: "Pairing"
|
||||
---
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/css/spectre.min.css">
|
||||
<script src="/js/util.js"></script>
|
||||
<style>
|
||||
<style>
|
||||
:root {
|
||||
--primary-color: #bc1f2d;
|
||||
}
|
||||
|
|
@ -40,18 +28,10 @@
|
|||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- <div class="hero bg-gray">
|
||||
<div class="hero-body">
|
||||
<h1>Pair your headset.</h1>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card">
|
||||
<div class="card-image">
|
||||
<img src="/img/pair_code_screenshot.png" class="img-responsive">
|
||||
</div>
|
||||
|
|
@ -66,10 +46,10 @@
|
|||
<input class="btn" type="text" id="pair_code" placeholder="0000">
|
||||
<button class="btn btn-primary" id="submit_pairing_code">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
|
||||
let submit_button = document.getElementById('submit_pairing_code');
|
||||
let pair_code_input = document.getElementById('pair_code');
|
||||
|
|
@ -85,7 +65,4 @@
|
|||
window.location.href = "/failure";
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</script>
|
||||
|
|
@ -1,17 +1,9 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
---
|
||||
title: "SUCCESS"
|
||||
---
|
||||
|
||||
|
||||
<style>
|
||||
<style>
|
||||
body {
|
||||
background-color: #333;
|
||||
font-size: 1.2em;
|
||||
|
|
@ -23,13 +15,8 @@
|
|||
font-family: arial, sans-serif;
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="centered">
|
||||
<div class="centered">
|
||||
🎉 SUCCESS 🎉
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
{{ partial "head.html" (dict "title" .Title ) }}
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<head>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#b91d47">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ .title }}</title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/css/spectre.min.css">
|
||||
<link rel="stylesheet" href="/css/spectre-exp.min.css">
|
||||
<link rel="stylesheet" href="/css/spectre-icons.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/css/coloris.min.css">
|
||||
<script src="/js/util.js"></script>
|
||||
<style>
|
||||
.container {
|
||||
max-width: 30em;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin: 1em;
|
||||
box-shadow: 0 0 2em #0003;
|
||||
}
|
||||
|
||||
input.btn {
|
||||
cursor: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue