nomadro/apps/admin/deploy/_upload_new_props_82.py
Eric ac1239c828 Redesign WeChat paid props as ops shelf: Chinese names, SKUs, icons.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-22 11:12:34 +08:00

51 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
"""Upload ops prop PNGs to admin.nomadro.cn/props/ (CORS for WeChat batch)."""
from __future__ import annotations
from pathlib import Path
import paramiko
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
LOCAL = Path(__file__).resolve().parents[1] / "public" / "props"
FILES = (
"nomad_lite.png",
"nomad_plus.png",
"nomad_pro.png",
"pay_test.png",
"29.png",
"298.png",
"588.png",
"test.png",
"nomad.png",
"tiktok.png",
"youtube.png",
"ebook.png",
"svip.png",
)
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=40, allow_agent=False, look_for_keys=False)
sftp = c.open_sftp()
c.exec_command("mkdir -p /tmp/wx_props_new", timeout=10)
for name in FILES:
path = LOCAL / name
if not path.is_file():
print("skip missing", name)
continue
sftp.put(str(path), f"/tmp/wx_props_new/{name}")
print("up", name, path.stat().st_size)
sftp.close()
_, o, e = c.exec_command(
"sudo cp -a /tmp/wx_props_new/. /www/wwwroot/admin.nomadro.cn/props/ && "
"sudo chown -R www:www /www/wwwroot/admin.nomadro.cn/props && "
"ls -lah /www/wwwroot/admin.nomadro.cn/props/ && "
"curl -sI https://admin.nomadro.cn/props/nomad_lite.png -H 'Origin: https://mp.weixin.qq.com' | tr -d '\\r' | head -15"
)
print(o.read().decode())
err = e.read().decode()
if err:
print("stderr", err)
c.close()