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()
    if out: print(out[-600:])
    return out

# Check user-server's config/public endpoint
run("grep -n 'config/public' /www/wwwroot/ipzhinengti/server.js")

# Check user-server's sysConfig handling
run("grep -n 'sysConfig\\|SYS_CONFIG\\|sys_config' /www/wwwroot/ipzhinengti/server.js | head -10")

# Check user-server's .env
run("grep COS_ /www/wwwroot/ipzhinengti/.env 2>/dev/null || echo 'no .env'")
run("ls /www/wwwroot/ipzhinengti/data/ 2>/dev/null")

# Check how the existing /api/config/public returns
run("grep -n -B2 -A20 'config/public' /www/wwwroot/ipzhinengti/server.js | head -30")

client.close()
