const minisrv_service_file = true; const WTVAdmin = require(classPath + "/WTVAdmin.js"); const wtva = new WTVAdmin(minisrv_config, session_data, service_name); const auth = wtva.isAuthorized(); if (auth === true) { let result, ssid, password; if (request_headers.Authorization) { const authheader = request_headers.Authorization.split(' '); if (authheader[0] === "Basic") { password = Buffer.from(authheader[1], 'base64').toString(); if (password) password = password.split(':')[1]; } } if (wtva.checkPassword(password)) { if (request_headers.query.ssid) { ssid = request_headers.query.ssid.toLowerCase(); result = wtva.banSSID(ssid, socket.ssid); } headers = `200 OK Content-Type: text/html wtv-expire-all: wtv-admin:/ban`; if (ssid) { headers += "\nwtv-noback-all: wtv-admin:/ban"; } data = `
Ban an SSID` if (request_headers.query.ssid) { if (result === wtva.REASON_SELF) { data += "Cannot ban yourself." } else { if (result === wtva.REASON_EXISTS) { data += "SSID " + request_headers.query.ssid + " is already in the ban list. "; } else if (result === wtva.SUCCESS) { reloadConfig(); data += "SSID " + request_headers.query.ssid + " added to the ban list. "; } else { data += "Unexpected response "+result.toString()+". "; } } } data += ` | ||