mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2024-11-21 21:44:21 +00:00
update
This commit is contained in:
parent
163c8c1876
commit
5657871f02
23 changed files with 168 additions and 28 deletions
|
@ -1,10 +0,0 @@
|
|||
~inc:grfx1.inc~
|
||||
<td width="50%">ADC: <span id="xdata" style="font-weight:bold">?</span></td>
|
||||
<script type="text/javascript">
|
||||
var xmlfile = 'adc.xml';
|
||||
var xmin = 24;
|
||||
var xmax = 1000;
|
||||
var millisPerPixel = 50;
|
||||
var millisPerLine = 500;
|
||||
</script>
|
||||
~inc:grfx2.inc~
|
|
@ -5,16 +5,16 @@
|
|||
<a href="/websock.htm">WebSocket</a>
|
||||
<a href="/protect/wifi.htm">WiFi settings</a>
|
||||
<a href="/protect/scan.htm">WiFi Scan</a>
|
||||
<a href="/protect/upload.htm">WebFS Upload</a>
|
||||
<a href="/protect3/upload.htm">WebFS Upload</a>
|
||||
<a href="/protect/setup.htm">System Setup</a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="/protect/gpio.htm">GPIO</a>
|
||||
<a href="/protect/hexdmpb.htm">HexDump Bytes</a>
|
||||
<a href="/protect/hexdmpd.htm">HexDump DWord</a>
|
||||
<a href="/protect/tstfuncs.htm">Download Bin</a>
|
||||
<a href="/protect/dsleep.htm">Deep Sleep</a>
|
||||
<a href="/protect/debug.htm">Debug and Test</a>
|
||||
<a href="/protect2/hexdmpb.htm">HexDump Bytes</a>
|
||||
<a href="/protect2/hexdmpd.htm">HexDump DWord</a>
|
||||
<a href="/protect2/tstfuncs.htm">Download Bin</a>
|
||||
<a href="/protect2/dsleep.htm">Deep Sleep</a>
|
||||
<a href="/protect2/debug.htm">Debug and Test</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<td><input type="button" onClick="NewCookie(+256)" value="+0x100" class="button"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<iframe id='pmem' name='pmem' src="/protect/hexdmpb.txt" border="0" width="620" height="270"></iframe>
|
||||
<iframe id='pmem' name='pmem' src="/protect2/hexdmpb.txt" border="0" width="620" height="270"></iframe>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Write addr, value:</td>
|
||||
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
Protected area: 0x9A000000..0xFFFFFFFF !<br>
|
||||
<a href='/protect/hexdmpb.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
<a href='/protect2/hexdmpb.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
</div>
|
||||
<script src="cookie.js"></script>
|
||||
</body></html>
|
|
@ -17,7 +17,7 @@
|
|||
<td><input type=button onClick="NewCookie(+256)" value="+0x100" class="button"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<iframe id='pmem' name='pmem' src="/protect/hexdmpd.txt" border="0" width="620" height="270"></iframe>
|
||||
<iframe id='pmem' name='pmem' src="/protect2/hexdmpd.txt" border="0" width="620" height="270"></iframe>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Write addr, value:</td>
|
||||
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
Protected area: 0x9A000000..0xFFFFFFFF !<br>
|
||||
<a href='/protect/hexdmpd.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
<a href='/protect2/hexdmpd.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
</div>
|
||||
<script src="cookie.js"></script>
|
||||
</body></html>
|
97
WEBFiles/protect2/setup.htm
Normal file
97
WEBFiles/protect2/setup.htm
Normal file
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>RTL871X Setup</title>
|
||||
<link rel="stylesheet" href="../style.css">
|
||||
<script src="/scripts.js"></script>
|
||||
<script src="/site.js"></script>
|
||||
</head><body>
|
||||
~inc:menu.inc~
|
||||
<div class="content">
|
||||
<h2 class="title">System Setup</h2>
|
||||
<form method="post" action="">
|
||||
<table class="form">
|
||||
<tr>
|
||||
<td class="label">WEB (HTTP) port:</td>
|
||||
<td><input title='4..65535, 0 - close' name='cfg_web_port' maxlength='5' value='~cfg_web_port~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">WEB recved timeout:</td>
|
||||
<td><input title='1...65535 sec, 0 - not limited' name='cfg_web_twrec' maxlength='5' value='~cfg_web_twrec~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">WEB close timeout:</td>
|
||||
<td><input title='1...65535 sec, 0 - not limited' name='cfg_web_twcls' maxlength='5' value='~cfg_web_twcls~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">PowerSave Enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_sleep' value='0'>
|
||||
<input title='If On - LogUART input disable' type='checkbox' name='cfg_sleep' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">LogUART Printf() enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_debug' value='0'>
|
||||
<input title='rtl_printf enable. If Off - High speed upload (>1Mbytes/s).' type='checkbox' name='cfg_debug' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Web pcb close enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_web_twd' value='0'>
|
||||
<input title='(Proxy) Close web connection and deletes TIME_WAIT pcb' type='checkbox' name='cfg_web_twd' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Checking pin WiFi cfg reset:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_pinclr' value='0'>
|
||||
<input title='Checking reset configuration level on GPIO3 at startup (25 ms)' type='checkbox' name='cfg_pinclr' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">NetBIOS enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_netbios' value='0'>
|
||||
<input title='NetBIOS AP name = "a~wifi_ap_ssid~", Station = "s~wifi_ap_ssid~"' type='checkbox' name='cfg_netbios' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">SNTP enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_sntp' value='0'>
|
||||
<input title='SNTP: pool.ntp.org' type='checkbox' name='cfg_sntp' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Captive Portal AP:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_cdns' value='0'>
|
||||
<input type='checkbox' name='cfg_cdns' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="center">
|
||||
<input type='hidden' name='uart_save' value='2'>
|
||||
<input type='hidden' name='cfg_save' value='1'>
|
||||
<input type='submit' value='Set Config' class="button">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
~inc:footer.inc~
|
||||
<script type="text/javascript">
|
||||
var cfg = {
|
||||
cfg_sleep:"~cfg_sleep~",
|
||||
cfg_debug:"~cfg_debug~",
|
||||
cfg_web_twd:"~cfg_web_twd~",
|
||||
cfg_pinclr:"~cfg_pinclr~",
|
||||
cfg_netbios:"~cfg_netbios~",
|
||||
cfg_sntp:"~cfg_sntp~",
|
||||
cfg_cdns:"~cfg_cdns~",
|
||||
cfg_mdb_reop:"~cfg_mdb_reop~"
|
||||
}
|
||||
setFormValues(document.forms[0], cfg);
|
||||
</script>
|
||||
</body></html>
|
|
@ -17,7 +17,7 @@
|
|||
Curent Disk has ~wfs_files~ files, Disk Size: ~wfs_size~ bytes.<br>
|
||||
Disk Addres: ~wfs_addr~, Max Disk Size: ~wfs_max_size~ bytes, Max 250 files.<br><br>
|
||||
Flash ID: ~sys_fid~, Size: ~sys_fsize~ bytes.<br>
|
||||
<a href='/protect/fullflash.bin'>Download fullflash.bin</a><br><br>
|
||||
<a href='/protect2/fullflash.bin'>Download fullflash.bin</a><br><br>
|
||||
</p></div>
|
||||
~inc:footer.inc~
|
||||
</body></html>
|
|
@ -1,7 +1,7 @@
|
|||
#consoleLog {
|
||||
overflow-y: scroll;
|
||||
width: 480px;
|
||||
height: 800px;
|
||||
height: 200px;
|
||||
border: solid 1px #aaaaaa;
|
||||
background-color: #ffffff;
|
||||
padding-left: 5px; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define call1
|
||||
set $ImageSize = 0xF6E0
|
||||
set $ImageSize = 0x10340
|
||||
set $ImageAddr = 0x0D0000
|
||||
end
|
||||
define call2
|
||||
|
|
|
@ -101,8 +101,8 @@ typedef struct
|
|||
WS_FRSTAT ws; // параметры websoc
|
||||
#endif
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
uint8 auth_level; // Уровень авторизации по паролю
|
||||
uint8 auth_realm; // Требуемый уровень авторизации (минимальный уровень)
|
||||
uint8 auth_level; // Уровень авторизации пользователя по паролю WEB_AUTH_LEVEL_TYPE
|
||||
uint8 auth_realm; // Требуемый уровень авторизации (минимальный уровень) WEB_AUTH_LEVEL_TYPE
|
||||
#endif
|
||||
uint8 fileType; // File type to return with Content-Type (if SCB_FCALBACK)
|
||||
} WEB_SRV_CONN;
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
#include "netbios/netbios.h"
|
||||
#include "sntp/sntp.h"
|
||||
#include "user/sys_cfg.h"
|
||||
#include "wifi_api.h"
|
||||
#include "web/web_srv.h"
|
||||
#include "webfs/webfs.h"
|
||||
|
||||
struct SystemCfg syscfg = {
|
||||
.cfg.w = SYS_CFG_DEBUG_ENA
|
||||
| SYS_CFG_PIN_CLR_ENA
|
||||
#if defined(USE_NETBIOS) && USE_NETBIOS
|
||||
| SYS_CFG_NETBIOS_ENA
|
||||
#endif
|
||||
|
@ -59,7 +61,11 @@ void sys_write_cfg(void)
|
|||
|
||||
void user_init_thrd(void) {
|
||||
|
||||
flash_read_cfg(&syscfg, FEEP_ID_SYS_CFG, sizeof(syscfg));
|
||||
if(syscfg.cfg.b.pin_clear_cfg_enable
|
||||
&& 0) { // user_test_clear_pin()
|
||||
wifi_cfg.load_flg = 0;
|
||||
}
|
||||
else flash_read_cfg(&syscfg, FEEP_ID_SYS_CFG, sizeof(syscfg));
|
||||
|
||||
if(!syscfg.cfg.b.debug_print_enable) print_off = 1;
|
||||
|
||||
|
|
|
@ -358,15 +358,24 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
#endif
|
||||
ifcmp("start") tcp_puts("0x%08x", web_conn->udata_start);
|
||||
else ifcmp("stop") tcp_puts("0x%08x", web_conn->udata_stop);
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
else ifcmp("realm") tcp_puts("%u", web_conn->auth_realm);
|
||||
else ifcmp("auth") tcp_puts("%u", web_conn->auth_level);
|
||||
#endif
|
||||
else ifcmp("xml_") {
|
||||
cstr+=4;
|
||||
ifcmp("scan") web_wscan_xml(ts_conn);
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) return;
|
||||
#endif
|
||||
else {
|
||||
web_conn->udata_start&=~3;
|
||||
ifcmp("ram") tcp_puts("0x%08x", *((uint32*)web_conn->udata_start));
|
||||
else tcp_put('?');
|
||||
web_conn->udata_start += 4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else ifcmp("sys_") {
|
||||
cstr+=4;
|
||||
|
@ -394,7 +403,12 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
else ifcmp("clkcpu") tcp_puts("%u", HalGetCpuClk());
|
||||
else ifcmp("debug") tcp_put('1' - (print_off & 1)); // rtl_print on/off
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("restart") web_conn->web_disc_cb = (web_func_disc_cb)sys_reset;
|
||||
else ifcmp("restart") {
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) return;
|
||||
#endif
|
||||
web_conn->web_disc_cb = (web_func_disc_cb)sys_reset;
|
||||
}
|
||||
else ifcmp("ram") tcp_puts("0x%08x", *((uint32 *)(ahextoul(cstr+3)&(~3))));
|
||||
else ifcmp("rdec") tcp_puts("%d", *((uint32 *)(ahextoul(cstr+4)&(~3))));
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
|
@ -519,6 +533,9 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
#endif
|
||||
}
|
||||
else ifcmp("bin_") {
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) return;
|
||||
#endif
|
||||
cstr+=4;
|
||||
ifcmp("flash") {
|
||||
cstr+=5;
|
||||
|
@ -553,6 +570,9 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
}
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("hexdmp") {
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) return;
|
||||
#endif
|
||||
if(cstr[6]=='d') ts_conn->flag.user_option1 = 1;
|
||||
else ts_conn->flag.user_option1 = 0;
|
||||
web_hexdump(ts_conn);
|
||||
|
|
|
@ -83,6 +83,14 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
#endif
|
||||
ifcmp("start") web_conn->udata_start = val;
|
||||
else ifcmp("stop") web_conn->udata_stop = val;
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
else ifcmp("user") web_conn->auth_level = UserAuthorization(pvar, strlen(pvar));
|
||||
else if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) {
|
||||
if(!web_conn->auth_realm) web_conn->auth_realm = WEB_AUTH_LEVEL_USER;
|
||||
SetSCB(SCB_AUTH);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("sys_") {
|
||||
cstr+=4;
|
||||
|
@ -236,6 +244,12 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
os_memcpy(lwip_host_name[1], pvar, len);
|
||||
}
|
||||
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
||||
if(wifi_cfg.save_flg & BID_AP_HOSTNAME) {
|
||||
WEB_SRV_QFNK x;
|
||||
x.fnk = write_wifi_cfg;
|
||||
x.param = BID_AP_HOSTNAME;
|
||||
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else ifcmp("dhcp") wifi_ap_dhcp.mode = val;
|
||||
|
@ -287,6 +301,12 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
os_memcpy(lwip_host_name[0], pvar, len);
|
||||
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
||||
}
|
||||
if(wifi_cfg.save_flg & BID_ST_HOSTNAME) {
|
||||
WEB_SRV_QFNK x;
|
||||
x.fnk = write_wifi_cfg;
|
||||
x.param = BID_ST_HOSTNAME;
|
||||
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else ifcmp("dhcp") wifi_st_dhcp.mode = val;
|
||||
|
|
|
@ -442,7 +442,10 @@ web_parse_fname(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn)
|
|||
if(pcmp != NULL) {
|
||||
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *)ts_conn->linkd;
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
web_conn->auth_realm = WEB_AUTH_LEVEL_USER;
|
||||
pcmp += sizeof(ProtectedFilesName) - 1;
|
||||
web_conn->auth_realm = atoi(pcmp) + 1;
|
||||
printf("[%s] ar%d ", pcmp, web_conn->auth_realm);
|
||||
// web_conn->auth_realm = WEB_AUTH_LEVEL_USER;
|
||||
#endif
|
||||
SetSCB(SCB_AUTH);
|
||||
}
|
||||
|
@ -846,6 +849,10 @@ LOCAL bool ICACHE_FLASH_ATTR webserver_open_file(HTTP_CONN *CurHTTP, TCP_SERV_CO
|
|||
if(rom_xstrcmp(pstr, web_cgi_fname)) {
|
||||
web_inc_fp(web_conn, WEBFS_WEBCGI_HANDLE);
|
||||
web_conn->content_len = sizeHTTPdefault;
|
||||
#if USE_WEB_AUTH_LEVEL
|
||||
// web_conn->auth_realm = WEB_AUTH_LEVEL_USER;
|
||||
// SetSCB(SCB_AUTH);
|
||||
#endif
|
||||
CurHTTP->fileType = HTTP_HTML;
|
||||
#if DEBUGSOO > 1
|
||||
os_printf("of%d[%s] ", web_conn->webfile, CurHTTP->pFilename);
|
||||
|
|
Loading…
Reference in a new issue