@samitouri / QOSami-HFS / commits / 97edcd08

fix: (regression 0.50.0) geo firewall remained active even after disabling geo

Massimo Melina committed Jan 2, 2024 at 11:22 UTC 97edcd0828b94e4607b4f375b628979931e69fc6
1 file changed +1 -1
src/geo.ts
+1 -1
@@ -17,7 +17,7 @@ setInterval(checkFiles, DAY) // keep updated at run-time
17 export const ip2country = _.memoize((ip: string) => ip2location.getCountryShortAsync(ip).then(v => v === '-' ? '' : v, () => ''))
18
19 export const geoFilter: Middleware = async (ctx, next) => {
20 - if (allow.get() !== null && !isLocalHost(ctx)) {
20 + if (enabled.get() && allow.get() !== null && !isLocalHost(ctx)) {
21 const { connection } = ctx.state
22 const country = connection.country ??= await ip2country(ctx.ip)
23 updateConnection(connection, { country })