Wire Taro social pages to social_svc (Centrifugo + live RTMP), drop multi-channel chat chrome, and add weapp WXSS sanitize/deploy helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.5 KiB
Python
73 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
import time
|
|
|
|
import paramiko
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(
|
|
"82.157.112.245",
|
|
username="ubuntu",
|
|
password="Xiao4669805",
|
|
timeout=60,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
)
|
|
cmd = r"""
|
|
set -e
|
|
EXT=/www/server/panel/vhost/nginx/extension/www.nomadro.cn/live-flv.conf
|
|
sudo tee "$EXT" >/dev/null <<'EOF'
|
|
# Nomadro social native live — must beat Next catch-all
|
|
location ^~ /live/ {
|
|
proxy_pass http://127.0.0.1:1985/live/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
chunked_transfer_encoding on;
|
|
add_header Access-Control-Allow-Origin * always;
|
|
add_header Cache-Control no-cache always;
|
|
add_header X-Nomadro-Live srs always;
|
|
}
|
|
EOF
|
|
sudo nginx -t
|
|
sudo systemctl reload nginx
|
|
|
|
echo '=== public /live/ headers ==='
|
|
curl -skI --max-time 5 'https://nomadro.cn/live/nope.flv' | head -20 || true
|
|
echo '=== local srs headers ==='
|
|
curl -sI --max-time 3 'http://127.0.0.1:1985/live/nope.flv' | head -15 || true
|
|
echo '=== join 2 peers ==='
|
|
curl -sk --max-time 8 -X POST 'https://nomadro.cn/api/social/v1/live/rooms/hall1/join' \
|
|
-H 'Content-Type: application/json' -H 'X-Social-Guest-Id: peer_alice' \
|
|
-d '{"nick":"Alice"}' > /tmp/a.json
|
|
curl -sk --max-time 8 -X POST 'https://nomadro.cn/api/social/v1/live/rooms/hall1/join' \
|
|
-H 'Content-Type: application/json' -H 'X-Social-Guest-Id: peer_bob' \
|
|
-d '{"nick":"Bob"}' > /tmp/b.json
|
|
python3 - <<'PY'
|
|
import json
|
|
a=json.load(open('/tmp/a.json'))
|
|
b=json.load(open('/tmp/b.json'))
|
|
print('alice_ok', a.get('ok'), 'peers', [p['nick'] for p in a.get('peers',[])])
|
|
print('bob_ok', b.get('ok'), 'peers', [p['nick'] for p in b.get('peers',[])])
|
|
print('push', (a.get('pushUrl') or '')[:90])
|
|
print('play', (a.get('playUrl') or '')[:90])
|
|
print('engine', a.get('engine'))
|
|
PY
|
|
"""
|
|
_, stdout, _ = c.exec_command(cmd, timeout=90, get_pty=True)
|
|
while not stdout.channel.exit_status_ready():
|
|
if stdout.channel.recv_ready():
|
|
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
|
time.sleep(0.05)
|
|
while stdout.channel.recv_ready():
|
|
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
|
print("[exit", stdout.channel.recv_exit_status(), "]", flush=True)
|
|
c.close()
|