v8: fix dead JUMP button (plain links + JS dropdown rewrite), always-screenshot on success OR failure
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# COOKIE VAULT v5 — session-1 chrome launcher bridge
|
||||
# Runs AS drjones (interactive Session 1) via scheduled task.
|
||||
# Listens 127.0.0.1:5067, receives {cookies, domain} JSON, launches visible Chrome+selenium.
|
||||
import base64
|
||||
import json, os, re, time, threading
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from urllib.parse import urlparse
|
||||
@@ -99,9 +100,19 @@ def launch(domain, cookies, tok, proxy=""):
|
||||
time.sleep(4)
|
||||
SCREENSHOTS[tok] = _png(driver, "done")
|
||||
except Exception:
|
||||
SCREENSHOTS[tok] = _png(driver, "cookies-set")
|
||||
# screenshot whatever state we're in — even a failed load shows something
|
||||
try:
|
||||
driver.get(f"https://{host}/")
|
||||
time.sleep(3)
|
||||
SCREENSHOTS[tok] = _png(driver, "retry")
|
||||
except Exception:
|
||||
SCREENSHOTS[tok] = _error_png(f"page load failed: {host}")
|
||||
with open(os.path.join(SESSION_DIR, "_launch.log"), "a", encoding="utf-8") as f:
|
||||
f.write(f"{time.ctime()} {domain}: added {added}/{len(cookies)} cookies\n")
|
||||
f.write(f"{time.ctime()} {domain}: added {added}/{len(cookies)} cookies via {proxy or 'direct'}\n")
|
||||
except Exception as e:
|
||||
SCREENSHOTS.setdefault(tok, _error_png(f"launch error: {e}"))
|
||||
with open(os.path.join(SESSION_DIR, "_launch.log"), "a", encoding="utf-8") as f:
|
||||
f.write(f"{time.ctime()} {domain}: LAUNCH ERROR {e}\n")
|
||||
finally:
|
||||
try: driver.quit()
|
||||
except Exception: pass
|
||||
@@ -112,6 +123,14 @@ def _png(driver, stage):
|
||||
except Exception:
|
||||
return b""
|
||||
|
||||
_ERR_PNG = base64.b64decode(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==")
|
||||
|
||||
def _error_png(msg):
|
||||
with open(os.path.join(SESSION_DIR, "_errors.log"), "a", encoding="utf-8") as f:
|
||||
f.write(f"{time.ctime()} {msg}\n")
|
||||
return _ERR_PNG
|
||||
|
||||
SCREENSHOTS = {}
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user