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>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Probe imported ypp (profile C) oauth tokens on dy."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
PROBE = r"""
|
|
import asyncio
|
|
from app import db, shorts_oauth
|
|
|
|
async def main():
|
|
db.init_db()
|
|
chs = [c for c in db.list_shorts_channels(enabled=None) if str(c.get('oauth_profile_id') or '').upper()=='C']
|
|
print('profile_C', len(chs))
|
|
for ch in chs:
|
|
try:
|
|
r = await shorts_oauth.probe_channel_oauth(ch)
|
|
ok = r.get('ok') if isinstance(r, dict) else r
|
|
err = (r.get('error') if isinstance(r, dict) else '') or ''
|
|
print('OK' if ok else 'BAD', ch.get('name'), (err or '')[:120])
|
|
except Exception as exc:
|
|
print('ERR', ch.get('name'), str(exc)[:160])
|
|
|
|
asyncio.run(main())
|
|
"""
|
|
|
|
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)
|
|
sftp = c.open_sftp()
|
|
with sftp.file("/tmp/_probe_c.py", "w") as f:
|
|
f.write(PROBE)
|
|
sftp.close()
|
|
_, o, e = c.exec_command("cd /opt/douyinWEB/backend && .venv/bin/python /tmp/_probe_c.py 2>&1", timeout=180)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print(err[-1000:])
|
|
c.close()
|