Fix broken plugin state

This commit is contained in:
Chocobozzz 2021-12-23 11:25:54 +01:00
parent e63eede42f
commit dffbf8b577
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 22 additions and 1 deletions

View File

@ -125,7 +125,12 @@ async function register ({
if (settings['auth-display-name']) store.authDisplayName = settings['auth-display-name'] if (settings['auth-display-name']) store.authDisplayName = settings['auth-display-name']
}) })
await loadSettingsAndCreateClient(registerExternalAuth, unregisterExternalAuth, peertubeHelpers, settingsManager) try {
await loadSettingsAndCreateClient(registerExternalAuth, unregisterExternalAuth, peertubeHelpers, settingsManager)
} catch (err) {
logger.error('Cannot load settings and create open id client.', { err })
}
store.authDisplayName = await settingsManager.getSetting('auth-display-name') store.authDisplayName = await settingsManager.getSetting('auth-display-name')
} }

View File

@ -26,10 +26,26 @@ function register ({ registerHook, registerVideoField }) {
type: 'input-checkbox' type: 'input-checkbox'
} }
const commonOptions4 = {
name: 'hello-world-field-4',
label: 'Super field 4 in main tab',
type: 'input-checkbox',
hidden: ({ formValues }) => {
return formValues['privacy'] !== 1 && formValues['privacy'] !== 2
},
error: ({ formValues, value }) => {
if (formValues['privacy'] !== 1 && formValues['privacy'] !== 2) return { error: false }
if (value === true) return { error: false }
return { error: true, text: 'Should be enabled' }
}
}
for (const type of [ 'upload', 'import-url', 'update' ]) { for (const type of [ 'upload', 'import-url', 'update' ]) {
registerVideoField(commonOptions1, { type }) registerVideoField(commonOptions1, { type })
registerVideoField(commonOptions2, { type }) registerVideoField(commonOptions2, { type })
registerVideoField(commonOptions3, { type }) registerVideoField(commonOptions3, { type })
registerVideoField(commonOptions4, { type, tab: 'main' })
} }
} }