Skip to content

Commit 02d5f55

Browse files
committed
Fix Reveal password control position is incorrect
Fix successful authentication after failure show as failed Add handlers list supported by WebUI Fix typo for DISCONNECT on test servers Change document title if authentication failed from error to authentication required Bump version
1 parent 03ced55 commit 02d5f55

File tree

18 files changed

+204
-20
lines changed

18 files changed

+204
-20
lines changed

Memo/Handlers.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Web Handlers
2+
3+
### /
4+
5+
root is the default handler where all files will be served, if no file is defined, it looks for index.html or index.html.gz (compressed)
6+
if you call specific file, it will look for the filename and filename.gz (compressed)
7+
if no file is defined and there is not index.html(.gz) it will display embedded page
8+
another way to show the embedded page is /?forcefallback=yes
9+
10+
### /sd/
11+
12+
it will serve any file from SD card if there is one, it is only a wrapper to read SD card, no upload
13+
14+
### /files
15+
16+
this handler handle all commands for FS, including upload on FS.
17+
possible options/arguments are:
18+
19+
- `quiet=yes` can be used when you don't want list files but just upload them
20+
- `path=...` define the path to the file
21+
- `action=...` define the action to execute which can be:
22+
- delete
23+
delete the file defined by `filename=...` it will also use `path=...` to do full path
24+
- deletedir
25+
delete the directory defined by `filename=...` it will also use `path=...` to do full path
26+
- createdir
27+
create the directory defined by `filename=...` it will also use `path=...` to do full path
28+
- `createPath=yes` when doing upload and the path do not exists, it will create it, POST only
29+
- `<filename>S=...` give the size of uploaded file with <filename> name, need to be set before file is set in upload, POST only
30+
31+
the output is a json file:
32+
33+
```
34+
{
35+
"files":[ //the files list
36+
{
37+
"name":"index.html.gz", //the name of the file
38+
"size":"83.46 KB", //the formated size of the file
39+
"time":"2022-09-04 11:56:05" //the time when the file was modified last time, this one is optional and depend on (FILESYSTEM_TIMESTAMP_FEATURE)
40+
},
41+
{
42+
"name":"subdir", //the name of the file / directory
43+
"size":"-1", //the size is -1 because it is a directory
44+
"time":"" //no time for directories optional as depend on (FILESYSTEM_TIMESTAMP_FEATURE)
45+
}
46+
],
47+
"path":"/", //current path
48+
"occupation":"52", //% of occupation
49+
"status":"subdir created", //status
50+
"total":"192.00 KB", //Formated total space of Filesystem
51+
"used":"100.00 KB" //Formated used space of Filesystem
52+
}
53+
```
54+
55+
### /sdfiles
56+
57+
this handler handle all commands for SD, including upload on SD (only shared and direct SD)
58+
this handler handle all commands for FS, including upload on FS.
59+
possible options/arguments are:
60+
61+
- `quiet=yes` can be used when you don't want list files but just upload them
62+
- `path=...` define the path to the file
63+
- `action=...` define the action to execute which can be:
64+
- list
65+
Will refresh the stats of the files - delete
66+
delete the file defined by `filename=...` it will also use `path=...` to do full path
67+
- deletedir
68+
delete the directory defined by `filename=...` it will also use `path=...` to do full path
69+
- createdir
70+
create the directory defined by `filename=...` it will also use `path=...` to do full path
71+
- `createPath=yes` when doing upload and the path do not exists, it will create it, POST only
72+
- `<filename>S=...` give the size of uploaded file with <filename> name, need to be set before file is set in upload, POST only
73+
74+
the output is a json file:
75+
76+
```
77+
{
78+
"files":[ //the files list
79+
{
80+
"name":"3Oc-pika2.gco",//the name of the file
81+
"shortname":"3Oc-pika2.gco", //the 8.3 shortname if available, if not the name of the file
82+
"size":"83.46 KB", //the formated size of the file
83+
"time":"2022-09-04 11:56:05" //the time when the file was modified last time, this one is optional and depend on (SD_TIMESTAMP_FEATURE)
84+
},
85+
{
86+
"name":"subdir", //the name of the file / directory
87+
"size":"-1", //the size is -1 because it is a directory
88+
"time":"" //no time for directories optional as depend on (SD_TIMESTAMP_FEATURE)
89+
}
90+
],
91+
"path":"/", //current path
92+
"occupation":"52", //% of occupation
93+
"status":"subdir created", //status
94+
"total":"192.00 KB", //Formated total space of Filesystem
95+
"used":"100.00 KB" //Formated used space of Filesystem
96+
}
97+
```
98+
99+
### /upload
100+
101+
this handler is for MKS boards using MKS communication protocol if enabled, it handle only upload on SD
102+
103+
### /command
104+
105+
this handler is for all commands the parameter is `cmd=...`
106+
if it is an `[ESPXXX]` command the answer is the `[ESPXXX]` response
107+
if it is not an `[ESPXXX]` command the answer is `ESP3D says: command forwarded` and can be ignored
108+
109+
### /login
110+
111+
this handler is for authentication function if enabled
112+
possible options/arguments are:
113+
- `DISCONNECT=YES`
114+
it will clear current session, remove authentication cookie, set status to `disconnected` and response code to 401 - `SUBMIT=YES`
115+
to login it will need also `PASSWORD=...` and `USER=...`, the answer will be 200 if success and 401 if failed
116+
if user is already authenticated it can use `NEWPASSWORD=...` instead of `PASSWORD=...` to change his password, if successful answer will be returned with code 200, otherwise code will be 500 if change failed or if password format is invalid
117+
118+
Output:
119+
120+
- if authentified and no submission:
121+
`{"status":"Identified","authentication_lvl":"admin"}` and code 200
122+
- if not authenticated and no submission:
123+
`{"status":"Wrong authentication!","authentication_lvl":"guest"}` and code 401
124+
125+
### /config
126+
127+
this handler is a shortcut to [ESP420] command in text mode, to get output in json add `json=yes`
128+
129+
### /updatefw
130+
131+
this handler is for FW upload and update
132+
Answer output is :
133+
`{"status":"..."}` if upload is successful the ESP will restart
134+
135+
### /snap
136+
137+
this handler is on esp32cam with camera enabled to capture a Frame
138+
it answer by sending a jpg image
139+
140+
### /description.xml
141+
142+
this handler is for SSDP if enabled to present device informations
143+
144+
```
145+
<root xmlns="urn:schemas-upnp-org:device-1-0">
146+
<specVersion>
147+
<major>1</major>
148+
<minor>0</minor>
149+
</specVersion>
150+
<URLBase>http://192.168.2.178:80/</URLBase>
151+
<device>
152+
<deviceType>urn:schemas-upnp-org:device:upnp:rootdevice:1</deviceType>
153+
<friendlyName>esp3d</friendlyName>
154+
<presentationURL>/</presentationURL>
155+
<serialNumber>52332</serialNumber>
156+
<modelName>ESP Board</modelName>
157+
<modelDescription/>
158+
<modelNumber>ESP3D 3.0</modelNumber>
159+
<modelURL>https://www.espressif.com/en/products/devkits</modelURL>
160+
<manufacturer>Espressif Systems</manufacturer>
161+
<manufacturerURL>https://www.espressif.com</manufacturerURL>
162+
<UDN>uuid:38323636-4558-4dda-9188-cda0e600cc6c</UDN>
163+
<serviceList/>
164+
<iconList/>
165+
</device>
166+
</root>
167+
```
168+
169+
### Captive portal bypass handlers
170+
171+
to avoid a redirect to index.html and so a refresh of the page, some classic handler have been added so they all go to / handler actually
172+
173+
- /generate_204
174+
- /gconnectivitycheck.gstatic.com
175+
- /fwlink/

