switching back to flask because python simple

dev
Anton Franzluebbers 2021-11-06 20:22:55 -04:00
parent 57f218f3bc
commit 0f4a23f600
22 changed files with 739 additions and 653 deletions

1
velconnect/static/css/coloris.min.css vendored Normal file

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

6
velconnect/static/js/coloris.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -96,3 +96,60 @@ function writeSrc(className, data) {
e.src = 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";
}

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters --> <meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script> <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
<title>API Reference</title>
</head> </head>
<body> <body>
<rapi-doc <rapi-doc
@ -10,7 +11,7 @@
primary-color = "#bc1f2d" primary-color = "#bc1f2d"
show-header = "false" show-header = "false"
show-info = "true" 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' default-schema-tab = 'example'
> >

View File

@ -0,0 +1 @@
http://velconnect.crabdance.com

View File

@ -1,17 +1,9 @@
<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">
<style> <style>
body { body {
background-color: #333; background-color: #333;
font-size: 1.2em; font-size: 1.2em;
@ -23,13 +15,9 @@
font-family: arial, sans-serif; font-family: arial, sans-serif;
color: #ddd; color: #ddd;
} }
</style> </style>
</head> <div class="centered">
<body>
<div class="centered">
🤮 FAIL 🤡 🤮 FAIL 🤡
</div> </div>
</body>
</html> {% endblock %}

View File

