Add oidc icon and name to public api for login page
This commit is contained in:
parent
94aa6b3711
commit
80a35d6ef0
|
@ -102,13 +102,23 @@ exports.publicSettings = async function (ctx) {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
try {
|
try {
|
||||||
// Find the config with the most granular scope based on context
|
// Find the config with the most granular scope based on context
|
||||||
const config = await getScopedFullConfig(db, {
|
const publicConfig = await getScopedFullConfig(db, {
|
||||||
type: Configs.SETTINGS,
|
type: Configs.SETTINGS,
|
||||||
})
|
})
|
||||||
if (!config) {
|
|
||||||
|
// Pull out the OIDC icon and name because the other properties shouldn't
|
||||||
|
// be made public
|
||||||
|
const oidcConfig = await getScopedFullConfig(db, {
|
||||||
|
type: Configs.OIDC,
|
||||||
|
})
|
||||||
|
if (!publicConfig) {
|
||||||
ctx.body = {}
|
ctx.body = {}
|
||||||
} else {
|
} else {
|
||||||
ctx.body = config
|
ctx.body = publicConfig
|
||||||
|
if (oidcConfig.config) {
|
||||||
|
publicConfig.config.oidcIcon = oidcConfig.config.iconName
|
||||||
|
publicConfig.config.oidcName = oidcConfig.config.name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(err.status, err)
|
ctx.throw(err.status, err)
|
||||||
|
@ -122,12 +132,8 @@ exports.upload = async function (ctx) {
|
||||||
const file = ctx.request.files.file
|
const file = ctx.request.files.file
|
||||||
const { type, name } = ctx.params
|
const { type, name } = ctx.params
|
||||||
|
|
||||||
const fileExtension = [...file.name.split(".")].pop()
|
|
||||||
// filenames converted to UUIDs so they are unique
|
|
||||||
const processedFileName = `${name}.${fileExtension}`
|
|
||||||
|
|
||||||
const bucket = ObjectStoreBuckets.GLOBAL
|
const bucket = ObjectStoreBuckets.GLOBAL
|
||||||
const key = `${type}/${processedFileName}`
|
const key = `${type}/${name}`
|
||||||
await upload({
|
await upload({
|
||||||
bucket,
|
bucket,
|
||||||
filename: key,
|
filename: key,
|
||||||
|
|
Loading…
Reference in New Issue