-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
318 lines (275 loc) · 8.77 KB
/
index.html
File metadata and controls
318 lines (275 loc) · 8.77 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!DOCTYPE html>
<html>
<head>
<title>DroniX Web Manager</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.0b2.min.css" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.0b2.min.js"></script>
<script>
<!-- I know: global vars are evil. Gotta be improved -->
var reload;
var oldPassword;
</script>
</head>
<body>
<script>
$(document).ready(function() {
/* Loaded on index.html */
reload = setInterval(function(){
$.get("cgi-bin/sysinfo.cgi", function(data){
$("#system-output").html(data);}
)}, 1000);
$.get("cgi-bin/getOldSSHpassword.cgi", function(data){
oldPassword = data;
});
$("#modules-button").click(function(){
clearInterval(reload);
$("#cpu-output").text("");
$("#system-monitoring-output").text();
});
/* CPU stats block */
$("#cpu-stats-button").click(function() {
clearInterval(reload);
reload = setInterval(function(){
$.get("cgi-bin/cpu-stats.cgi", function(data){
$("#cpu-output").text(data);}
)}, 1000);
});
$("#cpu-button").click(function() {
clearInterval(reload);
reload = setInterval(function(){
$.get("cgi-bin/cpu.cgi", function(data){
$("#cpu-output").text(data);}
)}, 1000);
});
$(".reset-button").click(function() {
clearInterval(reload);
});
/* CPU stats block - END */
/* SSH toggle block */
$("#ssh-on").click(function() {
$.get("cgi-bin/ssh-on.cgi", function(data){
alert(data);
});
});
$("#ssh-off").click(function() {
$.get("cgi-bin/ssh-off.cgi", function(data){
alert(data);
});
});
/* SSH toggle block - END */
/* System Monitoring block */
$("#partitions-button").click(function() {
clearInterval(reload);
$.get("cgi-bin/diskUsage.cgi", function(data){
$("#system-monitoring-output").text(data);
});
});
$("#ram-button").click(function() {
clearInterval(reload);
reload = setInterval(function(){
$.get("cgi-bin/ram.cgi", function(data){
$("#system-monitoring-output").text(data);}
)}, 1000);
});
$("#battery-button").click(function() {
clearInterval(reload);
reload = setInterval(function(){
$.get("cgi-bin/battery.cgi", function(data){
$("#system-monitoring-output").text(data);}
)}, 1000);
});
$("#dmesg-button").click(function() {
clearInterval(reload);
reload = setInterval(function(){
$.get("cgi-bin/dmesg.cgi", function(data){
$("#system-monitoring-output").text(data);}
)}, 1000);
});
/* System Monitoring block - END */
function checkOldPassowrd() {
if ( $.trim(oldPassword) == $.trim($('#old-password').val()) ) {
return true;
}
else {
alert('Password does not match');
return false;
}
}
$("#password-reset-button").click(function() {
$.get("cgi-bin/ssh-password-change.cgi", { passwd: $.trim("android") }, function(data){
alert(data + "\n" + "Default password is: android");
})
});
$("#password-change-button").click(function() {
if (checkOldPassowrd()) {
$.get("cgi-bin/ssh-password-change.cgi", { passwd: $('#new-password').val() }, function(data){
alert(data);
})
}
});
});
</script>
<div data-role="page" id="index" data-title="DroniX Web Manager">
<div data-role="header">
<h1>DroniX</h1>
<a id="modules-button" href="#modules" data-icon="gear"
class="ui-btn-right" data-transition="slideup">Modules</a>
</div><!-- /header -->
<div data-role="content">
<h3>DroniX Web Manager</h3>
<h3>System info</h3>
<div id="system-output"></div>
</div><!-- /content -->
<div data-role="footer">
<a href="#about" data-role="button" data-icon="info">About</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="modules" data-title="Modules">
<script>
clearInterval(reload);
</script>
<div data-role="header">
<h1>DroniX</h1>
</div><!-- /header -->
<div data-role="content">
<h2>Modules</h2>
<div data-role="controlgroup">
<a href="#" data-role="button" OnClick="alert('Currently unavailable')">Upload to SDCARD</a>
<a href="#ssh-toggle" data-role="button">SSH Toggle</a>
<a href="#ssh-password-change" data-role="button">Change SSH Passwod</a>
<a href="#cpu" data-role="button">CPU Monitor</a>
<a href="#system-monitoring" data-role="button">System Monitoring</a>
<a href="#" data-role="button" OnClick="alert('Currently unavailable')">Theme Changer</a>
</div>
</div><!-- /content -->
<div data-role="footer">
<a href="#index" data-role="button" data-icon="home">Home</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="about" data-title="About">
<div data-role="header">
<h1>DroniX</h1>
</div><!-- /header -->
<div data-role="content">
<h3>About</h3>
<p>Based on a work by Stefano Viola, DroniX Web Manager has
been refactored by Ivan Morgillo. Current version is based
on jQuery.mobile to improve user experience.</p>
<p>Contact us</p>
<ul id="contacts">
<li><a href="mailto:stefano.viola@dronix.org">Stefano Viola</a></li>
<li><a href="mailto:ivan.morgillo@dronix.org">Ivan Morgillo</a></li>
</ul>
</div><!-- /content -->
<div data-role="footer">
<a href="#index" data-role="button" data-icon="arrow-l" data-rel="back">Back</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="cpu" data-title="CPU infos">
<div data-role="header">
<h1>DroniX</h1>
</div><!-- /header -->
<div data-role="content">
<table border="0">
<tr>
<td><input type="button" id="cpu-button" name="memory" value="CPU"></td>
<td>Real Time CPU Monitoring</td>
</tr>
<tr>
<td><input type="button" id="cpu-stats-button" name="memory" value="CPU STATS"></td>
<td>CPU Statistic</td>
</tr>
<tr>
<td><input type="button" class="reset-button" name="memory" value="Reset">
</td>
<td>Reset All Monitor</td>
</tr>
</table>
<pre>
<span id="cpu-output"></span>
</pre>
</div><!-- /content -->
<div data-role="footer">
<a href="#modules" data-role="button" data-icon="arrow-l">Back</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="ssh-toggle" data-title="SSH Toggle">
<div data-role="header">
<h1>DroniX</h1>
</div><!-- /header -->
<div data-role="content">
<table border="0">
<tr>
<tr>
<td><input id="ssh-on" type="button" name="memory" value="SSH ON"></td>
</tr>
<tr>
<td><input id="ssh-off" type="button" name="memory" value="SSH OFF"></td>
</tr>
</tr>
</table>
</div><!-- /content -->
<div data-role="footer">
<a href="#modules" data-role="button" data-icon="arrow-l" data-rel="back">Back</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="system-monitoring" data-title="System Monitoring">
<div data-role="header">
<h1>System Monitoring</h1>
</div><!-- /header -->
<div data-role="content">
<table border="0"><tr>
<tr>
<td><input type="button" id="partitions-button" name="memory" value="Partitions"></td>
<td>Monitoring partition space</td>
</tr>
<tr>
<td><input type="button" id="ram-button" name="memory" value="RAM"></td>
<td>Monitoring Linux system RAM</td>
</tr>
<tr>
<td><input type="button" id="battery-button" name="memory" value="Battery"></td>
<td>Monitoring Battery value (Ideos only)</td>
</tr>
<tr>
<td><input type="button" id="dmesg-button" name="memory" value="Log"></td>
<td>Monitoring System Log</td>
</tr>
<tr>
<td><input type="button" class="reset-button" name="memory" value="Reset"></td>
<td>Reset All Monitor</td>
</tr>
</table>
<h3>Output:</h3>
<pre>
<div style="font-size: x-small;" id="system-monitoring-output"></div>
</pre>
</div><!-- /content -->
<div data-role="footer">
<a href="#modules" data-role="button" data-icon="arrow-l" data-rel="back">Back</a>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="page" id="ssh-password-change" data-title="SSH Password Change">
<div data-role="header">
<h1>DroniX</h1>
</div><!-- /header -->
<div data-role="content">
<p>Old password:
<input id="old-password" type="text" size="25" value="">
</p>
<p>
New password: <input id="new-password" name="passwd" type="text">
<a href="#" id="password-change-button" data-role="button" data-icon="check">Change!</a>
</p>
<p>
<a href="#" id="password-reset-button" data-role="button" data-icon="delete">Reset!</a>
</p>
</div><!-- /content -->
<div data-role="footer">
<a href="#modules" data-role="button" data-icon="arrow-l" data-rel="back">Back</a>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>