bea288e414
== 已部署上线 (9项) == - 代办事项真实数据源集成 (企微审批API 8bug修复链) - H5/坐席端 Logo样式统一+绿色背景 - 视频引导页修复 (localStorage key v2) - 坐席端 v9 Vue版本修复 (ElMessage._context) - 截图按钮 v10 修复 (getDisplayMedia user gesture) - 扫码样式恢复+H5扫码登录跳转修复 - H5截图快捷键提示 == 代码完成待部署 (3项) == - 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查) - 会议室预定-小鱼易联终端 (40文件, 40/40测试通过) - IT资产升级审批推送 (asset_service.py) == 需求文档 (2项) == - 坐席端AI辅助消息框-PRD (4项新功能确认) - 坐席端布局优化建议 v2.0 (7天计划) == 新增文档 == - 日报-2026-07-11.md - 知识迭代Bug修复报告-20260711.md - 会议室预定-部署指南.md - CHANGELOG.md 更新 == 测试 == - test_todo_integration.py: 40/40 - test_meetingroom.py: 40/40 - test_bugfix_ki_suggestions.py: 21/21
79 lines
2.2 KiB
Python
79 lines
2.2 KiB
Python
"""Upload large file to server via plink PTY base64 chunks."""
|
|
import subprocess
|
|
import base64
|
|
import hashlib
|
|
import sys
|
|
import os
|
|
|
|
LOCAL_FILE = r"D:\资料\03-项目开发\wecom_it_smart_desk\tmp-h5-dist.tar.gz"
|
|
REMOTE_FILE = "/tmp/h5-dist.tar.gz"
|
|
CHUNK_SIZE = 4000 # chars per chunk
|
|
|
|
PLINK = r"C:\Users\simon\.workbuddy\skills\jumpserver-ops\scripts\plink.exe"
|
|
HOST = "sxn@10.212.189.210"
|
|
PORT = "2222"
|
|
PASSWORD = os.environ.get("JMS_PASSWORD", "") # May be cached
|
|
|
|
def run_plink(commands):
|
|
"""Run commands via plink PTY."""
|
|
cmd = [PLINK, "-P", str(PORT), "-batch", HOST]
|
|
stdin_data = "\n".join(commands) + "\nexit\n"
|
|
result = subprocess.run(
|
|
cmd,
|
|
input=stdin_data,
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=300
|
|
)
|
|
return result.stdout + result.stderr
|
|
|
|
def main():
|
|
# Read file
|
|
with open(LOCAL_FILE, "rb") as f:
|
|
data = f.read()
|
|
|
|
local_md5 = hashlib.md5(data).hexdigest()
|
|
print(f"File: {LOCAL_FILE}")
|
|
print(f"Size: {len(data)} bytes")
|
|
print(f"MD5: {local_md5}")
|
|
|
|
# Base64 encode
|
|
b64 = base64.b64encode(data).decode("ascii")
|
|
total_chunks = (len(b64) + CHUNK_SIZE - 1) // CHUNK_SIZE
|
|
print(f"Base64 length: {len(b64)} chars, {total_chunks} chunks")
|
|
|
|
# Clear remote file
|
|
print("Clearing remote file...")
|
|
run_plink([f"> {REMOTE_FILE}.b64"])
|
|
|
|
# Send chunks
|
|
for i in range(total_chunks):
|
|
start = i * CHUNK_SIZE
|
|
end = min(start + CHUNK_SIZE, len(b64))
|
|
chunk = b64[start:end]
|
|
cmd = f"echo '{chunk}' >> {REMOTE_FILE}.b64"
|
|
run_plink([cmd])
|
|
if (i + 1) % 10 == 0 or i == total_chunks - 1:
|
|
print(f" Sent chunk {i+1}/{total_chunks}")
|
|
|
|
# Decode and verify
|
|
print("Decoding and verifying...")
|
|
verify_cmds = [
|
|
f"base64 -d {REMOTE_FILE}.b64 > {REMOTE_FILE}",
|
|
f"wc -c < {REMOTE_FILE}",
|
|
f"md5sum {REMOTE_FILE}",
|
|
f"rm -f {REMOTE_FILE}.b64",
|
|
]
|
|
output = run_plink(verify_cmds)
|
|
print(f"Server output:\n{output}")
|
|
|
|
if local_md5 in output:
|
|
print(f"\n✅ MD5 match! Upload successful.")
|
|
return 0
|
|
else:
|
|
print(f"\n❌ MD5 mismatch! Expected: {local_md5}")
|
|
return 1
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|