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>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko
|
|
|
|
FILES = [
|
|
"backend/app/notify.py",
|
|
"backend/app/db.py",
|
|
"backend/app/models.py",
|
|
"frontend/src/app/settings/page.tsx",
|
|
]
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
sftp = c.open_sftp()
|
|
for rel in FILES:
|
|
sftp.put(f"C:/Users/admin/Desktop/douyinWEB/{rel}", f"/opt/douyinWEB/{rel}")
|
|
sftp.close()
|
|
|
|
|
|
def run(cmd, timeout=180):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace").strip()
|
|
|
|
|
|
print(run("systemctl restart douyinweb-api; sleep 4; systemctl is-active douyinweb-api"))
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB/backend && .venv/bin/python -c \""
|
|
"import json; from app import db; "
|
|
"db.update_settings_map({'notify_ntfy_on_douyin_live': False}); "
|
|
"print(json.dumps(db.get_settings_map().get('notify_ntfy_on_douyin_live')))\""
|
|
)
|
|
)
|
|
print(run("cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -5"))
|
|
print(run("systemctl restart douyinweb-web; systemctl is-active douyinweb-web"))
|
|
c.close()
|
|
print("DONE")
|