This commit is contained in:
2025-06-09 08:59:44 +02:00
parent 9081853a6f
commit f984a5c241
+9 -2
View File
@@ -48,9 +48,16 @@ router.get("/enable", async (req, res) => {
router.delete("/remove", async (req, res) => { router.delete("/remove", async (req, res) => {
logger.info(`${req.method}: "${req.url}" => ${req.get("User-Agent")}`); logger.info(`${req.method}: "${req.url}" => ${req.get("User-Agent")}`);
if (req.query["element"]) { var element = req.query["element"];
if (element) {
try { try {
fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, req.query["element"])); fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, element));
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");
if (selected_map_name == element) {
fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"));
}
}
res.status(200).send(); res.status(200).send();
} catch (error) { } catch (error) {
res.status(500).send(); res.status(500).send();