douyinWEB/scripts/_verify_admin_before_deploy.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

27 lines
955 B
Python

# -*- coding: utf-8 -*-
import paramiko
import sys
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
script = """
import sys
sys.path.insert(0, '/opt/douyinWEB/backend')
from app import db
from app.config import settings
m = db.get_settings_map()
print('admin_username', m.get('admin_username'))
print('has_hash', bool(m.get('admin_password_hash')))
print('hash_tail', str(m.get('admin_password_hash') or '')[-8:])
print('config_user', settings.admin_username)
print('config_pw_set', bool(str(settings.admin_password or '')))
"""
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
_, o, e = c.exec_command(f"cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'\n{script}\nPY", timeout=60)
print(o.read().decode("utf-8", "replace"))
if e.read().decode().strip():
print("ERR", e.read()[:200])
c.close()