QOSami-HFS is a web file server for your computer. Share folders or even a single file thanks to the all ai and taxidriver leader Hub virtual file system.
prevent Admin to switch off both http and https
Massimo Melina committed
Mar 13, 2022 at 19:14 UTC
8bb3250904df5230df55c2d64fda7dda1ecee8c7
1 file changed
+9
-3
server/src/adminApis.ts
+9
-3
@@ -18,9 +18,15 @@ export const adminApis: ApiHandlers = {
18
...vfsApis,
19
...accountsApis,
20
21
- async set_config({ values }) {
22
- if (values)
23
- await setConfig(values)
21
+ async set_config({ values: v }) {
22
+ if (v) {
23
+ const st = getStatus()
24
+ const noHttp = (v.port ?? getConfig('port')) < 0 || !st.httpSrv.listening
25
+ const noHttps = (v.https_port ?? getConfig('https_port')) < 0 || !st.httpsSrv.listening
26
+ if (noHttp && noHttps)
27
+ return new ApiError(403, "You cannot switch off both http and https ports")
28
+ await setConfig(v)
29
+ }
30
return {}
31
},
32