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>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
REMOTE = r"""
|
|
cd /opt/douyinWEB/backend
|
|
.venv/bin/python - <<'PY'
|
|
from app import db, youtube_manage as ytm
|
|
from app.yt_channel_meta import oauth_meta_from_channel
|
|
|
|
cfg = db.get_settings_map()
|
|
print("shorts_enabled", cfg.get("shorts_enabled"))
|
|
for ch in db.list_shorts_channels(enabled=None):
|
|
sn = ytm._snippet_from_channel_row(ch) or {}
|
|
meta = oauth_meta_from_channel(ch)
|
|
err = str(ch.get("oauth_error") or "")
|
|
print(
|
|
ch.get("oauth_profile_id"),
|
|
"|",
|
|
ch.get("name"),
|
|
"| oauth_ok",
|
|
ch.get("oauth_ok"),
|
|
"| thumb",
|
|
bool(sn.get("thumb_url")),
|
|
"| videos",
|
|
sn.get("video_count"),
|
|
"| err",
|
|
(err[:50] + "...") if len(err) > 50 else (err or "-"),
|
|
)
|
|
PY
|
|
curl -sS -o /dev/null -w "nginx_api=%{http_code} nginx_shorts=%{http_code}\n" \
|
|
-k https://127.0.0.1/api/health -H "Host: dy.nomadro.live" \
|
|
&& curl -sS -o /dev/null -w "" -k https://127.0.0.1/api/shorts/status -H "Host: dy.nomadro.live" -w "nginx_shorts=%{http_code}\n"
|
|
systemctl is-active douyinweb-api douyinweb-web
|
|
"""
|
|
|
|
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)
|
|
_i, o, e = c.exec_command(REMOTE, timeout=90)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace").strip()
|
|
if err:
|
|
print("ERR", err[:400])
|
|
c.close()
|