config/targets/CNC/GRBL/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ const commandsQuery = (req, res, SendWS) => {
583583
}
584584

585585
const loginURI = (req, res) => {
586-
if (req.body.DISCONNECT == "Yes") {
586+
if (req.body.DISCONNECT == "YES") {
587587
res.status(401)
588588
logindone = false
589589
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/CNC/GRBLHal/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ const commandsQuery = (req, res, SendWS) => {
593593
}
594594

595595
const loginURI = (req, res) => {
596-
if (req.body.DISCONNECT == "Yes") {
596+
if (req.body.DISCONNECT == "YES") {
597597
res.status(401)
598598
logindone = false
599599
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/Printer3D/Marlin-embedded/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ const commandsQuery = (req, res, SendWS) => {
781781
}
782782

783783
const loginURI = (req, res) => {
784-
if (req.body.DISCONNECT == "Yes") {
784+
if (req.body.DISCONNECT == "YES") {
785785
res.status(401)
786786
logindone = false
787787
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/Printer3D/Marlin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ const commandsQuery = (req, res, SendWS) => {
796796
}
797797

798798
const loginURI = (req, res) => {
799-
if (req.body.DISCONNECT == "Yes") {
799+
if (req.body.DISCONNECT == "YES") {
800800
res.status(401)
801801
logindone = false
802802
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/Printer3D/Repetier/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ const commandsQuery = (req, res, SendWS) => {
814814
}
815815

816816
const loginURI = (req, res) => {
817-
if (req.body.DISCONNECT == "Yes") {
817+
if (req.body.DISCONNECT == "YES") {
818818
res.status(401)
819819
logindone = false
820820
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/Printer3D/Smoothieware/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ const commandsQuery = (req, res, SendWS) => {
10751075
}
10761076

10771077
const loginURI = (req, res) => {
1078-
if (req.body.DISCONNECT == "Yes") {
1078+
if (req.body.DISCONNECT == "YES") {
10791079
res.status(401)
10801080
logindone = false
10811081
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

config/targets/SandTable/GRBL/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ const commandsQuery = (req, res, SendWS) => {
514514
}
515515

516516
const loginURI = (req, res) => {
517-
if (req.body.DISCONNECT == "Yes") {
517+
if (req.body.DISCONNECT == "YES") {
518518
res.status(401)
519519
logindone = false
520520
} else if (req.body.USER == "admin" && req.body.PASSWORD == "admin") {

dist/CNC/GRBL/index.html.gz

21 Bytes
Binary file not shown.

dist/CNC/GRBLHal/index.html.gz

21 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)