You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
ip fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const https = require('https');
|
const http = require('http');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const dataHandler = require('./datahandler');
|
const dataHandler = require('./datahandler');
|
||||||
@@ -57,7 +57,7 @@ function authenticateWithXdrd(client, salt, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleConnect(clientIp, currentUsers, ws) {
|
function handleConnect(clientIp, currentUsers, ws) {
|
||||||
https.get(`https://ipinfo.io/${clientIp}/json`, (response) => {
|
http.get(`https://ip-api.com/json/${clientIp}/`, (response) => {
|
||||||
let data = '';
|
let data = '';
|
||||||
|
|
||||||
response.on('data', (chunk) => {
|
response.on('data', (chunk) => {
|
||||||
@@ -70,7 +70,7 @@ function handleConnect(clientIp, currentUsers, ws) {
|
|||||||
const options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' };
|
const options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' };
|
||||||
const connectionTime = new Date().toLocaleString([], options);
|
const connectionTime = new Date().toLocaleString([], options);
|
||||||
|
|
||||||
if (locationInfo.org?.includes("AS205016 HERN Labs AB")) { // anti opera VPN block
|
if (locationInfo.as?.includes("AS205016 HERN Labs AB")) { // anti opera VPN block
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ function handleConnect(clientIp, currentUsers, ws) {
|
|||||||
storage.connectedUsers.push(userData);
|
storage.connectedUsers.push(userData);
|
||||||
consoleCmd.logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m`);
|
consoleCmd.logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m`);
|
||||||
} else {
|
} else {
|
||||||
const userLocation = `${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`;
|
const userLocation = `${locationInfo.city}, ${locationInfo.regionName}, ${locationInfo.countryCode}`;
|
||||||
const userData = { ip: clientIp, location: userLocation, time: connectionTime, instance: ws };
|
const userData = { ip: clientIp, location: userLocation, time: connectionTime, instance: ws };
|
||||||
storage.connectedUsers.push(userData);
|
storage.connectedUsers.push(userData);
|
||||||
consoleCmd.logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m Location: ${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`);
|
consoleCmd.logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m Location: ${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const europe_programmes = [
|
|||||||
"Serious Classical", "Other Music", "Weather", "Finance",
|
"Serious Classical", "Other Music", "Weather", "Finance",
|
||||||
"Children's Programmes", "Social Affairs", "Religion", "Phone-in",
|
"Children's Programmes", "Social Affairs", "Religion", "Phone-in",
|
||||||
"Travel", "Leisure", "Jazz Music", "Country Music", "National Music",
|
"Travel", "Leisure", "Jazz Music", "Country Music", "National Music",
|
||||||
"Oldies Music", "Folk Music", "Documentary", "Alarm Test"
|
"Oldies Music", "Folk Music", "Documentary", "Alarm Test", "Alarm"
|
||||||
];
|
];
|
||||||
|
|
||||||
const usa_programmes = [
|
const usa_programmes = [
|
||||||
|
|||||||
Reference in New Issue
Block a user