mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 00:26:29 +00:00
feat(stockholm): add Go backend integration for Stockholm frontend
Implements pkg/service/stockholm with bridge (appSend/runQueue), HTTP proxy, static serving, config URL rewriting, native state persistence, and device discovery. Mounts under a configurable base path (/stockholm by default) with correct http.StripPrefix routing and apiBase-prefixed bridge API routes matching the patched JS window.__stockholmBase calls. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
c64e601df6
commit
6fb999435a
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Patch Stockholm bridge JS files to use window.__stockholmBase for API paths.
|
||||
|
||||
Usage: patch-stockholm-bridge.py <file> [<file> ...]
|
||||
|
||||
Applied once by `make prepare-stockholm`. Idempotent — already-patched files
|
||||
are left unchanged.
|
||||
"""
|
||||
import sys
|
||||
|
||||
REPLACEMENTS = [
|
||||
(
|
||||
'xhr.open("POST", "/api/native/appSend"',
|
||||
'xhr.open("POST", (window.__stockholmBase||"") + "/api/native/appSend"',
|
||||
),
|
||||
(
|
||||
'xhr.open("GET", "/api/native/runQueue',
|
||||
'xhr.open("GET", (window.__stockholmBase||"") + "/api/native/runQueue',
|
||||
),
|
||||
(
|
||||
'var proxyPath = "/api/http-proxy";',
|
||||
'var proxyPath = (window.__stockholmBase||"") + "/api/http-proxy";',
|
||||
),
|
||||
(
|
||||
'return new URL(url, window.location.origin + "/").href;',
|
||||
'return new URL(url, window.location.origin + (window.__stockholmBase || "") + "/").href;',
|
||||
),
|
||||
]
|
||||
|
||||
for path in sys.argv[1:]:
|
||||
try:
|
||||
original = open(path).read()
|
||||
patched = original
|
||||
for old, new in REPLACEMENTS:
|
||||
patched = patched.replace(old, new)
|
||||
if patched != original:
|
||||
open(path, "w").write(patched)
|
||||
except FileNotFoundError:
|
||||
print(f"warning: {path} not found, skipping", file=sys.stderr)
|
||||
Reference in New Issue
Block a user