@ -1,20 +1,10 @@
<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"> <style>
<script src="/static/js/util.js"></script>
<style>
.container { .container {
max-width: 30em; max-width: 30em;
} }
@ -32,21 +22,18 @@
.centered { .centered {
margin: auto; margin: auto;
} }
</style> </style>
</head>
<body> <div id="loading"><br><br>
<div class="container"> <div class="loading loading-lg"></div>
</div>
<div id="loading" class="loading loading-lg"></div> <div id="failure" style="display: none;"><br><br><br>☹️</div>
<div id="failure" style="display: none;">☹️</div>
<div id="headset_details" style="display: none;"> <div id="headset_details" style="display: none;">
<div class="panel card"> <div class="panel card">
<div class="panel-header text-center"> <div class="panel-header text-center">
<figure class="avatar avatar-lg"><img src="/static/favicons/android-chrome-192x192.png" <figure class="avatar avatar-lg"><img src="/static/favicons/android-chrome-192x192.png" alt="Avatar"></figure>
alt="Avatar"></figure>
<div class="panel-title h5 mt-10">Headset Info</div> <div class="panel-title h5 mt-10">Headset Info</div>
<div class="panel-subtitle hw_id">---</div> <div class="panel-subtitle hw_id">---</div>
</div> </div>
@ -64,14 +51,14 @@
<br> <br>
<div class="tile tile-centered"> <div class="tile tile-centered">
<div class="tile-content"> <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 class="tile-subtitle date_created">---</div>
</div> </div>
</div> </div>
<br> <br>
<div class="tile tile-centered"> <div class="tile tile-centered">
<div class="tile-content"> <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 class="tile-subtitle last_used">---</div>
</div> </div>
</div> </div>
@ -101,7 +88,7 @@
<div class="tile tile-centered"> <div class="tile tile-centered">
<div class="tile-content"> <div class="tile-content">
<div class="tile-title text-bold">User Color</div> <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>
<div class="tile-action"> <div class="tile-action">
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_user_color" <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 tile-centered">
<div class="tile-content"> <div class="tile-content">
<div class="tile-title text-bold">Carpet Color</div> <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>
<div class="tile-action"> <div class="tile-action">
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color" <button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color"
@ -123,10 +110,10 @@
<br> <br>
</div> </div>
</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 submit_button = document.getElementById('submit_pairing_code');
let pair_code_input = document.getElementById('pair_code'); let pair_code_input = document.getElementById('pair_code');
@ -141,17 +128,16 @@
// check cookie // check cookie
let hw_id = getCookie('hw_id'); let hw_id = getCookie('hw_id');
loading.style.display = "none";
if (hw_id != "") { if (hw_id != "") {
httpGetAsync('/api/get_state/' + hw_id, (resp) => { httpGetAsync('{% include "api_url.html" %}/api/get_state/' + hw_id, (resp) => {
console.log(resp); console.log(resp);
let respData = JSON.parse(resp); let respData = JSON.parse(resp);
writeClass('hw_id', respData['user']['hw_id']); writeClass('hw_id', respData['user']['hw_id']);
writeValue('current_room', respData['user']['current_room']); writeValue('current_room', respData['user']['current_room']);
writeClass('date_created', respData['user']['date_created']); writeClass('date_created', respData['user']['date_created'] + "<br>" + timeSinceString(respData['user']['date_created']) + " ago");
writeClass('last_used', respData['user']['last_used']); writeClass('last_used', respData['user']['last_used'] + "<br>" + timeSinceString(respData['user']['last_used']) + " ago");
writeValue('user_color', respData['user']['user_color']); writeValue('user_color', respData['user']['user_color']);
writeValue('user_name', respData['user']['user_name']); writeValue('user_name', respData['user']['user_name']);
if (respData['room']) { if (respData['room']) {
@ -159,40 +145,42 @@
writeValue('carpet_color', respData['room']['carpet_color']); writeValue('carpet_color', respData['room']['carpet_color']);
} }
loading.style.display = "none";
headset_details.style.display = "block"; headset_details.style.display = "block";
}, (status) => { }, (status) => {
loading.style.display = "none";
failure.style.display = "block"; failure.style.display = "block";
}); });
function setUserData(endpoint, data) { 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, data,
(resp) => {console.log('success');}, (resp) => { console.log('success'); },
(status) => {console.log('fail');} (status) => { console.log('fail'); }
); );
} }
function setRoomData(endpoint, data) { 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, data,
(resp) => {console.log('success');}, (resp) => { console.log('success'); },
(status) => {console.log('fail');} (status) => { console.log('fail'); }
); );
} }
set_room_id.addEventListener('click', () => { 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', () => { 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', () => { 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', () => { 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', () => { 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 { } else {
@ -204,7 +192,23 @@
</script> Coloris({
</body> el: '.coloris',
swatches: [
'#264653',
'#2a9d8f',
'#e9c46a',
'#f4a261',
'#e76f51',
'#d62828',
'#023e8a',
'#0077b6',
'#0096c7',
'#00b4d8',
'#48cae4',
]
});
</html>
</script>
{% endblock %}

View File

@ -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"> <style>
<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>
:root { :root {
--primary-color: #bc1f2d; --primary-color: #bc1f2d;
} }
@ -40,18 +28,10 @@
.centered { .centered {
margin: auto; margin: auto;
} }
</style> </style>
</head>
<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"> <div class="card-image">
<img src="/static/img/pair_code_screenshot.png" class="img-responsive"> <img src="/static/img/pair_code_screenshot.png" class="img-responsive">
</div> </div>
@ -66,15 +46,15 @@
<input class="btn" type="text" id="pair_code" placeholder="0000"> <input class="btn" type="text" id="pair_code" placeholder="0000">
<button class="btn btn-primary" id="submit_pairing_code">Submit</button> <button class="btn btn-primary" id="submit_pairing_code">Submit</button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
let submit_button = document.getElementById('submit_pairing_code'); let submit_button = document.getElementById('submit_pairing_code');
let pair_code_input = document.getElementById('pair_code'); let pair_code_input = document.getElementById('pair_code');
submit_button.addEventListener('click', () => { 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); console.log(resp);
let respData = JSON.parse(resp); let respData = JSON.parse(resp);
if (respData['hw_id'] != '') { if (respData['hw_id'] != '') {
@ -85,7 +65,5 @@
window.location.href = "/failure"; window.location.href = "/failure";
}); });
}); });
</script> </script>
</body> {% endblock %}
</html>

