init_script.py python
34 lines 1.0 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days ago
1 """Packaging-only Tauri initialization script for in-memory session bootstrap."""
2
3 from __future__ import annotations
4
5 import json
6
7
8 def build_auth_bootstrap_script(*, session_credential: str, csrf_token: str) -> str:
9 """Return JS that fills the Q1 auth panel without persisting secrets."""
10 session_json = json.dumps(session_credential)
11 csrf_json = json.dumps(csrf_token)
12 return f"""
13 (function() {{
14 const session = {session_json};
15 const csrf = {csrf_json};
16 function bootstrap() {{
17 const sessionInput = document.getElementById("session-input");
18 const csrfInput = document.getElementById("csrf-input");
19 const saveButton = document.getElementById("auth-save");
20 if (!sessionInput || !csrfInput || !saveButton) {{
21 setTimeout(bootstrap, 50);
22 return;
23 }}
24 sessionInput.value = session;
25 csrfInput.value = csrf;
26 saveButton.click();
27 }}
28 if (document.readyState === "loading") {{
29 document.addEventListener("DOMContentLoaded", bootstrap);
30 }} else {{
31 bootstrap();
32 }}
33 }})();
34 """.strip()
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days ago