nomadro/apps/admin/deploy/_fix_config_ws_nginx.py
Eric 4389ebe6cb Ship WeChat audit release 2026-11-02: realtime config, audit vip-ebook shell, admin ops.
Document test9 tag 2026-11-02 for upload; POST config pull + WS, fixed dark home, no debug bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 16:12:57 +08:00

40 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import paramiko
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
REMOTE = r"""
set -e
ls -la /www/server/panel/vhost/nginx/*api* 2>/dev/null || true
echo ---CONF---
CONF=/www/server/panel/vhost/nginx/api.nomadro.cn.conf
if [ -f "$CONF" ]; then
grep -n 'config/ws\|proxy_pass\|location /' "$CONF" | head -80
else
echo missing_conf
ls /www/server/panel/vhost/nginx/ | head
fi
echo ---DIRECT---
curl -sk -i -N --max-time 3 \
-H 'Connection: Upgrade' \
-H 'Upgrade: websocket' \
-H 'Sec-WebSocket-Version: 13' \
-H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' \
http://127.0.0.1:8010/api/config/ws | head -30
"""
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=30, allow_agent=False, look_for_keys=False)
_, stdout, _ = c.exec_command(REMOTE, timeout=60)
print(stdout.read().decode("utf-8", "replace"))
c.close()
if __name__ == "__main__":
main()