import json import paramiko HOST = "107.173.30.245" USER = "root" PASSWORD = "Xiao4669805" def ssh_run(cmd: str) -> str: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False) try: stdin, stdout, stderr = c.exec_command(cmd, timeout=120) out = stdout.read().decode("utf-8", "replace") err = stderr.read().decode("utf-8", "replace") if err.strip(): out = out + "\n[stderr]\n" + err return out finally: c.close() def main() -> None: # 1) verify built server bundle contains our text cmd1 = r""" cd /opt/douyinWEB/frontend; echo '[search upcoming.length]'; grep -R "upcoming.length" .next/server -n | head -5; echo '[search 素材]'; grep -R "素材" .next/server -n | head -5; """ print("=== grep in .next/server ===") print(ssh_run(cmd1)) # 2) verify source file exists on server cmd2 = r""" cd /opt/douyinWEB; grep -n "素材 {upcoming.length" frontend/src/app/shorts/page.tsx | head -3 """ print("=== grep in src ===") print(ssh_run(cmd2)) if __name__ == "__main__": main()