wrolpi/controller/templates/portal.html
Roland 6bea09600e
Hotspot captive portal: welcome page with the WROLPi's address
Devices that join the hotspot probe a fixed plain-HTTP URL to check for
Internet access.  NetworkManager's shared-mode dnsmasq now resolves those
probe hostnames (and `wrolpi`) to the hotspot address via an include the
Controller writes when the hotspot starts, the probes land on the Controller
(port 80), and are redirected to /portal: "This is your WROLPi, its address is
10.42.0.1, open WROLPi / open the Controller".

Only the probe hostnames are hijacked so the hotspot keeps forwarding
everything else when the WROLPi has an uplink.  The include is corrected and
the connection re-activated once if NetworkManager picked a non-default
subnet.  Writing the include is best-effort; the hotspot starts regardless.

`hotspot.captive_portal` (controller.yaml, default true) toggles the probe
redirects and the include; like the other hotspot settings it applies on the
next hotspot start, so saving while the hotspot is up reports
restart_required and both Controller UIs say so.  The status endpoint gains
the hotspot address and portal URL, shown in both UIs.  repair.sh only
creates the include directory so a disabled setting survives upgrades.
Native only: Docker has no hotspot.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 19:09:12 -06:00

69 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to WROLPi</title>
<style>
/* Self-contained: shown inside phone sign-in sheets which load nothing external. */
body {
margin: 0;
padding: 2rem 1.25rem;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #1a1a2e;
color: #f0f0f0;
text-align: center;
}
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
p { margin: 0.5rem 0; line-height: 1.4; }
.muted { color: #b0b0c0; font-size: 0.95rem; }
.address {
font-family: ui-monospace, Menlo, Consolas, monospace;
font-size: 2.4rem;
font-weight: 700;
margin: 1.25rem 0;
word-break: break-all;
user-select: all;
-webkit-user-select: all;
}
.btn {
display: block;
box-sizing: border-box;
width: 100%;
max-width: 22rem;
margin: 0.75rem auto;
padding: 0.9rem 1rem;
border-radius: 8px;
font-size: 1.1rem;
font-weight: 600;
text-decoration: none;
color: #fff;
background: #6c4fbb;
}
.btn.secondary { background: #2f2f4a; }
.note {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid #333;
}
</style>
</head>
<body>
<h1>This is your WROLPi</h1>
<p class="muted">You are connected to the <strong>{{ ssid }}</strong> hotspot.</p>
<p>The address of this WROLPi is</p>
<div class="address">{{ ip }}</div>
<a class="btn" href="https://{{ ip }}/">Open WROLPi</a>
<a class="btn secondary" href="https://{{ ip }}/controller/">Open the Controller</a>
<div class="note muted">
<p>If these buttons do nothing, close this window and open your browser to
<strong>https://{{ ip }}</strong>.</p>
<p>Your browser will warn about the certificate the first time. That is expected for an
offline WROLPi; continue to the site.</p>
<p>This hotspot does not provide Internet access.</p>
</div>
</body>
</html>