mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-08-02 15:39:31 +08:00
30 lines
908 B
Bash
Executable File
30 lines
908 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
|
|
REPO_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
|
|
CONSOLE_VIEW="$REPO_ROOT/luasrc/view/openclaw/console.htm"
|
|
|
|
fail() {
|
|
echo "FAIL: $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
grep -Fq "var url = 'http://' + host + ':' + gwPort + '/'" "$CONSOLE_VIEW" || fail "console view should force HTTP gateway URL"
|
|
grep -Fq '请点击上方「新窗口打开」访问控制台。' "$CONSOLE_VIEW" || fail "console view should direct users to a new window"
|
|
|
|
if grep -Fq "document.createElement('iframe')" "$CONSOLE_VIEW"; then
|
|
fail "console view should not embed the OpenClaw UI in an iframe"
|
|
fi
|
|
|
|
if grep -Fq 'window.location.protocol' "$CONSOLE_VIEW"; then
|
|
fail "console view should not reuse the LuCI page protocol for the gateway URL"
|
|
fi
|
|
|
|
cr=$(printf '\r')
|
|
if LC_ALL=C grep -q "$cr" "$CONSOLE_VIEW"; then
|
|
fail "console view should use LF line endings"
|
|
fi
|
|
|
|
echo "ok"
|