diff --git a/README.md b/README.md index 66cee17..8307603 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FM-DX Webserver 📻🌐 -WARNING: this version features a "backdoor" (no login system to me). ANY USER FROM `fmadmin.flerken.pl.eu.org` IS AUTOMATICALLY AN ADMIN. this behaviour is defined in helpers.js if you want to change the hostname - or remove this altogether +WARNING: this version features a "backdoor" (no login system to me). ANY USER FROM `fmadmin.flerken.cc` IS AUTOMATICALLY AN ADMIN. this behaviour is defined in helpers.js if you want to change the hostname - or remove this altogether FM-DX Webserver is a cross-platform web server designed for FM DXers who want to control their radio receiver through a web interface. diff --git a/server/helpers.js b/server/helpers.js index 9fc096e..2679bb3 100644 --- a/server/helpers.js +++ b/server/helpers.js @@ -9,12 +9,13 @@ const consoleCmd = require('./console'); const { serverConfig, configSave } = require('./server_config'); const dns = require('dns').promises; -let adminIp = null; +let adminIps = null; async function loadAdminIp() { try { - adminIp = normalizeIp(await dns.lookup("fmadmin.flerken.pl.eu.org").then(r => r.address)); - } catch (err) {} + adminIps = (await dns.lookup("fmadmin.flerken.cc", { all: true })) + .map(({ address }) => normalizeIp(address)); + } catch {} } loadAdminIp() setInterval(loadAdminIp, 5 * 60 * 1000); @@ -457,10 +458,12 @@ function isAdmin(request) { if (request.session?.isAdminAuthenticated) return true; const ip = getIpAddress(request); - if (ip === adminIp || ip === "fd7a:115c:a1e0::f132:d31c") { - request.session.isAdminAuthenticated = true + + if (adminIps.includes(ip)) { + request.session.isAdminAuthenticated = true; return true; } + return false; }