douyinWEB/scripts/_check_public_base_dy.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

26 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
"""Check public base / redirect env on dy VPS."""
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
cmds = [
"grep -E 'PUBLIC|BASE|DOMAIN|nomadro' /etc/systemd/system/douyinweb-api.service /etc/systemd/system/douyinweb-api.service.d/* 2>/dev/null | head -40",
"cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'\nfrom app.config import settings\nfrom app import db\ndb.init_db()\ncfg=db.get_settings_map()\nprint('settings.public_base_url', getattr(settings,'public_base_url',None))\nprint('kv redirect', cfg.get('shorts_oauth_redirect_uri'))\nprint('kv tt redirect', cfg.get('tiktok_oauth_redirect_uri'))\nPY",
]
for cmd in cmds:
print("CMD", cmd[:80])
_, o, e = c.exec_command(cmd, timeout=60)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace")
if err.strip():
print("ERR", err[:500])
c.close()