-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.html
123 lines (112 loc) · 2.98 KB
/
config.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<meta charset='utf-8'>
<meta content='ie=edge' http-equiv='x-ua-compatible'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<title>Setting up your hub</title>
<style>
* {
-moz-box-sizing: border-box;
box-sizing: border-box
}
body {
font: 16px Helvetica;
background: #36404a
}
section {
width: 275px;
background: #ecf0f1;
padding: 0 30px 30px 30px;
margin: 60px auto;
text-align: center;
border-radius: 5px
}
span {
display: block;
position: relative;
margin: 0 auto;
top: -40px;
height: 80px;
width: 80px;
font-size: 70px;
border-radius: 50%;
background-color: #5fbeaa;
color: #fff;
box-shadow: 1px 1px 2px rgba(0, 0, 0, .3)
}
h1 {
font-size: 24px;
font-weight: 100;
margin-bottom: 30px;
margin-top: -10px
}
input {
width: 100%;
background: #bdc3c7;
border: none;
height: 30px;
margin-bottom: 15px;
border-radius: 5px;
text-align: center;
font-size: 14px;
color: #7f8c8d
}
input:focus {
outline: 0
}
button {
width: 100%;
height: 30px;
border: none;
background: #5fbeaa;
color: #ecf0f1;
font-weight: 100;
margin-bottom: 15px;
border-radius: 5px;
transition: all ease-in-out .2s;
border-bottom: 3px solid #56a695
}
button:focus {
outline: 0
}
button:hover {
background: #56a695
}
</style>
<body>
<script>
function genv(name){
return document.getElementsByName(name)[0].value;
}
function setup() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
alert(xhttp.responseText);
}
};
data = {
'ssid': genv("ssid"),
'password': genv('password'),
'token': genv('token'),
'host': genv('host'),
'port': genv('port')
};
xhr.open('POST', '/set');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(data));
}
</script>
<section>
<span>+</span>
<h1>Hub Setup</h1>
<form id='hubSetup' onsubmit="setup(); return false;">
<input name='ssid' placeholder='SSID' value='%s'>
<input name='password' placeholder='Password' type='password' value='%s'>
<input name='token' placeholder='Token' value='%s'>
<input name='host' placeholder='Host' value='%s'>
<input name='port' placeholder='Port' value='%d'>
<button type='submit'>Setup</button>
</form>
</section>
</body>
</html>