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

53 lines
2.1 KiB
Python

# -*- coding: utf-8 -*-
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE_SH = r"""#!/bin/bash
set -e
systemctl restart douyinweb-api
sleep 2
systemctl is-active douyinweb-api
P=/opt/douyinWEB/backend/data/neko/profiles/1
echo '=== HOST dirs ==='
find "$P/Default" -maxdepth 3 -type d 2>/dev/null | head -50 || true
echo '=== HOST Extensions ==='
ls -la "$P/Default/Extensions" 2>/dev/null || true
echo '=== HOST Local Extension Settings ==='
ls -la "$P/Default/Local Extension Settings" 2>/dev/null || true
echo '=== CONTAINER ==='
docker exec douyinweb-neko-1 sh -c 'ls /home/neko/.config/google-chrome/Default/Extensions 2>/dev/null; ls "/home/neko/.config/google-chrome/Default/Local Extension Settings" 2>/dev/null; grep -aR -l "YouTube Studio Auto Dismiss" "/home/neko/.config/google-chrome/Default/Local Extension Settings" 2>/dev/null | head -5 || true'
echo '=== PREFS ==='
python3 - <<'PY'
import json
from pathlib import Path
p = Path("/opt/douyinWEB/backend/data/neko/profiles/1/Default/Preferences")
if not p.exists():
print("no prefs")
else:
d = json.loads(p.read_text(encoding="utf-8", errors="replace"))
s = (d.get("extensions") or {}).get("settings") or {}
tm = s.get("dhdgffkkebhmkfjojejmpbldmpobfkfo")
print("tm_present", bool(tm), "state", (tm or {}).get("state"), "path", (tm or {}).get("path"))
print("developer_mode", ((d.get("extensions") or {}).get("ui") or {}).get("developer_mode"))
PY
"""
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)
s = c.open_sftp()
s.put(r"c:\Users\admin\Desktop\douyinWEB\backend\app\auth.py", "/opt/douyinWEB/backend/app/auth.py")
with s.file("/tmp/verify_neko_tm.sh", "w") as f:
f.write(REMOTE_SH)
s.close()
_i, o, e = c.exec_command("bash /tmp/verify_neko_tm.sh", timeout=120)
o.channel.settimeout(120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace")
if err.strip():
print("STDERR", err[:1000])
c.close()