View File

@ -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>

View File

@ -1,17 +1,9 @@
<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">
<style> <style>
body { body {
background-color: #333; background-color: #333;
font-size: 1.2em; font-size: 1.2em;
@ -23,13 +15,9 @@
font-family: arial, sans-serif; font-family: arial, sans-serif;
color: #ddd; color: #ddd;
} }
</style> </style>
</head> <div class="centered">
<body>
<div class="centered">
🎉 SUCCESS 🎉 🎉 SUCCESS 🎉
</div> </div>
</body>
</html> {% endblock %}

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters --> <meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script> <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
<title>API Reference</title>
</head> </head>
<body> <body>
<rapi-doc <rapi-doc

View File

@ -1,17 +1,8 @@
<html> ---
title: "FAILURE"
---
<head> <style>
<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>
body { body {
background-color: #333; background-color: #333;
font-size: 1.2em; font-size: 1.2em;
@ -23,13 +14,8 @@
font-family: arial, sans-serif; font-family: arial, sans-serif;
color: #ddd; color: #ddd;
} }
</style> </style>
</head>
<body> <div class="centered">
<div class="centered">
🤮 FAIL 🤡 🤮 FAIL 🤡
</div> </div>
</body>
</html>

View File

@ -1,20 +1,7 @@
<html> ---
title: VEL Connect
<head> ---
<style>
<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>
.container { .container {
max-width: 30em; max-width: 30em;
} }
@ -32,21 +19,16 @@
.centered { .centered {
margin: auto; margin: auto;
} }
</style> </style>
</head>
<body> <div id="loading"><br><br><div class="loading loading-lg"></div></div>
<div class="container"> <div id="failure" style="display: none;"><br><br><br>☹️</div>
<div id="loading" class="loading loading-lg"></div>
<div id="failure" style="display: none;">☹️</div>
<div id="headset_details" style="display: none;"> <div id="headset_details" style="display: none;">
<div class="panel card"> <div class="panel card">
<div class="panel-header text-center"> <div class="panel-header text-center">
<figure class="avatar avatar-lg"><img src="/favicons/android-chrome-192x192.png" <figure class="avatar avatar-lg"><img src="/favicons/android-chrome-192x192.png" alt="Avatar"></figure>
alt="Avatar"></figure>
<div class="panel-title h5 mt-10">Headset Info</div> <div class="panel-title h5 mt-10">Headset Info</div>
<div class="panel-subtitle hw_id">---</div> <div class="panel-subtitle hw_id">---</div>
</div> </div>
@ -101,7 +83,7 @@
<div class="tile tile-centered"> <div class="tile tile-centered">
<div class="tile-content"> <div class="tile-content">
<div class="tile-title text-bold">User Color</div> <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>
<div class="tile-action"> <div class="tile-action">
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_user_color" <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 tile-centered">
<div class="tile-content"> <div class="tile-content">
<div class="tile-title text-bold">Carpet Color</div> <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>
<div class="tile-action"> <div class="tile-action">
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color" <button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_carpet_color"
@ -123,10 +105,10 @@
<br> <br>
</div> </div>
</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 submit_button = document.getElementById('submit_pairing_code');
let pair_code_input = document.getElementById('pair_code'); let pair_code_input = document.getElementById('pair_code');
@ -141,7 +123,6 @@
// check cookie // check cookie
let hw_id = getCookie('hw_id'); let hw_id = getCookie('hw_id');
loading.style.display = "none";
if (hw_id != "") { if (hw_id != "") {
httpGetAsync('https://connect.vel.workers.dev/api/get_state/' + hw_id, (resp) => { httpGetAsync('https://connect.vel.workers.dev/api/get_state/' + hw_id, (resp) => {
@ -159,40 +140,42 @@
writeValue('carpet_color', respData['room']['carpet_color']); writeValue('carpet_color', respData['room']['carpet_color']);
} }
loading.style.display = "none";
headset_details.style.display = "block"; headset_details.style.display = "block";
}, (status) => { }, (status) => {
loading.style.display = "none";
failure.style.display = "block"; failure.style.display = "block";
}); });
function setUserData(endpoint, data) { function setUserData(endpoint, data) {
httpPostAsync('https://connect.vel.workers.dev/api/set_headset_details/' + hw_id + '/' + endpoint, httpPostAsync('https://connect.vel.workers.dev/api/set_headset_details/' + hw_id + '/' + endpoint,
data, data,
(resp) => {console.log('success');}, (resp) => { console.log('success'); },
(status) => {console.log('fail');} (status) => { console.log('fail'); }
); );
} }
function setRoomData(endpoint, data) { function setRoomData(endpoint, data) {
httpPostAsync('https://connect.vel.workers.dev/api/set_room_details/' + current_room.value + '/' + endpoint, httpPostAsync('https://connect.vel.workers.dev/api/set_room_details/' + current_room.value + '/' + endpoint,
data, data,
(resp) => {console.log('success');}, (resp) => { console.log('success'); },
(status) => {console.log('fail');} (status) => { console.log('fail'); }
); );
} }
set_room_id.addEventListener('click', () => { 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', () => { 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', () => { 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', () => { 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', () => { 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 { } else {
@ -204,7 +187,22 @@
</script> Coloris({
</body> el: '.coloris',
swatches: [
'#264653',
'#2a9d8f',
'#e9c46a',
'#f4a261',
'#e76f51',
'#d62828',
'#023e8a',
'#0077b6',
'#0096c7',
'#00b4d8',
'#48cae4',
]
});
</html>
</script>

View File

@ -1,20 +1,8 @@
<html> ---
title: "Pairing"
---
<head> <style>
<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>
:root { :root {
--primary-color: #bc1f2d; --primary-color: #bc1f2d;
} }
@ -40,18 +28,10 @@
.centered { .centered {
margin: auto; margin: auto;
} }
</style> </style>
</head>
<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"> <div class="card-image">
<img src="/img/pair_code_screenshot.png" class="img-responsive"> <img src="/img/pair_code_screenshot.png" class="img-responsive">
</div> </div>
@ -66,10 +46,10 @@
<input class="btn" type="text" id="pair_code" placeholder="0000"> <input class="btn" type="text" id="pair_code" placeholder="0000">
<button class="btn btn-primary" id="submit_pairing_code">Submit</button> <button class="btn btn-primary" id="submit_pairing_code">Submit</button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
let submit_button = document.getElementById('submit_pairing_code'); let submit_button = document.getElementById('submit_pairing_code');
let pair_code_input = document.getElementById('pair_code'); let pair_code_input = document.getElementById('pair_code');
@ -85,7 +65,4 @@
window.location.href = "/failure"; window.location.href = "/failure";
}); });
}); });
</script> </script>
</body>
</html>

View File

@ -1,17 +1,9 @@
<html> ---
title: "SUCCESS"
<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 { body {
background-color: #333; background-color: #333;
font-size: 1.2em; font-size: 1.2em;
@ -23,13 +15,8 @@
font-family: arial, sans-serif; font-family: arial, sans-serif;
color: #ddd; color: #ddd;
} }
</style> </style>
</head>
<body> <div class="centered">
<div class="centered">
🎉 SUCCESS 🎉 🎉 SUCCESS 🎉
</div> </div>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
{{ partial "head.html" (dict "title" .Title ) }}
<body>
<div class="container">
{{ .Content }}
</div>
</body>
</html>

View File

@ -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>

1
website/static/css/coloris.min.css vendored Normal file

File diff suppressed because one or more lines are too long

6
website/static/js/coloris.min.js vendored Normal file

File diff suppressed because one or more lines are too long