70 lines
3.0 KiB
Bash
Executable File
70 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
HTML_FILE="$ROOT_DIR/deploy/tksea-portal/index.html"
|
|
ADMIN_HTML_FILE="$ROOT_DIR/deploy/tksea-portal/admin-batch-import.html"
|
|
NGINX_FILE="$ROOT_DIR/deploy/tksea-portal/nginx.sub.tksea.top.conf.example"
|
|
DEPLOY_SCRIPT="$ROOT_DIR/scripts/deploy/deploy_tksea_portal.sh"
|
|
|
|
fail() {
|
|
echo "FAIL: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
assert_contains_file() {
|
|
local file="$1"
|
|
local needle="$2"
|
|
if ! grep -Fq "$needle" "$file"; then
|
|
fail "expected [$needle] in $file"
|
|
fi
|
|
}
|
|
|
|
[[ -f "$HTML_FILE" ]] || fail "missing $HTML_FILE"
|
|
[[ -f "$ADMIN_HTML_FILE" ]] || fail "missing $ADMIN_HTML_FILE"
|
|
[[ -f "$NGINX_FILE" ]] || fail "missing $NGINX_FILE"
|
|
[[ -f "$DEPLOY_SCRIPT" ]] || fail "missing $DEPLOY_SCRIPT"
|
|
|
|
assert_contains_file "$HTML_FILE" "Sub2API 多模型接入中心"
|
|
assert_contains_file "$HTML_FILE" "https://sub.tksea.top/portal/"
|
|
assert_contains_file "$HTML_FILE" "/portal-proxy/api/v1"
|
|
assert_contains_file "$HTML_FILE" "localStorage.setItem"
|
|
assert_contains_file "$HTML_FILE" "/auth/me"
|
|
assert_contains_file "$HTML_FILE" "/groups/available"
|
|
assert_contains_file "$HTML_FILE" "/subscriptions"
|
|
assert_contains_file "$HTML_FILE" "/keys?page=1&page_size=20"
|
|
assert_contains_file "$HTML_FILE" "copy-existing-key-btn"
|
|
assert_contains_file "$HTML_FILE" "已有 Key"
|
|
assert_contains_file "$HTML_FILE" "showToast"
|
|
assert_contains_file "$HTML_FILE" "可立即使用"
|
|
assert_contains_file "$HTML_FILE" "需开通"
|
|
assert_contains_file "$HTML_FILE" "暂不推荐"
|
|
assert_contains_file "$HTML_FILE" "gpt-5.4"
|
|
assert_contains_file "$HTML_FILE" "MiniMax-M2.7-highspeed"
|
|
assert_contains_file "$HTML_FILE" "deepseek-chat"
|
|
|
|
assert_contains_file "$ADMIN_HTML_FILE" "Batch Import Admin"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "matched_account_state"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "account_resolution"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "/api/batch-import/runs"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "/api/batch-import/runs/"
|
|
assert_contains_file "$ADMIN_HTML_FILE" '/items${query ?'
|
|
assert_contains_file "$ADMIN_HTML_FILE" "Authorization"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "base_url|api_key|requested_model_1,requested_model_2"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "reused"
|
|
assert_contains_file "$ADMIN_HTML_FILE" "reactivated"
|
|
|
|
assert_contains_file "$NGINX_FILE" "location = /portal"
|
|
assert_contains_file "$NGINX_FILE" "location = /kimi-portal"
|
|
assert_contains_file "$NGINX_FILE" "location /portal/"
|
|
assert_contains_file "$NGINX_FILE" "location /portal-proxy/"
|
|
assert_contains_file "$NGINX_FILE" "location /kimi-portal-proxy/"
|
|
|
|
assert_contains_file "$DEPLOY_SCRIPT" "portal url: https://sub.tksea.top/portal/"
|
|
assert_contains_file "$DEPLOY_SCRIPT" "batch import admin url: https://sub.tksea.top/portal/admin-batch-import.html"
|
|
assert_contains_file "$DEPLOY_SCRIPT" "REMOTE_PORTAL_DIR"
|
|
assert_contains_file "$DEPLOY_SCRIPT" "LOCAL_PORTAL_DIR"
|
|
assert_contains_file "$DEPLOY_SCRIPT" "patch_tksea_portal_nginx.py"
|
|
|
|
echo "PASS: tksea portal assets look consistent"
|