Map socket comm

This commit is contained in:
2025-06-12 11:15:28 +02:00
parent de15de87a9
commit 5fe201182a
5 changed files with 151 additions and 48 deletions
+14 -1
View File
@@ -5,6 +5,18 @@ const uuid = require("uuid");
const map_conf = require("../config/map.conf");
const logger = require("./logger.util");
// Returns map filename or ""
function getSelectedMap() {
var selected_map_name = "";
// Check if a map has been selected to show it
if (fs.existsSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"))) {
selected_map_name = fs.readFileSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"), "utf-8");
}
return(selected_map_name);
}
// Creates new map
async function addMap(filename, meta, throttle, motor) {
var total = "";
@@ -201,5 +213,6 @@ module.exports = {
parseMapJson,
mapExists,
updateMap,
addMap
addMap,
getSelectedMap
};