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 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)