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>
52 lines
2.4 KiB
Python
52 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import json
|
|
import httpx
|
|
import paramiko
|
|
from urllib.parse import urlparse, parse_qs, unquote
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
g = paramiko.SSHClient()
|
|
g.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
g.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, banner_timeout=80, allow_agent=False, look_for_keys=False)
|
|
|
|
# recent callbacks + channel state + add temporary logging tip via python inspect last errors
|
|
cmd = r"""echo '4669805' | sudo -S -p '' bash -lc '
|
|
journalctl -u douyinweb-api --since "45 min ago" --no-pager -o short-iso 2>/dev/null | grep -iE "oauth|shorts" | tail -60
|
|
echo ====
|
|
cd /opt/douyinWEB/backend && .venv/bin/python - <<PY
|
|
from app import db
|
|
chs=db.list_shorts_channels()
|
|
for c in chs:
|
|
print({k:c.get(k) for k in ("id","name","oauth_ok","oauth_error","oauth_checked_at","youtube_channel_id","oauth_profile_id","oauth_email")})
|
|
print("rt_len", len(str(c.get("refresh_token") or "")), "cid_tail", str(c.get("client_id") or "")[-20:], "sec_tail", str(c.get("client_secret") or "")[-6:])
|
|
PY
|
|
'
|
|
"""
|
|
_, o, e = g.exec_command(cmd, timeout=90)
|
|
print((o.read()+e.read()).decode("utf-8","replace"))
|
|
g.close()
|
|
|
|
with httpx.Client(base_url="https://dy.nomadro.com", timeout=40, follow_redirects=False) as c:
|
|
login = c.post("/api/auth/login", json={"username":"hackrobot","password":"Xiao4669805@"})
|
|
print("login", login.status_code)
|
|
st = c.get("/api/shorts/status")
|
|
data = st.json()
|
|
print("issues", json.dumps(data.get("oauth_issues"), ensure_ascii=False)[:1500])
|
|
board = data.get("board") or {}
|
|
for ch in board.get("channels") or []:
|
|
print("ch", json.dumps({k:ch.get(k) for k in ("id","name","oauth_ok","oauth_error","authorized","youtube_channel_id")}, ensure_ascii=False))
|
|
pk = ((board.get("channels") or [{}])[0] or {}).get("id")
|
|
if pk:
|
|
r = c.get(f"/api/shorts/oauth/start?channel_pk={pk}")
|
|
loc = r.headers.get("location") or ""
|
|
print("start", r.status_code)
|
|
q = parse_qs(urlparse(loc).query)
|
|
print("redirect_uri", unquote((q.get("redirect_uri") or [""])[0]))
|
|
print("prompt", q.get("prompt"))
|
|
print("include", q.get("include_granted_scopes"))
|
|
print("access_type", q.get("access_type"))
|
|
print("client", (q.get("client_id") or [""])[0][:48])
|
|
print("scope", unquote((q.get("scope") or [""])[0]))
|