Fix nginx quoting: serve landing page from file; bump add-on to 0.5.6

This commit is contained in:
root
2026-01-31 00:06:01 +02:00
parent 57d3c97779
commit fc34d3d7b8
5 changed files with 75 additions and 60 deletions
+3 -56
View File
@@ -44,64 +44,11 @@ http {
}
# Landing page (shown inside HA Ingress)
# - Shows the web terminal (if enabled)
# - Provides a button to open the Gateway Web UI in a separate tab (not embedded)
# Served as a real HTML file to avoid fragile quoting inside nginx.conf.
location = / {
root /etc/nginx/html;
default_type text/html;
# NOTE: __GATEWAY_PUBLIC_URL__ is configured via add-on option gateway_public_url.
# We keep it flexible because the right URL depends on how the user exposes HA/gateway
# (Nabu Casa, DuckDNS, LAN, etc.).
return 200 '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>OpenClaw Assistant</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;margin:0;padding:16px;background:#0b0f14;color:#e6edf3}
a,button{font:inherit}
.card{max-width:1100px;margin:0 auto;background:#111827;border:1px solid #1f2937;border-radius:12px;padding:16px}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.btn{background:#2563eb;color:white;border:0;border-radius:10px;padding:10px 14px;cursor:pointer;text-decoration:none;display:inline-block}
.btn.secondary{background:#334155}
.muted{color:#9ca3af;font-size:14px}
.term{margin-top:14px;height:70vh;min-height:420px;border:1px solid #1f2937;border-radius:10px;overflow:hidden}
iframe{width:100%;height:100%;border:0;background:black}
code{background:#0b1220;padding:2px 6px;border-radius:6px}
</style>
</head><body>
<div class="card">
<h2 style="margin:0 0 8px 0">OpenClaw Assistant</h2>
<div class="row" style="margin-bottom:6px">
<a class="btn" id="gwbtn" 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>
</div>
<div class="muted" id="gwhint">
Tip: The gateway UI is intentionally opened outside of Ingress to avoid websocket/proxy issues.
Configure <code>gateway_public_url</code> in the add-on options, then complete onboarding in the terminal.
</div>
<script>
(function(){
var publicUrl = '__GATEWAY_PUBLIC_URL__';
var token = '__GATEWAY_TOKEN__';
var btn = document.getElementById('gwbtn');
var hint = document.getElementById('gwhint');
if (!publicUrl || publicUrl === '__GATEWAY_PUBLIC_URL__') {
btn.style.display = 'none';
hint.innerHTML = 'Configure <code>gateway_public_url</code> in the add-on options to enable the external Gateway UI link.';
return;
}
if (!token || token === '__GATEWAY_TOKEN__') {
// Token not known yet (likely before onboarding). Don't show a broken link.
btn.style.display = 'none';
hint.innerHTML = 'Gateway token not found yet. Open the terminal below and run <code>openclaw onboard</code> (or <code>openclaw configure</code>) to finish setup.';
return;
}
})();
</script>
<div class="term">
<iframe src="./terminal/" title="Terminal"></iframe>
</div>
</div>
</body></html>';
try_files /index.html =404;
}
# (Optional) Gateway UI via ingress has been intentionally removed.