From b1e925a5d811c7a07eb6d83c5b1edcf5d88cd872 Mon Sep 17 00:00:00 2001 From: philc Date: Wed, 26 Feb 2025 08:53:37 +0100 Subject: [PATCH] change cdn/log by cdn/trkret to avoid confusion --- apxtri/models/Wwws.js | 6 +++--- apxtri/routes/trackings.js | 3 ++- apxtri/routes/wwws.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apxtri/models/Wwws.js b/apxtri/models/Wwws.js index 41c891d..c68aae1 100644 --- a/apxtri/models/Wwws.js +++ b/apxtri/models/Wwws.js @@ -35,7 +35,7 @@ Wwws.getwco = (wconame, ctx) => { if ( !fs.existsSync(filereq) || !fs.existsSync(wcoconf) || - !fs.pathExistsSync(`../${ctx.wcotribe}`) + !fs.pathExistsSync(`../${ctx.tribe}`) ) { return { status: 404, @@ -49,11 +49,11 @@ Wwws.getwco = (wconame, ctx) => { //check that all tpl, tpldata, ... are available for this pagename if ( wconame == "tracker" && - !fs.pathExistsSync(`../${ctx.tribe}/objects/wwws/cdn/log`) + !fs.pathExistsSync(`../${ctx.tribe}/objects/wwws/cdn/trkret`) ) { fs.mkdirSync(`../${ctx.tribe}/objects/wwws/cdn/`, { recursive: true }); fs.cpSync( - `../adminapi/objects/wwws/cdn/log`, + `../adminapi/objects/wwws/cdn/trkret`, `../${ctx.tribe}/objects/wwws/cdn/`, { recursive: true } ); diff --git a/apxtri/routes/trackings.js b/apxtri/routes/trackings.js index 6e72519..9c84271 100644 --- a/apxtri/routes/trackings.js +++ b/apxtri/routes/trackings.js @@ -38,6 +38,7 @@ router.post("/newdevice", checkHeaders, async (req, res) => { xalias: req.session.header.xalias, xprofils: req.session.header.xprofils, }; + console.log(req.session.header) if (!fs.pathExistsSync(`../${req.session.header.xtribe}/objects/devices`)) { fs.mkdirSync(`../${req.session.header.xtribe}/objects/devices/itm/`, { recursive: true, @@ -51,7 +52,7 @@ router.post("/newdevice", checkHeaders, async (req, res) => { lastupdate: 0, lastupdatedata: "2025-02-23T09:23:56.266Z", }; - fs.outputFileSync( + fs.outputJSONSync( `../${req.session.header.xtribe}/objects/devices/conf.json`, confdevice ); diff --git a/apxtri/routes/wwws.js b/apxtri/routes/wwws.js index df839dc..0ad71b6 100644 --- a/apxtri/routes/wwws.js +++ b/apxtri/routes/wwws.js @@ -58,6 +58,7 @@ router.get("/getwco/:wconame", (req, res) => { }else{ const getwco=Wwws.getwco(req.params.wconame.replace(/\.js$/,''),req.query) if (getwco.status==200){ + res.set('Content-Type', 'application/javascript'); res.sendFile(getwco.data.file) }else{ res.status(getwco.status).json(getwco);