nomadro/apps/admin/deploy/final_verify.py
eric 3e5b7c2098 Monorepo super-optimize: src layout, workspace scripts, docs.
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>
2026-10-01 00:34:04 +08:00

37 lines
1.3 KiB
Python

import paramiko, json
from pathlib import Path
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("82.157.112.245", username="ubuntu", password="Xiao4669805", timeout=20)
cmd = r"""
python3 - <<'PY'
import json, urllib.request
print('health', urllib.request.urlopen('https://api.nomadro.cn/health').read().decode())
req = urllib.request.Request(
'https://api.nomadro.cn/api/admin/login',
data=json.dumps({'username':'admin','password':'Xiao4669805'}).encode(),
headers={'Content-Type':'application/json'}
)
tok = json.loads(urllib.request.urlopen(req).read().decode())['token']
req2 = urllib.request.Request(
'https://api.nomadro.cn/api/admin/stats',
headers={'Authorization': f'Bearer {tok}'}
)
print('stats', urllib.request.urlopen(req2).read().decode())
req3 = urllib.request.Request(
'https://api.nomadro.cn/api/admin/checklist',
headers={'Authorization': f'Bearer {tok}'}
)
print('checklist_items', len(json.loads(urllib.request.urlopen(req3).read().decode())['items']))
print('admin_html_ok', 'Nomadro Admin' in urllib.request.urlopen('https://admin.nomadro.cn/').read().decode())
PY
"""
_, o, e = c.exec_command(cmd)
Path("deploy/final-verify.txt").write_text(
o.read().decode("utf-8", "replace") + "\nERR\n" + e.read().decode("utf-8", "replace"),
encoding="utf-8",
)
c.close()
print("ok")