Gateway link: handle trailing slash in gateway_public_url; bump 0.4.7
This commit is contained in:
@@ -54,7 +54,7 @@ To open the gateway UI in a separate tab reliably:
|
|||||||
- Set a **fixed** `gateway_token` (required when `gateway_bind=lan`)
|
- Set a **fixed** `gateway_token` (required when `gateway_bind=lan`)
|
||||||
|
|
||||||
2) Tell the add-on what URL to open:
|
2) Tell the add-on what URL to open:
|
||||||
- Set `gateway_public_url` to a base URL that the browser can reach.
|
- Set `gateway_public_url` to a base URL that the browser can reach (recommended: **no trailing slash**).
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- LAN only: `http://homeassistant.local:18789` (or `http://192.168.1.10:18789`)
|
- LAN only: `http://homeassistant.local:18789` (or `http://192.168.1.10:18789`)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Moltbot Assistant
|
name: Moltbot Assistant
|
||||||
version: "0.4.6"
|
version: "0.4.7"
|
||||||
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/MoltBotHomeAssistant
|
url: https://github.com/techartdev/MoltBotHomeAssistant
|
||||||
@@ -39,6 +39,7 @@ options:
|
|||||||
gateway_token: ""
|
gateway_token: ""
|
||||||
|
|
||||||
# Public base URL for opening the Gateway Web UI in a new tab (not embedded).
|
# Public base URL for opening the Gateway Web UI in a new tab (not embedded).
|
||||||
|
# Recommended: NO trailing slash.
|
||||||
# Example: "https://example.duckdns.org:12345" or "http://192.168.1.10:18789"
|
# Example: "https://example.duckdns.org:12345" or "http://192.168.1.10:18789"
|
||||||
gateway_public_url: ""
|
gateway_public_url: ""
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ http {
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<h2 style="margin:0 0 8px 0">Moltbot Assistant</h2>
|
<h2 style="margin:0 0 8px 0">Moltbot Assistant</h2>
|
||||||
<div class="row" style="margin-bottom:6px">
|
<div class="row" style="margin-bottom:6px">
|
||||||
<a class="btn" href="__GATEWAY_PUBLIC_URL__/?token=__GATEWAY_TOKEN__" target="_blank" rel="noopener noreferrer">Open Gateway Web UI</a>
|
<a class="btn" href="__GATEWAY_PUBLIC_URL____GW_PUBLIC_URL_PATH__?token=__GATEWAY_TOKEN__" target="_blank" rel="noopener noreferrer">Open Gateway Web UI</a>
|
||||||
<a class="btn secondary" href="./terminal/" target="_self">Open Terminal (full page)</a>
|
<a class="btn secondary" href="./terminal/" target="_self">Open Terminal (full page)</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="muted">
|
<div class="muted">
|
||||||
|
|||||||
@@ -299,8 +299,12 @@ tpl = Path('/etc/nginx/nginx.conf.tpl').read_text()
|
|||||||
token = os.environ.get('GW_TOKEN','')
|
token = os.environ.get('GW_TOKEN','')
|
||||||
public_url = os.environ.get('GW_PUBLIC_URL','')
|
public_url = os.environ.get('GW_PUBLIC_URL','')
|
||||||
|
|
||||||
|
# Normalize gateway_public_url for building the link: ensure there is exactly one slash
|
||||||
|
# between base URL and path. We keep the displayed base as-is, but compute a safe suffix.
|
||||||
|
# If base ends with '/', use empty suffix. Otherwise use '/'.
|
||||||
conf = tpl.replace('__GATEWAY_TOKEN__', token)
|
conf = tpl.replace('__GATEWAY_TOKEN__', token)
|
||||||
conf = conf.replace('__GATEWAY_PUBLIC_URL__', public_url)
|
conf = conf.replace('__GATEWAY_PUBLIC_URL__', public_url)
|
||||||
|
conf = conf.replace('__GW_PUBLIC_URL_PATH__', '' if public_url.endswith('/') else '/')
|
||||||
|
|
||||||
Path('/etc/nginx/nginx.conf').write_text(conf)
|
Path('/etc/nginx/nginx.conf').write_text(conf)
|
||||||
PY
|
PY
|
||||||
|
|||||||
Reference in New Issue
Block a user