diff --git a/scripts/deploy_strategy_symbol_fix.py b/scripts/deploy_strategy_symbol_fix.py new file mode 100644 index 0000000..455aa5b --- /dev/null +++ b/scripts/deploy_strategy_symbol_fix.py @@ -0,0 +1,23 @@ +"""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() diff --git a/static/js/symbol.js b/static/js/symbol.js index 9d21857..1b9b718 100644 --- a/static/js/symbol.js +++ b/static/js/symbol.js @@ -226,7 +226,7 @@ } input.addEventListener('input', function () { - if (hiddenThs) hiddenThs.value = ''; + if (hiddenThs && hiddenThs !== input) hiddenThs.value = ''; if (hiddenName) hiddenName.value = ''; if (hiddenMarket) hiddenMarket.value = ''; if (hiddenSina) hiddenSina.value = ''; diff --git a/templates/strategy.html b/templates/strategy.html index c2978c6..3e5f7b0 100644 --- a/templates/strategy.html +++ b/templates/strategy.html @@ -30,8 +30,10 @@