mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-30 00:39:16 +02:00
Compare commits
10
Commits
e30a08c0a1
...
df63969bc5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df63969bc5
|
||
|
|
b8ae8956b2
|
||
|
|
24a76758c2
|
||
|
|
dfd5fdc27c
|
||
|
|
42e3d55cf4
|
||
|
|
59d7db73f1
|
||
|
|
f8e72ac5b3
|
||
|
|
8e92fd63bd
|
||
|
|
5e54483582
|
||
|
|
1b99b2e5d8
|
@@ -1 +1,2 @@
|
||||
console.log("FM-DX Webserver by Noobish @ FMDX.org and KubaPro010 @ radio95")
|
||||
require('./server/index.js');
|
||||
@@ -18,7 +18,6 @@
|
||||
"express": "5.2.1",
|
||||
"express-session": "1.19.0",
|
||||
"ffmpeg-static": "5.3.0",
|
||||
"figlet": "^1.10.0",
|
||||
"geoip-lite": "^1.4.10",
|
||||
"http": "0.0.1-security",
|
||||
"net": "1.0.2",
|
||||
|
||||
@@ -150,7 +150,7 @@ function handleData(wss, receivedData, rdsWss) {
|
||||
case receivedLine.startsWith('Ss'):
|
||||
processSignal(receivedLine, true, false);
|
||||
break;
|
||||
case receivedLine.startsWith('SS'): // ss? oh no
|
||||
case receivedLine.startsWith('SS'): // ss? germany mentioned?
|
||||
processSignal(receivedLine, true, true);
|
||||
break;
|
||||
case receivedLine.startsWith('SM'):
|
||||
|
||||
+6
-11
@@ -14,7 +14,7 @@ const storage = require('./storage');
|
||||
const tunerProfiles = require('./tuner_profiles');
|
||||
const { logInfo, logs } = require('./console');
|
||||
const dataHandler = require('./datahandler');
|
||||
const serverList = require('./server_list');
|
||||
const serverListUpdate = require('./server_list');
|
||||
|
||||
// Endpoints
|
||||
router.get('/', (req, res) => {
|
||||
@@ -246,12 +246,7 @@ router.get('/addToBanlist', (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const ipAddress = req.query.ip;
|
||||
const location = 'Unknown';
|
||||
const date = Date.now();
|
||||
const reason = req.query.reason;
|
||||
|
||||
userBanData = [ipAddress, location, date, reason];
|
||||
userBanData = [req.query.ip, 'Unknown', Date.now(), req.query.reason];
|
||||
|
||||
if (typeof serverConfig.webserver.banlist !== 'object') serverConfig.webserver.banlist = [];
|
||||
|
||||
@@ -286,7 +281,7 @@ router.post('/saveData', (req, res) => {
|
||||
let firstSetup;
|
||||
if(req.session.isAdminAuthenticated || !configExists()) {
|
||||
configUpdate(data);
|
||||
serverList.update();
|
||||
serverListUpdate.update();
|
||||
|
||||
if(!configExists()) firstSetup = true;
|
||||
logInfo('Server config changed successfully.');
|
||||
@@ -327,7 +322,8 @@ router.get('/static_data', (req, res) => {
|
||||
rdsTimeout: serverConfig.webserver.rdsTimeout || 0,
|
||||
tunerName: serverConfig.identification.tunerName || '',
|
||||
tunerDesc: serverConfig.identification.tunerDesc || '',
|
||||
ant: serverConfig.antennas || {}
|
||||
ant: serverConfig.antennas || {},
|
||||
fork: "radio95"
|
||||
});
|
||||
});
|
||||
|
||||
@@ -441,8 +437,7 @@ router.get('/tunnelservers', async (req, res) => {
|
||||
const servers = [
|
||||
{ value: "eu", host: "eu.fmtuner.org", label: "Europe" },
|
||||
{ value: "us", host: "us.fmtuner.org", label: "Americas" },
|
||||
{ value: "sg", host: "sg.fmtuner.org", label: "Asia & Oceania" },
|
||||
{ value: "pldx", host: "pldx.duckdns.org", label: "Poland (k201)" },
|
||||
{ value: "sg", host: "sg.fmtuner.org", label: "Asia & Oceania" }
|
||||
];
|
||||
|
||||
const results = await Promise.all(
|
||||
|
||||
+4
-12
@@ -1,18 +1,10 @@
|
||||
const terminalWidth = require('readline').createInterface({input: process.stdin, output: process.stdout}).output.columns;
|
||||
|
||||
console.log('\x1b[32m' + require('figlet').textSync("FM-DX Webserver"));
|
||||
console.log('\x1b[2mby (Noobish @ \x1b[4mFMDX.org\x1b[0m\x1b[32m\x1b[2m) + KubaPro010\x1b[0m');
|
||||
console.log("v" + require('../package.json').version)
|
||||
console.log('\x1b[90m' + '─'.repeat(terminalWidth - 1) + '\x1b[0m');
|
||||
|
||||
const { serverConfig } = require('./server_config');
|
||||
const tunnel = require('./tunnel');
|
||||
tunnel.download();
|
||||
|
||||
require('./stream/index');
|
||||
require("./device");
|
||||
|
||||
require('./stream/index');
|
||||
const startServer = require("./web");
|
||||
const { serverConfig } = require('./server_config');
|
||||
|
||||
{
|
||||
const helpers = require('./helpers');
|
||||
@@ -20,7 +12,7 @@ const startServer = require("./web");
|
||||
if (plugins.length > 0) setTimeout(helpers.startPluginsWithDelay, 3000, plugins, 3000);
|
||||
}
|
||||
|
||||
startServer(serverConfig.webserver.webserverIp === '0.0.0.0' ? 'localhost' : serverConfig.webserver.webserverIp);
|
||||
require("./web")(serverConfig.webserver.webserverIp);
|
||||
|
||||
tunnel.connect();
|
||||
require('./server_list').update();
|
||||
require('./server_list')();
|
||||
+13
-5
@@ -23,8 +23,11 @@ function parsePluginConfig(filePath) {
|
||||
|
||||
if (pluginConfig.frontEndPath) {
|
||||
const sourcePath = path.join(path.dirname(filePath), pluginConfig.frontEndPath);
|
||||
const destinationDir = path.join(__dirname, '../web/js/plugins', path.dirname(pluginConfig.frontEndPath));
|
||||
|
||||
const destinationDir = path.join(
|
||||
__dirname,
|
||||
'../web/js/plugins',
|
||||
path.relative(pluginsDir, path.dirname(sourcePath))
|
||||
);
|
||||
// Check if the source path exists
|
||||
if (!fs.existsSync(sourcePath)) {
|
||||
console.error(`Error: source path ${sourcePath} does not exist.`);
|
||||
@@ -77,9 +80,14 @@ if (process.platform === 'win32') {
|
||||
|
||||
const pluginConfigs = [];
|
||||
readJSFiles(pluginsDir).forEach(file => {
|
||||
const filePath = path.join(pluginsDir, file);
|
||||
const config = parsePluginConfig(filePath);
|
||||
if (Object.keys(config).length > 0) pluginConfigs.push(config);
|
||||
var filePath = path.join(pluginsDir, file);
|
||||
const dir = fs.statSync(filePath).isDirectory();
|
||||
if(dir) filePath = path.join(pluginsDir, file, file);
|
||||
|
||||
var config = parsePluginConfig(filePath);
|
||||
if(dir) config = {...config, prefix: `${file}/`}
|
||||
else config = {...config, prefix: ""}
|
||||
pluginConfigs.push(config);
|
||||
});
|
||||
|
||||
module.exports = pluginConfigs;
|
||||
|
||||
@@ -94,7 +94,7 @@ let serverConfig = {
|
||||
enabled: false,
|
||||
username: "",
|
||||
token: "",
|
||||
region: "pldx",
|
||||
region: "eu",
|
||||
lowLatencyMode: false,
|
||||
subdomain: "",
|
||||
httpName: "",
|
||||
|
||||
@@ -81,4 +81,4 @@ function update() {
|
||||
timeoutID = setInterval(sendKeepalive, 5 * 60 * 1000);
|
||||
}
|
||||
|
||||
module.exports.update = update;
|
||||
module.exports = update;
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ async function connect() {
|
||||
|
||||
const cfg = ejs.render(frpcConfigTemplate, {
|
||||
cfg: serverConfig.tunnel,
|
||||
host: serverConfig.tunnel.community.enabled ? serverConfig.tunnel.community.host : ((serverConfig.tunnel.region == "pldx") ? "pldx.duckdns.org" : (serverConfig.tunnel.region + ".fmtuner.org")),
|
||||
host: serverConfig.tunnel.community.enabled ? serverConfig.tunnel.community.host : (serverConfig.tunnel.region + ".fmtuner.org"),
|
||||
server: {
|
||||
port: serverConfig.webserver.webserverPort
|
||||
}
|
||||
|
||||
+3
-4
@@ -420,12 +420,12 @@
|
||||
<p>Any compatible <strong>.js</strong> plugin, which is in the "plugins" folder, will be listed here.<br>
|
||||
Click on the individual plugins to enable/disable them.</p>
|
||||
<select id="plugins" class="multiselect" multiple>
|
||||
<% plugins.forEach(function(plugin) {
|
||||
<% plugins.forEach(function(plugin) {
|
||||
if (plugin.frontEndPath) { %>
|
||||
<option data-name="<%= plugin.frontEndPath %>" title="<%= plugin.name %> by <%= plugin.author %> [v<%= plugin.version %>]">
|
||||
<option data-name="<%= plugin.prefix %><%= plugin.frontEndPath %>" title="<%= plugin.name %> by <%= plugin.author %> [v<%= plugin.version %>]">
|
||||
<%= plugin.name %> by <%= plugin.author %> [v<%= plugin.version %>]
|
||||
</option>
|
||||
<% }
|
||||
<% }
|
||||
}); %>
|
||||
</select><br><br>
|
||||
<a href="https://github.com/NoobishSVK/fm-dx-webserver/wiki/Plugin-List" target="_blank">Download new plugins here!</a>
|
||||
@@ -685,7 +685,6 @@
|
||||
{ value: 'eu', label: 'Europe' },
|
||||
{ value: 'us', label: 'Americas' },
|
||||
{ value: 'sg', label: 'Asia & Oceania' },
|
||||
{ value: 'pldx', label: 'Poland (k201)' },
|
||||
]
|
||||
}) %>
|
||||
<%- include('_components', {component: 'text', cssClass: 'w-150 br-15', placeholder: '', label: 'Username', id: 'tunnel-username'}) %>
|
||||
|
||||
Reference in New Issue
Block a user