@samitouri / QOSami-HFS / commits / c1cc64f4

fix: admin/internet: "Accept requests only using domain" was not working

Massimo Melina committed Dec 23, 2023 at 19:42 UTC c1cc64f47cc490af3c0289e560cd5a4e308b1df5
2 files changed +2 -2
src/listen.ts
+1 -1
@@ -25,7 +25,7 @@ let httpsSrv: undefined | http.Server & ServerExtra
25 const openBrowserAtStart = defineConfig('open_browser_at_start', !DEV)
26
27 export const baseUrl = defineConfig('base_url', '',
28 - x => /\/\/[^\/]+/.exec(x)?.[1]) // compiled is host only
28 + x => /(?<=\/\/)[^\/]+/.exec(x)?.[0]) // compiled is host only
29
30 export function getBaseUrlOrDefault() {
31 return baseUrl.get() || defaultBaseUrl.get()
src/middlewares.ts
+1 -1
@@ -204,7 +204,7 @@ export const someSecurity: Koa.Middleware = async (ctx, next) => {
204 catch {
205 return ctx.status = HTTP_FOOL
206 }
207 - if (forceBaseUrl.get() && !isLocalHost(ctx) && ctx.host === baseUrl.compiled())
207 + if (forceBaseUrl.get() && !isLocalHost(ctx) && ctx.host !== baseUrl.compiled())
208 return disconnect(ctx)
209 return next()
210 }