Update index.mjs

This commit is contained in:
lowlighter
2021-05-18 23:15:31 +02:00
parent da4433692e
commit 19404ef59c

View File

@@ -103,6 +103,8 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
throw new Error("An error occured during embed rendering, dying") throw new Error("An error occured during embed rendering, dying")
return "<p>⚠️ Failed to execute embed function: invalid arguments</p>" return "<p>⚠️ Failed to execute embed function: invalid arguments</p>"
} }
console.debug(`metrics/compute/${login} > embed called with`)
console.debug(q)
let {base} = q let {base} = q
q = {..._q, ...Object.fromEntries(Object.keys(Plugins).map(key => [key, false])), ...Object.fromEntries(conf.settings.plugins.base.parts.map(part => [`base.${part}`, false])), template:"classic", ...q} q = {..._q, ...Object.fromEntries(Object.keys(Plugins).map(key => [key, false])), ...Object.fromEntries(conf.settings.plugins.base.parts.map(part => [`base.${part}`, false])), template:"classic", ...q}
//Translate action syntax to web syntax //Translate action syntax to web syntax
@@ -120,8 +122,6 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
q.config_animations = false q.config_animations = false
} }
q = Object.fromEntries([...Object.entries(q).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value]), ["base", false]]) q = Object.fromEntries([...Object.entries(q).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value]), ["base", false]])
console.debug(`metrics/compute/${login} > embed called with`)
console.debug(q)
//Compute rendering //Compute rendering
const {rendered} = await metrics({login, q}, {...arguments[1], convert:["svg", "png", "jpeg"].includes(q["config.output"]) ? q["config.output"] : null}, arguments[2]) const {rendered} = await metrics({login, q}, {...arguments[1], convert:["svg", "png", "jpeg"].includes(q["config.output"]) ? q["config.output"] : null}, arguments[2])
console.debug(`metrics/compute/${login}/embed > ${name} > success >>>>>>>>>>>>>>>>>>>>>>`) console.debug(`metrics/compute/${login}/embed > ${name} > success >>>>>>>>>>>>>>>>>>>>>>`)