Skip to content

Commit c519450

Browse files
committed
Telnet now has it's own Menu Page
1 parent 4994a05 commit c519450

File tree

5 files changed

+134
-106
lines changed

5 files changed

+134
-106
lines changed

esp-link/cgi.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,13 @@ int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) { //This is where we can
206206
"{ "
207207
"\"menu\": [ "
208208
"\"Home\", \"/home.html\", "
209-
"\"WiFi Station\", \"/wifi/wifiSta.html\", "
210-
"\"WiFi Soft-AP\", \"/wifi/wifiAp.html\", "
211-
"\"µC Console\", \"/console.html\", "
209+
"\"WiFi Station\", \"/wifi/wifiSta.html\","
210+
"\"WiFi Soft-AP\", \"/wifi/wifiAp.html\","
211+
"\"µC Console\", \"/console.html\","
212212
"\"Services\", \"/services.html\", "
213+
"\"Telnet Bridge\", \"/telnet.html\", "
213214
#ifdef MQTT
214-
"\"REST/MQTT\", \"/mqtt.html\", "
215+
"\"REST/MQTT\", \"/mqtt.html\","
215216
#endif
216217
"\"Debug log\", \"/log.html\","
217218
"\"Upgrade Firmware\", \"/flash.html\","

html/home.html

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -54,95 +54,6 @@ <h1>System overview</h1>
5454
</tbody>
5555
</table>
5656
</div>
57-
<div class="card">
58-
<h1>Telnet Serial-Bridge</h1>
59-
<p style="margin-bottom:0;">There are two ports available for telnet to use by default:
60-
23 &amp; 2323
61-
</p>
62-
<div id="telnet-spinner" class="spinner spinner-small"></div>
63-
<table id="telnet-table" class="pure-table pure-table-horizontal" hidden>
64-
<tbody>
65-
<tr>
66-
<th>
67-
<br>Setting</th>
68-
<th>Port 0</th>
69-
<th>Port 1</th>
70-
</tr>
71-
<tr>
72-
<td>Port</td>
73-
<td>
74-
<div class="click-to-edit telnet-port0">
75-
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
76-
<input class="edit-on" maxlength=5 hidden> </input>
77-
<div class="popup">Click to edit!
78-
<br>Default port: 23</div>
79-
</div>
80-
</td>
81-
<td>
82-
<div class="click-to-edit telnet-port1">
83-
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
84-
<input class="edit-on" maxlength=5 hidden> </input>
85-
<div class="popup">Click to edit!
86-
<br>Default port: 2323</div>
87-
</div>
88-
</td>
89-
</tr>
90-
<tr>
91-
<td>Mode &amp;
92-
<br>Security</td>
93-
<td class="popup-target">
94-
<div class="pure-control-group">
95-
<label for="telnet-port0mode"></label>
96-
<select id="telnet-port0mode">
97-
<option value="" selected disabled></option>
98-
</select>
99-
</div>
100-
</td>
101-
<td class="popup-target">
102-
<div class="pure-control-group">
103-
<label for="telnet-port1mode"></label>
104-
<select id="telnet-port1mode">
105-
<option value="" selected disabled></option>
106-
</select>
107-
</div>
108-
</td>
109-
</tr>
110-
<tr>
111-
<td>Pass</td>
112-
<td class="popup-target">
113-
<div class="pure-control-group">
114-
<label for="telnet-port0pass"></label>
115-
<div class="click-to-edit telnet-port0pass">
116-
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
117-
<input class="edit-on" maxlength=10 hidden> </input>
118-
<div class="popup">Click to edit!
119-
<br>NO PWD MASKING OR ENCRYPTION</div>
120-
</div>
121-
</div>
122-
</td>
123-
<td class="popup-target">
124-
<div class="pure-control-group">
125-
<label for="telnet-port1pass"></label>
126-
<div class="click-to-edit telnet-port1pass">
127-
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
128-
<input class="edit-on" maxlength=10 hidden> </input>
129-
<div class="popup">Click to edit!
130-
<br>NO PWD MASKING OR ENCRYPTION</div>
131-
</div>
132-
</div>
133-
</td>
134-
</tr>
135-
<tr>
136-
<td colspan=3>
137-
<form action="#" id="telnetform" class="pure-form pure-form-aligned form-narrow">
138-
<button id="set-telnet" type="submit" class="pure-button button-primary">Change!</button>
139-
</form>
140-
</td>
141-
</tr>
142-
</tbody>
143-
144-
</table>
145-
</div>
14657
<div class="card">
14758
<h1>Info</h1>
14859
<p style="margin-bottom:0;">The JeeLabs esp-link firmware bridges the ESP8266 serial
@@ -286,7 +197,6 @@ <h1>System details</h1>
286197
</tr>
287198
</table>
288199
</tbody>
289-
290200
</div>
291201
</div>
292202
</div>
@@ -299,21 +209,10 @@ <h1>System details</h1>
299209
onLoad(function () {
300210
makeAjaxInput("system", "description");
301211
makeAjaxInput("system", "name");
302-
makeAjaxInput("telnet", "port0");
303-
makeAjaxInput("telnet", "port1");
304-
makeAjaxInput("telnet", "port0pass");
305-
makeAjaxInput("telnet", "port1pass");
306-
//makeAjaxInput("telnet", "port0mode");
307-
//populateAjaxSelect("telnet", "port0mode", "open,disabled,secure", "secure");
308-
//populateAjaxSelect("telnet", "port1mode", "open,disabled,secure", "open");
309-
//ajaxSelectInit(); //This should replace the above two statements
310212
fetchPins();
311213
getWifiInfo();
312214
getSystemInfo();
313-
getTelnetInfo();
314-
getAjaxInfo("telnet");
315215
bnd($("#pinform"), "submit", setPins);
316-
bnd($("#telnetform"), "submit", setTelnet);
317216
});
318217

319218
</script>

html/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,9 @@ pre.console a {
528528
transform: rotate(359deg);
529529
}
530530
}
531+
532+
#telnet-table span {
533+
display:block;
534+
width:auto;
535+
text-align: center;
536+
}

