Collapse portal under src/, unify pnpm workspace/scripts, thin VIP topic re-exports, drop orphan vip scaffolds and one-shot scripts, ignore xhs/release, document root commands. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Smoke-check Douyin admin + API on production."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import urllib.request
|
|
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
|
|
|
|
|
def http(url: str) -> tuple[int, str]:
|
|
req = urllib.request.Request(url, method="GET")
|
|
try:
|
|
with urllib.request.urlopen(req, timeout=20) as r:
|
|
return r.status, r.read().decode("utf-8", "replace")[:800]
|
|
except urllib.error.HTTPError as e:
|
|
return e.code, e.read().decode("utf-8", "replace")[:800]
|
|
|
|
|
|
def main() -> int:
|
|
for url in (
|
|
"https://api.nomadro.cn/health",
|
|
"https://admin.nomadro.cn/",
|
|
"https://admin.nomadro.cn/douyin",
|
|
"https://admin.nomadro.cn/api/admin/douyin/meta",
|
|
):
|
|
code, body = http(url)
|
|
print(f"{code} {url}")
|
|
if "health" in url or "meta" in url:
|
|
print(" ", body[:200].replace("\n", " "))
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=30, allow_agent=False, look_for_keys=False)
|
|
_, o, _ = c.exec_command(
|
|
"grep -o 'douyin' /www/wwwroot/admin.nomadro.cn/assets/*.js | wc -l; "
|
|
"grep -o 'PlatformSelect\\|入口开关\\|小册 Markdown' /www/wwwroot/admin.nomadro.cn/assets/*.js | head -5; "
|
|
"python3 -c \"import ast; ast.parse(open('/opt/nomadmini/backend/app/services/tt_platform_config.py').read()); print('tt_platform_config AST ok')\"; "
|
|
"systemctl is-active nomadmini-api",
|
|
timeout=60,
|
|
)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
c.close()
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|