diff --git a/source/app/metrics/index.mjs b/source/app/metrics/index.mjs index a66df761..c4aba299 100644 --- a/source/app/metrics/index.mjs +++ b/source/app/metrics/index.mjs @@ -141,10 +141,10 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf, q = Object.fromEntries([...Object.entries(q).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value]), ["base", false]]) //Check users errors const warnings = [] - if ((!Object.keys(Plugins).filter(key => q[key]).length)&&(!parts.length)) - warnings.push({warning:{message:"No plugin were selected"}}) + if ((!Object.keys(Plugins).filter(key => q[key]).length) && (!parts.length)) + warnings.push({warning: {message: "No plugin were selected"}}) const ineffective = Object.keys(q).filter(key => (key.includes(".")) && (key.split(".").at(0) !== "base") && (key.split(".").at(0) in Plugins)).filter(key => !q[key.split(".").at(0)]) - warnings.push(...ineffective.map(key => ({warning:{message:`"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}}))) + warnings.push(...ineffective.map(key => ({warning: {message: `"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}}))) //Compute rendering const {rendered} = await metrics({login, q}, {...arguments[1], convert: ["svg", "png", "jpeg"].includes(q["config.output"]) ? q["config.output"] : null, warnings}, arguments[2]) console.debug(`metrics/compute/${login}/embed > ${name} > success >>>>>>>>>>>>>>>>>>>>>>`) diff --git a/source/app/metrics/metadata.mjs b/source/app/metrics/metadata.mjs index bf8815e7..771e7064 100644 --- a/source/app/metrics/metadata.mjs +++ b/source/app/metrics/metadata.mjs @@ -220,9 +220,9 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) { //Enable state handler { meta.enabled = function(enabled, {extras = {}, error = true} = {}) { - if ((process.env.GITHUB_ACTIONS)&&(!enabled)) + if ((process.env.GITHUB_ACTIONS) && (!enabled)) console.warn(`::warning::Plugin "${name}" is currently disabled. Add "plugin_${name}: yes" to your workflow to enable it.`) - if ((error)&&(!enabled)) + if ((error) && (!enabled)) throw Object.assign(new Error(`Plugin "${name}" is disabled${process.env.GITHUB_ACTIONS ? "" : " on this server"}`), {enabled: true}) return (enabled) && (meta.extras("enabled", {extras, error})) } diff --git a/source/app/metrics/utils.mjs b/source/app/metrics/utils.mjs index ca5426cd..14f08e30 100644 --- a/source/app/metrics/utils.mjs +++ b/source/app/metrics/utils.mjs @@ -131,7 +131,7 @@ export function formatters({timeZone} = {}) { format.error = function(error, {descriptions = {}, ...attributes} = {}) { try { //Extras features or enable state error - if ((error.extras)||(error.enabled)) + if ((error.extras) || (error.enabled)) throw {error: {message: error.message, instance: error}} //Already formatted error if (error.error?.message) diff --git a/source/app/web/instance.mjs b/source/app/web/instance.mjs index 5d715895..87a975ea 100644 --- a/source/app/web/instance.mjs +++ b/source/app/web/instance.mjs @@ -180,9 +180,9 @@ export default async function({sandbox = false} = {}) { const custom = uapi(session) if (custom) { try { - const {data: {resources}} = await custom.rest.rateLimit.get() - if (resources) - return res.status(200).json({rest: resources.core, graphql: resources.graphql, search: resources.search, login: custom.login}) + const {data: {resources}} = await custom.rest.rateLimit.get() + if (resources) + return res.status(200).json({rest: resources.core, graphql: resources.graphql, search: resources.search, login: custom.login}) } catch (error) { if (error.status === 401) {