html/telnet

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"port0": "23",
33
"port1": "56555",
44
"port0mode": "secure",
5-
"port1mode": "disabled"
5+
"port1mode": "disabled",
6+
"port0pass": "12345000",
7+
"port1pass": "12345111"
68
}

html/telnet.html

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<!-- delete above, testing only -->
2+
<div id="main">
3+
<div class="header">
4+
<h1 style="margin-top:0">Telnet &amp; Serial Bridge Config</h1>
5+
</div>
6+
<div class="content">
7+
<div class="pure-g">
8+
<div class="pure-u-1">
9+
<div class="card" style="max-width: 450px;">
10+
<p>There are two ports available for use by default: <b>23</b> &amp; <b>2323</b>
11+
</p>
12+
<div id="telnet-spinner" class="spinner spinner-small"></div>
13+
<table id="telnet-table" class="pure-table pure-table-horizontal" hidden style="width: 100%;">
14+
<tbody>
15+
<tr>
16+
<th>
17+
<br>Setting</th>
18+
<th>Port 0</th>
19+
<th>Port 1</th>
20+
</tr>
21+
<tr>
22+
<td>Port</td>
23+
<td>
24+
<div class="click-to-edit telnet-port0">
25+
<span class="edit-off"></span>
26+
<input class="edit-on" maxlength="5" hidden> </input>
27+
<div class="popup">Click to edit!
28+
<br>Default port: 23</div>
29+
</div>
30+
</td>
31+
<td>
32+
<div class="click-to-edit telnet-port1">
33+
<span class="edit-off"></span>
34+
<input class="edit-on" maxlength="5" hidden> </input>
35+
<div class="popup">Click to edit!
36+
<br>Default port: 2323</div>
37+
</div>
38+
</td>
39+
</tr>
40+
<tr>
41+
<td>Mode &amp;
42+
<br>Security</td>
43+
<td class="popup-target">
44+
<div class="pure-control-group">
45+
<label for="telnet-port0mode"></label>
46+
<select id="telnet-port0mode">
47+
<option value="" selected disabled></option>
48+
</select>
49+
</div>
50+
</td>
51+
<td class="popup-target">
52+
<div class="pure-control-group">
53+
<label for="telnet-port1mode"></label>
54+
<select id="telnet-port1mode">
55+
<option value="" selected disabled></option>
56+
</select>
57+
</div>
58+
</td>
59+
</tr>
60+
<tr>
61+
<td>Pass</td>
62+
<td class="popup-target">
63+
<div class="pure-control-group">
64+
<label for="telnet-port0pass"></label>
65+
<div class="click-to-edit telnet-port0pass">
66+
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
67+
<input class="edit-on" maxlength="10" hidden> </input>
68+
<div class="popup">Click to edit!
69+
<br>NO PWD MASKING OR ENCRYPTION</div>
70+
</div>
71+
</div>
72+
</td>
73+
<td class="popup-target">
74+
<div class="pure-control-group">
75+
<label for="telnet-port1pass"></label>
76+
<div class="click-to-edit telnet-port1pass">
77+
<span class="edit-off" style="display:block; width:auto; text-align: center;"></span>
78+
<input class="edit-on" maxlength="10" hidden> </input>
79+
<div class="popup">Click to edit!
80+
<br>NO PWD MASKING OR ENCRYPTION</div>
81+
</div>
82+
</div>
83+
</td>
84+
</tr>
85+
<tr>
86+
<td colspan="3">
87+
<form action="#" id="telnetform" class="pure-form pure-form-aligned">
88+
<button id="set-telnet" type="submit" class="pure-button button-primary">Change!</button>
89+
</form>
90+
</td>
91+
</tr>
92+
</tbody>
93+
</table>
94+
</div>
95+
</div>
96+
</div>
97+
<div class="pure-g">
98+
</div>
99+
</div>
100+
</div>
101+
</div>
102+
<script type="text/javascript">
103+
onLoad(function () {
104+
makeAjaxInput("telnet", "port0");
105+
makeAjaxInput("telnet", "port1");
106+
makeAjaxInput("telnet", "port0pass");
107+
makeAjaxInput("telnet", "port1pass");
108+
//makeAjaxInput("telnet", "port0mode");
109+
//populateAjaxSelect("telnet", "port0mode", "open,disabled,secure", "secure");
110+
//populateAjaxSelect("telnet", "port1mode", "open,disabled,secure", "open");
111+
//ajaxSelectInit(); //This should replace the above two statements
112+
getTelnetInfo();
113+
getAjaxInfo("telnet");
114+
bnd($("#telnetform"), "submit", setTelnet);
115+
});
116+
117+
</script>
118+
</body>
119+
120+
</html>

0 commit comments

Comments
 (0)