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>
62 lines
2.0 KiB
Python
62 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import time
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
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)
|
|
|
|
|
|
def run(cmd: str, timeout: int = 420) -> str:
|
|
_, out, err = c.exec_command(cmd, timeout=timeout)
|
|
return (out.read() + err.read()).decode("utf-8", "replace").strip()
|
|
|
|
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB && git fetch origin test1 && git pull --ff-only origin test1 && "
|
|
"git log -1 --format='%h %s' | tr -cd '\\11\\12\\15\\40-\\176'"
|
|
)
|
|
)
|
|
c.exec_command("systemctl restart douyinweb-api >/dev/null 2>&1", timeout=5)
|
|
time.sleep(10)
|
|
print("api:", run("systemctl is-active douyinweb-api"))
|
|
print(
|
|
run(
|
|
r"""
|
|
export DY_S3_ENABLED=true
|
|
export DY_S3_ENDPOINT=http://127.0.0.1:8333
|
|
export DY_S3_PUBLIC_BASE=https://s3.nomadro.com
|
|
export DY_S3_ACCESS_KEY=douyin
|
|
export DY_S3_SECRET_KEY=douyinweb_s3_2026
|
|
export DY_S3_BUCKET=douyin-covers
|
|
export DY_S3_REGION=us-east-1
|
|
cd /opt/douyinWEB/backend
|
|
/opt/douyinWEB/backend/.venv/bin/python /opt/douyinWEB/scripts/_publish_downloads.py --ext-only 2>&1 | tr -cd '\11\12\15\40-\176' | tail -n 20
|
|
"""
|
|
)
|
|
)
|
|
# patch caption template in kv if still bare {anchor}
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB && /opt/douyinWEB/backend/.venv/bin/python <<'PY'\n"
|
|
"from backend.app import db\n"
|
|
"m = db.get_settings_map()\n"
|
|
"cur = str(m.get('x_clips_caption_template') or '')\n"
|
|
"print('before', repr(cur))\n"
|
|
"if cur in ('', '{anchor}'):\n"
|
|
" db.update_settings_map({'x_clips_caption_template': '{anchor} \\u76f4\\u64ad\\u7cbe\\u5f69\\u77ac\\u95f4'})\n"
|
|
"print('after', repr(db.get_settings_map().get('x_clips_caption_template')))\n"
|
|
"PY"
|
|
)
|
|
)
|
|
print("db:", run("stat -c '%n %s' /opt/douyinWEB/backend/data/monitor.db"))
|
|
c.close()
|
|
print("DONE")
|