OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-booking commits / 9cf749e

Fix CORS for LAN IPs, fix booking page nav prefix variable
- Allow 192.168.x, 10.x, 172.16-31.x origins for LAN access - Fix booking page nav using undefined prefix variable Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9cf749edf568afadc80509fa6316e6641a1482c6
by plankatron <fleeky@gmail.com> · 2026-03-22T18:41:40.000Z

Changed files (2) +9 -3

lib/routes/web.js +1 -1
……@@ -77,7 +77,7 @@ export function registerPublicRoutes (router, server) {
7777 <nav class="nav-bar">
7878 <a href="${server.pathPrefix}/${esc(provider.slug)}" style="text-decoration:none;color:inherit;">&larr; ${esc(provider.displayName)}</a>
7979 <div class="nav-right">
80 <a href="${prefix}/dashboard" class="btn btn-secondary" id="dashboard-link" style="display:none">Dashboard</a>
80 <a href="${server.pathPrefix}/dashboard" class="btn btn-secondary" id="dashboard-link" style="display:none">Dashboard</a>
8181 <button class="btn btn-secondary" id="sign-in-btn">Sign In</button>
8282 </div>
8383 </nav>
lib/server.js +8 -2
……@@ -130,8 +130,14 @@ export class HyperBookingServer {
130130
131131 isAllowedOrigin (origin) {
132132 if (!origin) return true
133 const allowed = ['http://localhost', 'http://127.0.0.1', 'https://localhost']
134 return allowed.some(a => origin.startsWith(a))
133 // Allow localhost, LAN IPs, and any same-host origin
134 if (origin.startsWith('http://localhost')) return true
135 if (origin.startsWith('http://127.0.0.1')) return true
136 if (origin.startsWith('https://localhost')) return true
137 if (origin.match(/^https?:\/\/192\.168\./)) return true
138 if (origin.match(/^https?:\/\/10\./)) return true
139 if (origin.match(/^https?:\/\/172\.(1[6-9]|2\d|3[01])\./)) return true
140 return false
135141 }
136142
137143 // ---- Helpers for route handlers ----