diff --git a/portal.go b/portal.go index 1e32a3c..0a21663 100644 --- a/portal.go +++ b/portal.go @@ -182,6 +182,10 @@ func (p *proxyHandler) handlePortal(w http.ResponseWriter, r *http.Request) { p.handleMobilePAC(w, r) return } + if r.URL.Path == "/qr.png" { + p.handleQR(w, r) + return + } if r.URL.Path == "/" || r.URL.Path == "/setup" { p.handleSetup(w, r) return @@ -199,6 +203,18 @@ func (p *proxyHandler) handlePAC(w http.ResponseWriter, r *http.Request) { pacTmpl.Execute(w, struct{ ProxyHost string }{parsed.Host}) } +func (p *proxyHandler) handleQR(w http.ResponseWriter, r *http.Request) { + png, err := qrcode.Encode(p.httpOrigin, qrcode.Medium, 256) + if err != nil { + http.Error(w, "failed to generate QR code", http.StatusInternalServerError) + return + } + w.Header().Set("Content-Type", "image/png") + w.Header().Set("Cache-Control", "public, max-age=3600") + w.WriteHeader(http.StatusOK) + w.Write(png) +} + func (p *proxyHandler) handleMobilePAC(w http.ResponseWriter, r *http.Request) { parsed, err := url.Parse(p.httpOrigin) if err != nil { diff --git a/portal_https.go b/portal_https.go index 3c38b4f..baee8e8 100644 --- a/portal_https.go +++ b/portal_https.go @@ -40,6 +40,10 @@ func (h *portalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.proxy.handleMobilePAC(w, r) return } + if r.URL.Path == "/qr.png" { + h.proxy.handleQR(w, r) + return + } if r.URL.Path == "/setup" { h.proxy.handleSetup(w, r) return diff --git a/static/setup.html b/static/setup.html index 5c14e23..44e5881 100644 --- a/static/setup.html +++ b/static/setup.html @@ -32,7 +32,6 @@ border-radius: 3px; font-size: 0.9em; } - .section { border-top: 1px solid #eee; padding-top: 1rem; margin-top: 1rem; } .card { background: #f8fafc; border: 1px solid #e2e8f0; @@ -78,6 +77,24 @@ color: #666; margin-top: 0.5rem; } + details { + border-top: 1px solid #eee; + padding-top: 1rem; + margin-top: 1rem; + } + details:first-of-type { + border-top: none; + padding-top: 0; + margin-top: 0.5rem; + } + summary { + font-size: 1.1rem; + font-weight: 600; + cursor: pointer; + padding: 0.25rem 0; + } + summary:hover { color: #2563eb; } + details[open] summary { margin-bottom: 0.5rem; }
@@ -100,8 +117,8 @@Follow the instructions for your platform:
-Menu paths vary by manufacturer (Samsung, Pixel, etc.).
-sudo cp ublproxy-ca.crt /usr/local/share/ca-certificates/sudo update-ca-certificatesPAC URL:
- Chromium-based browsers use the system proxy settings. Configure the PAC URL at the OS level, or launch with:
- Mobile devices (iOS/Android) use a separate PAC URL because they don't support HTTPS proxy connections:
-
- Mobile devices (iOS/Android) use a separate PAC URL because they don't support HTTPS proxy connections:
+
- Some manufacturers label this setting differently. Look for proxy settings within your Wi-Fi network configuration.
-The desktop PAC file routes traffic through the encrypted HTTPS proxy.