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>
39 lines
1.7 KiB
Python
39 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
import json
|
|
import urllib.request
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
|
|
|
|
|
def main():
|
|
# get password from server env
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=40, allow_agent=False, look_for_keys=False)
|
|
_, o, _ = c.exec_command(
|
|
r"""
|
|
cd /opt/nomadmini/backend
|
|
USER=$(grep -E '^ADMIN_USERNAME=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' | tr -d "'")
|
|
PASS=$(grep -E '^ADMIN_PASSWORD=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' | tr -d "'")
|
|
[ -z "$USER" ] && USER=admin
|
|
echo "user=$USER"
|
|
BODY=$(curl -sk -X POST https://admin.nomadro.cn/api/admin/login -H 'Content-Type: application/json' -d "{\"username\":\"$USER\",\"password\":\"$PASS\"}")
|
|
echo "login=$BODY"
|
|
TOKEN=$(echo "$BODY" | .venv/bin/python -c 'import sys,json; d=json.load(sys.stdin); print(d.get("token") or d.get("access_token") or "")')
|
|
echo "tok=${#TOKEN}"
|
|
CFG=$(curl -sk -H "Authorization: Bearer $TOKEN" https://admin.nomadro.cn/api/admin/douyin/config)
|
|
echo "$CFG" | .venv/bin/python -c 'import sys,json; d=json.load(sys.stdin); print(json.dumps({k:d.get(k) if k!="config" else {"modules": (d.get("config") or {}).get("modules"), "ch": len(((d.get("config") or {}).get("bookContent") or {}).get("chapters") or [])} for k in d}, ensure_ascii=False, indent=2)[:2000])'
|
|
META=$(curl -sk -H "Authorization: Bearer $TOKEN" https://admin.nomadro.cn/api/admin/douyin/meta)
|
|
echo "meta=$META"
|
|
""",
|
|
timeout=60,
|
|
get_pty=True,
|
|
)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|