Files
WYF-koubo/scripts/ssh_update.py
T
2026-06-19 18:45:55 +08:00

33 lines
1.2 KiB
Python

import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('152.136.232.83', port=22, username='root', password='Jianhua105', timeout=10)
def run(cmd):
print(f"\n>>> {cmd[:120]}")
stdin, stdout, stderr = client.exec_command(cmd, timeout=15)
out = stdout.read().decode('utf-8', errors='replace').strip()
err = stderr.read().decode('utf-8', errors='replace').strip()
if out: print(out[-600:])
if err: print(f"ERR: {err[-200:]}")
return out
# Check the .env file
run("grep -n 'COS_BUCKET\\|COS_REGION' /www/wwwroot/zhinengtiapp/.env")
# Check sysConfig file
run("cat /www/wwwroot/zhinengtiapp/data/sysConfig.json 2>/dev/null || echo 'no sysConfig'")
# Check what the endpoint actually returns
run("curl -s http://localhost:3002/api/system/config/public | python3 -m json.tool 2>/dev/null || curl -s http://localhost:3002/api/system/config/public")
# Check the new endpoint exists in index.js
run("grep -n 'system/config/public' /www/wwwroot/zhinengtiapp/index.js")
# Check admin.html changes
run("grep -n 'UPDATE_COS' /www/wwwroot/zhinengtiapp/public/admin.html")
client.close()
print("\n=== DONE ===")