nomadro/apps/miniprogram/weapp/scripts/_ssh_fetch_book_loader.py
eric 3e5b7c2098 Monorepo super-optimize: src layout, workspace scripts, docs.
Collapse portal under src/, unify pnpm workspace/scripts, thin VIP topic re-exports, drop orphan vip scaffolds and one-shot scripts, ignore xhs/release, document root commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 00:34:04 +08:00

32 lines
1.2 KiB
Python

import paramiko
from pathlib import Path
host = "129.204.21.129"
user = "ubuntu"
password = "Xiao4669805"
out = Path(__file__).resolve().parent / "_hackrobot_book" / "index.tsx"
out_parent = out.parent
out_parent.mkdir(exist_ok=True)
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, username=user, password=password, timeout=25, allow_agent=False, look_for_keys=False)
sftp = client.open_sftp()
sftp.get("/www/wwwroot/nomadbook/src/pages/book/index.tsx", str(out))
sftp.close()
# also extract which md is imported
_stdin, stdout, stderr = client.exec_command(
"grep -nE 'import|book\\.md|info\\.md|require|raw' /www/wwwroot/nomadbook/src/pages/book/index.tsx | head -40; "
"ls -la /www/wwwroot/www.hackrobot.cn/; "
"ls -la /www/wwwroot/nomadbook/dist/ 2>/dev/null | head -20; "
"readlink -f /www/wwwroot/www.hackrobot.cn 2>/dev/null; "
"ls /www/wwwroot/nomadbook/dist/h5 2>/dev/null | head -20",
timeout=60,
)
probe = stdout.read().decode("utf-8", errors="replace")
(out_parent / "loader-probe.txt").write_text(probe, encoding="utf-8")
client.close()
print("saved", out, out.stat().st_size)
print(probe[:2000])