Add option plugin_languages_details (#87)

This commit is contained in:
Simon Lecoq
2021-01-31 12:29:50 +01:00
committed by GitHub
parent 5e57107278
commit bf1453c776
8 changed files with 91 additions and 18 deletions

View File

@@ -14,9 +14,9 @@
return (postprocess.skip({login, data}), {})
//Base parts (legacy handling for web instance)
const defaulted = ("base" in q) ? !!q.base : true
const defaulted = ("base" in q) ? legacy.converter(q.base) ?? true : true
for (const part of conf.settings.plugins.base.parts)
data.base[part] = `base.${part}` in q ? !!q[ `base.${part}`] : defaulted
data.base[part] = `base.${part}` in q ? legacy.converter(q[ `base.${part}`]) : defaulted
//Iterate through account types
for (const account of ["user", "organization"]) {
@@ -108,4 +108,16 @@
packages:{totalCount:0},
})
}
}
//Legacy functions
const legacy = {
converter(value) {
if (/^(?:[Tt]rue|[Oo]n|[Yy]es|1)$/.test(value))
return true
if (/^(?:[Ff]alse|[Oo]ff|[Nn]o|0)$/.test(value))
return false
if (Number.isFinite(Number(value)))
return !!(Number(value))
}
}