Add Services modal with independent lifecycle controls and persistent autostart
This commit is contained in:
@@ -30,6 +30,7 @@ status(){ curl -sS -o "$d/response" -w '%{http_code}' "$@"; }
|
||||
start
|
||||
[[ $(status "$base/api/state") == 401 ]]
|
||||
[[ $(status "$base/api/directory") == 401 ]]
|
||||
[[ $(status "$base/api/services") == 401 ]]
|
||||
for endpoint in client-macclassic client-macclassic-source mac-opentransport; do
|
||||
[[ $(status "$base/api/browser/$endpoint") == 401 ]]
|
||||
done
|
||||
@@ -55,6 +56,12 @@ cmp "$d/download.zip" "$d/www/drivers/WIN95.zip"
|
||||
[[ $(status -b "$d/cookie" "$base/drivers/WINXP.zip") == 404 ]]
|
||||
get api/drivers | jq -e '.platforms==["WIN95"]' >/dev/null
|
||||
csrf=$(jq -r .csrf <<<"$s")
|
||||
prefs=$(get api/services); jq -e '(.autostart.netware|not) and .autostart.browser' <<<"$prefs" >/dev/null
|
||||
request=$(jq -c '{op:"autostart",revision,autostart:{netware:true,browser:false},confirm:true}' <<<"$prefs")
|
||||
[[ $(status -b "$d/cookie" -H "Origin: $base" -H 'Content-Type: application/json' -d "$request" "$base/api/services") == 403 ]]
|
||||
post api/services "$request" | jq -e '.autostart.netware and (.autostart.browser|not)' >/dev/null
|
||||
[[ $(status -b "$d/cookie" -H "Origin: $base" -H 'Content-Type: application/json' -H "X-Mars-CSRF: $csrf" -d "$request" "$base/api/services") == 409 ]]
|
||||
[[ $(stat -c %a "$cfg.services.json") == 600 ]]
|
||||
dir=$(get api/directory); jq -e '(.nativeNds|not) and (.configured|not) and (.liveAvailable|not)' <<<"$dir" >/dev/null
|
||||
request=$(jq -c '{revision,config,confirm:true}' <<<"$dir")
|
||||
post api/directory "$request" | jq -e .ok >/dev/null
|
||||
@@ -74,4 +81,6 @@ post api/logout '{}' | jq -e .ok >/dev/null
|
||||
[[ $(status -b "$d/cookie" "$base/api/state") == 401 ]]
|
||||
kill "$pid"; wait "$pid"; pid=''; start
|
||||
post api/login '{"user":"admin","password":"NativeTestPassword123"}' | jq -e .ok >/dev/null
|
||||
get api/services | jq -e '.autostart.netware and (.autostart.browser|not)' >/dev/null
|
||||
printf 'PASS: services authenticated persistence, CSRF, conflict, reboot readback.\n'
|
||||
printf 'PASS: real CivetWeb login, origin/host/CSRF, default-password guard, persistence, logout, preview/save/backup (when Ethernet exists).\n'
|
||||
|
||||
Reference in New Issue
Block a user