fix copy tracker empty

This commit is contained in:
philc 2025-02-25 14:39:04 +01:00
parent 2ec7ea2720
commit 0370149915

View File

@ -32,19 +32,29 @@ Wwws.getwco = (wconame, ctx) => {
*/ */
const filereq = `../${ctx.wcotribe}/objects/wco/${wconame}/${wconame}.js`; const filereq = `../${ctx.wcotribe}/objects/wco/${wconame}/${wconame}.js`;
const wcoconf = `../${ctx.wcotribe}/objects/wco/itm/${wconame}.json`; 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 { return {
status: 404, status: 404,
ref: "Wwws", ref: "Wwws",
msg: "filedoesnotexist", 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 //check in ctx.wcotribe if ctx.tribe_ctx.code exist in
console.log("@todo don't forget to manage accessright to wco in Wwws"); console.log("@todo don't forget to manage accessright to wco in Wwws");
//check that all tpl, tpldata, ... are available for this pagename //check that all tpl, tpldata, ... are available for this pagename
if (wconame=="tracker" && !fs.pathExistsSync(`../${ctx.tribe}/objects/wwws/cdn/log`)){ if (
fs.cpSync(`../adminapi/objects/wwws/cdn/log`,`../${ctx.tribe}/objects/wwws/cdn/`) 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 webconf = `../${ctx.tribe}/objects/wwws/itm/${ctx.xapp}.json`;
const webpageinit = { const webpageinit = {
@ -72,15 +82,15 @@ Wwws.getwco = (wconame, ctx) => {
}; };
webpageinit.pages[ctx.pagename] = { webpageinit.pages[ctx.pagename] = {
version: 1, version: 1,
language: ["en"], language: ["en"],
profils: ["anonymous"], profils: ["anonymous"],
itms: {}, itms: {},
tpl: {}, tpl: {},
options: {}, options: {},
ref: {}, ref: {},
schema: [], schema: [],
tpldata: {}, tpldata: {},
wco:{} wco: {},
}; };
const wcoinfo = fs.readJSONSync(wcoconf); const wcoinfo = fs.readJSONSync(wcoconf);
const webpage = fs.existsSync(webconf) const webpage = fs.existsSync(webconf)