From 0370149915507676b063169dd8a412bebf782d7d Mon Sep 17 00:00:00 2001 From: philc Date: Tue, 25 Feb 2025 14:39:04 +0100 Subject: [PATCH] fix copy tracker empty --- apxtri/models/Wwws.js | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/apxtri/models/Wwws.js b/apxtri/models/Wwws.js index 1d5faec..329cbe6 100644 --- a/apxtri/models/Wwws.js +++ b/apxtri/models/Wwws.js @@ -32,19 +32,29 @@ Wwws.getwco = (wconame, ctx) => { */ const filereq = `../${ctx.wcotribe}/objects/wco/${wconame}/${wconame}.js`; const wcoconf = `../${ctx.wcotribe}/objects/wco/itm/${wconame}.json`; - if (!fs.existsSync(filereq) || !fs.existsSync(wcoconf)) { + if ( + !fs.existsSync(filereq) || + !fs.existsSync(wcoconf) || + !fs.pathExistsSync(`../${ctx.wcotribe}`) + ) { return { status: 404, ref: "Wwws", msg: "filedoesnotexist", - data: { js: filereq, wcoconf: wcoconf }, + data: { js: filereq, wcoconf: wcoconf, tribe: ctx.tribe }, }; } //check in ctx.wcotribe if ctx.tribe_ctx.code exist in console.log("@todo don't forget to manage accessright to wco in Wwws"); //check that all tpl, tpldata, ... are available for this pagename - if (wconame=="tracker" && !fs.pathExistsSync(`../${ctx.tribe}/objects/wwws/cdn/log`)){ - fs.cpSync(`../adminapi/objects/wwws/cdn/log`,`../${ctx.tribe}/objects/wwws/cdn/`) + if ( + wconame == "tracker" && + !fs.pathExistsSync(`../${ctx.tribe}/objects/wwws/cdn/log`) + ) { + fs.cpSync( + `../adminapi/objects/wwws/cdn/log`, + `../${ctx.tribe}/objects/wwws/cdn/` + ); } const webconf = `../${ctx.tribe}/objects/wwws/itm/${ctx.xapp}.json`; const webpageinit = { @@ -72,15 +82,15 @@ Wwws.getwco = (wconame, ctx) => { }; webpageinit.pages[ctx.pagename] = { version: 1, - language: ["en"], - profils: ["anonymous"], - itms: {}, - tpl: {}, - options: {}, - ref: {}, - schema: [], - tpldata: {}, - wco:{} + language: ["en"], + profils: ["anonymous"], + itms: {}, + tpl: {}, + options: {}, + ref: {}, + schema: [], + tpldata: {}, + wco: {}, }; const wcoinfo = fs.readJSONSync(wcoconf); const webpage = fs.existsSync(webconf)