# -*- coding: utf-8 -*- import paramiko 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) cmd = r""" set -e cd /opt/douyinWEB git fetch origin git reset --hard origin/main # keep next rewrite cat > frontend/next.config.mjs <<'EOF' /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, async rewrites() { return [ { source: "/api/:path*", destination: "http://127.0.0.1:8014/api/:path*" }, { source: "/covers/:path*", destination: "http://127.0.0.1:8014/covers/:path*" }, ]; }, }; export default nextConfig; EOF # anonymous read for SeaweedFS S3 cat >/etc/seaweedfs/s3.json <<'EOF' { "identities": [ { "name": "anonymous", "actions": ["Read"] }, { "name": "douyin", "credentials": [ {"accessKey": "douyin", "secretKey": "douyinweb_s3_2026"} ], "actions": ["Admin", "Read", "Write", "List", "Tagging"] } ] } EOF systemctl restart seaweed-s3 cd frontend && npm run build systemctl restart douyinweb-api douyinweb-web sleep 6 systemctl is-active douyinweb-api douyinweb-web seaweed-s3 curl -s -o /dev/null -w 'web:%{http_code}\n' --max-time 15 http://127.0.0.1:4014/ SID=$(curl -s http://127.0.0.1:8014/api/sessions/active | python3 -c "import sys,json; d=json.load(sys.stdin); print((d.get('sessions') or [{}])[0].get('id',''))") echo SID=$SID curl -s -o /dev/null -w 'cover:%{http_code}\n' --max-time 20 "http://127.0.0.1:8014/api/sessions/$SID/cover" curl -s http://127.0.0.1:8014/api/sessions/active | python3 -c "import sys,json; d=json.load(sys.stdin); print('n',d.get('total')); [print(s.get('anchor_name'), s.get('cover_url')) for s in (d.get('sessions') or [])[:5]]" """ _, o, _ = c.exec_command(cmd, timeout=600, get_pty=True) print(o.read().decode("utf-8", errors="replace")[-6000:]) c.close()