blob: f2f3d9fe1aa2a8effe879d27ef1aacf11fea4961 (
plain) (
blame)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
const char SETTINGS_page[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{{NAME}}</title>
{{BOOTSTRAPLINK}}
<link rel="stylesheet" href="./style.css">
</head>
<body>
<nav class="navbar navbar-dark bg-dark">
<a id="homePageAddr" class="navbar-brand" href="/">IOT Device</a>
<a id="settingsPageAddr" class="navbar-toggler navbar-toggler-right" href="/settings">
⚙
</a>
</nav>
<div class="container-fluid pt-3 pb-3">
<div id="success-box" class="alert alert-success" role="alert">{{SUCCESSMSG}}</div>
<div class="alert alert-danger" role="alert">
<b>Warning:</b> The password-protection does not work yet! Make sure to donยดt expose the device.
</div>
<div class="card card-inverse bg-dark text-white mt-3">
<div class="card-body">
<div class="card-title">
<h3>Password</h3>
</div>
<div class="container">
<form>
<h5 class="small text-muted">To change any settings, you must enter the correct password"</h5>
<div class="form-group row">
<div class="col-sm-12">
<input type="password" class="form-control" id="" placeholder="Device password" readonly>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="card card-inverse bg-dark text-white mt-3">
<div class="card-body">
<div class="card-title">
<h3>Settings</h3>
</div>
<div class="container">
<form method="post">
<input type="hidden" name="type" value="settings">
<h5 class="small text-muted">Device settings:</h5>
<div class="form-group row">
<label for="lblDeviceName" class="col-sm-2 col-form-label">Device name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="txtDeviceName" id="txtDeviceName" placeholder="Ex. Rooflight">
</div>
</div>
<div class="form-group row">
<label for="lblDeviceLocation" class="col-sm-2 col-form-label">Location</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="txtDeviceLocation" id="txtDeviceLocation" placeholder="Ex. Bathroom">
</div>
</div>
<h5 class="small text-muted">Wifi settings:</h5>
<div class="form-group row">
<label for="lblSSID" class="col-sm-2 col-form-label">SSID</label>
<div class="col-sm-10">
<input type="name" class="form-control" name="txtSSID" id="txtSSID" placeholder="Name of router">
</div>
</div>
<div class="form-group row">
<label for="lblPassword" class="col-sm-2 col-form-label">Pasword</label>
<div class="col-sm-10">
<input type="name" class="form-control" name="txtPassword" id="txtPassword" placeholder="Passphrase (If open, write nothing)">
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary">Save</button>
<br /><span class="small text-muted"> <b> Note:</b> The device will reboot and turn of any connected appliances when you save the settings.</span>
<br /><span class="small text-muted"> <b> Note:</b> Empty or unchanged fields will not be updated.</span>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="card card-inverse bg-dark text-white mt-3">
<div class="card-body">
<div class="card-title">
<h3>Version & OTA</h3>
</div>
<div class="container">
<form>
<h5>Device type: <b>clapSensor</b></h5>
<h5>Current version: <b>1.0.0</b></h5>
<hr />
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label">Update file:</label>
<div class="col-sm-10">
<input type="file" class="form-control-file" id="exampleFormControlFile1">
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-danger">Flash new version</button>
<br /><span class="small text-muted"> <b> Note:</b> The device will reboot and turn of any connected appliances when you flash a new version.</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="/script.js" charset="utf-8"></script>
<script type="text/javascript">
fixNoNetwork();
var successAlert = document.getElementById('success-box');
updatePlaceholder("txtDeviceName", "{{DEVICENAME}}");
updatePlaceholder("txtDeviceLocation", "{{DEVICELOCATION}}");;
if (successAlert.innerHTML.length < 1) {
successAlert.style.display = "none";
}
function updatePlaceholder(elemId, textToInsert) {
var field = document.getElementById(elemId);
if (textToInsert != "") { field.placeholder = "Curr; " + textToInsert }
}
</script>
</body>
</html>
)=====";
|