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>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
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()
|
|
for rel in [
|
|
"frontend/src/lib/api.js",
|
|
"frontend/src/lib/douyinLive.ts",
|
|
"frontend/src/components/YtAssignPanel.tsx",
|
|
]:
|
|
data = (ROOT / rel).read_bytes().replace(b"\r\n", b"\n")
|
|
with sftp.file(f"/opt/douyinWEB/{rel}", "wb") as f:
|
|
f.write(data)
|
|
print("up", rel)
|
|
sftp.close()
|
|
_, o, e = c.exec_command(
|
|
"cd /opt/douyinWEB/frontend && npm run build >/tmp/fe_build.log 2>&1; tail -n 8 /tmp/fe_build.log; systemctl restart douyinweb-web; sleep 2; systemctl is-active douyinweb-web",
|
|
timeout=150,
|
|
)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
print(e.read().decode("utf-8", "replace")[:500])
|
|
c.close()
|