change some plugin stuff and allow to hook into tx_search

This commit is contained in:
2026-04-06 21:55:40 +02:00
parent 9ef820d699
commit 501fe0d443
4 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ require("./device");
{
const helpers = require('./helpers');
const plugins = helpers.findServerFiles(serverConfig.plugins);
if (plugins.length > 0) setTimeout(helpers.startPluginsWithDelay, 4000, plugins, 3000);
if (plugins.length > 0) setTimeout(helpers.startPluginsWithDelay, 3000, plugins, 3000);
}
require('./stream/index');
+7 -1
View File
@@ -14,7 +14,13 @@ function parsePluginConfig(filePath) {
const pluginExports = require(filePath);
Object.assign(pluginConfig, pluginExports.pluginConfig);
// Check if pluginConfig has frontEndPath defined
if(pluginConfig.server_embedded) {
setTimeout(function() {
consoleCmd.logInfo(`Server plugin ${pluginConfig.name} ${pluginConfig.version} initialized successfully.`);
}, 500)
return pluginConfig;
}
if (pluginConfig.frontEndPath) {
const sourcePath = path.join(path.dirname(filePath), pluginConfig.frontEndPath);
const destinationDir = path.join(__dirname, '../web/js/plugins', path.dirname(pluginConfig.frontEndPath));
+2 -1
View File
@@ -2,5 +2,6 @@ let connectedUsers = [];
let chatHistory = [];
let websocket_delegation = new Map();
var ctl_output;
var tx_search_hook = {};
module.exports = { connectedUsers, chatHistory, websocket_delegation, ctl_output };
module.exports = { connectedUsers, chatHistory, websocket_delegation, ctl_output, tx_search_hook };
+3 -1
View File
@@ -3,6 +3,7 @@ if(!configExists()) return;
const fetch = require('node-fetch');
const consoleCmd = require('./console');
const storage = require('./storage');
let localDb = {};
let nextLocalDbUpdate = 0;
@@ -217,7 +218,8 @@ async function fetchTx(freq, piCode, rdsPs) {
if (serverConfig.webserver.rdsMode === true) await loadUsStatesGeoJson();
const key = `${freq}|${piCode.toUpperCase()}`;
let rawMatches = piFreqIndex[key] || [];
var rawMatches = piFreqIndex[key] || [];
rawMatches = [...storage.tx_search_hook[key], ...rawMatches];
// Format the results into the same structure as before
let filteredLocations = rawMatches.map(({ station, ...locData }) => ({