Fix ingress ws URL override (gatewayUrl) + bump 0.4.2

This commit is contained in:
root
2026-01-30 13:25:15 +02:00
parent 836e9fdc78
commit 83f574e01f
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: Moltbot Assistant name: Moltbot Assistant
version: "0.4.1" version: "0.4.2"
slug: moltbot_assistant slug: moltbot_assistant
description: Run Moltbot Assistant (Clawdbot-compatible) as a Home Assistant add-on. description: Run Moltbot Assistant (Clawdbot-compatible) as a Home Assistant add-on.
url: https://github.com/techartdev/ClawdHAAddOn url: https://github.com/techartdev/ClawdHAAddOn
+5 -1
View File
@@ -55,6 +55,10 @@ http {
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
# Debug: expose the ingress path nginx sees (from HA) to the browser.
# Remove once confirmed.
add_header X-Debug-Ingress-Path $http_x_ingress_path always;
# Inject the correct WS URL when running behind HA Ingress. # Inject the correct WS URL when running behind HA Ingress.
# HA provides a per-session ingress proxy path in X-Ingress-Path (usually /api/hassio_ingress/<token>). # HA provides a per-session ingress proxy path in X-Ingress-Path (usually /api/hassio_ingress/<token>).
# The UI loaded at /hassio/ingress/<slug> cannot be used as a WS endpoint on some setups, # The UI loaded at /hassio/ingress/<slug> cannot be used as a WS endpoint on some setups,
@@ -66,7 +70,7 @@ http {
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
sub_filter_types text/html; sub_filter_types text/html;
sub_filter_once on; sub_filter_once on;
sub_filter '</head>' '<script>(function(){try{var p="__INGRESS_PATH__"; if(p && p!=="__INGRESS_PATH__"){ var ws=(location.protocol==="https:"?"wss://":"ws://")+location.host+p+"/"; try{var k="clawdbot.control.settings.v1"; var s=localStorage.getItem(k); var o=s?JSON.parse(s):{}; o.url=ws; localStorage.setItem(k, JSON.stringify(o));}catch(e){} } }catch(e){} })();</script></head>'; sub_filter '</head>' '<script>(function(){try{var p="__INGRESS_PATH__"; if(p && p!=="__INGRESS_PATH__"){ var ws=(location.protocol==="https:"?"wss://":"ws://")+location.host+p+"/"; var k="clawdbot.control.settings.v1"; try{var s=localStorage.getItem(k); var o=s?JSON.parse(s):{}; if(o.gatewayUrl!==ws){ o.gatewayUrl=ws; localStorage.setItem(k, JSON.stringify(o)); location.reload(); } }catch(e){} } }catch(e){} })();</script></head>';
sub_filter '__INGRESS_PATH__' "$http_x_ingress_path"; sub_filter '__INGRESS_PATH__' "$http_x_ingress_path";
} }