"""Deploy strategy symbol input fix.""" import paramiko import sys from pathlib import Path sys.stdout.reconfigure(encoding="utf-8", errors="replace") root = Path(__file__).resolve().parents[1] files = ["templates/strategy.html", "static/js/symbol.js"] c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("192.168.8.21", username="root", password="woaini88", timeout=15) sftp = c.open_sftp() for rel in files: sftp.put(str(root / rel), f"/opt/qihuo/{rel.replace(chr(92), '/')}") print("uploaded", rel) sftp.close() html = open(root / "templates/strategy.html", encoding="utf-8").read() js = open(root / "static/js/symbol.js", encoding="utf-8").read() ok = "symbol-ths-code" in html and 'name="symbol"' not in html.split("symbol-input")[1].split(">")[0] print("strategy.html pattern OK" if ok else "FAIL strategy.html") print("symbol.js guard OK" if "hiddenThs !== input" in js else "FAIL symbol.js") c.close()