Translate plugin settings

This commit is contained in:
Chocobozzz
2021-12-29 14:08:07 +01:00
parent 2accfdd8ec
commit fb3c9e2bf5
7 changed files with 57 additions and 39 deletions

View File

@@ -3,6 +3,7 @@ import { CONFIG, isEmailEnabled } from '@server/initializers/config'
import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '@server/initializers/constants'
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '@server/lib/signup'
import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'
import { PluginModel } from '@server/models/server/plugin'
import { HTMLServerConfig, RegisteredExternalAuthConfig, RegisteredIdAndPassAuthConfig, ServerConfig } from '@shared/models'
import { Hooks } from './plugins/hooks'
import { PluginManager } from './plugins/plugin-manager'
@@ -269,6 +270,7 @@ class ServerConfigManager {
getRegisteredThemes () {
return PluginManager.Instance.getRegisteredThemes()
.map(t => ({
npmName: PluginModel.buildNpmName(t.name, t.type),
name: t.name,
version: t.version,
description: t.description,
@@ -280,6 +282,7 @@ class ServerConfigManager {
getRegisteredPlugins () {
return PluginManager.Instance.getRegisteredPlugins()
.map(p => ({
npmName: PluginModel.buildNpmName(p.name, p.type),
name: p.name,
version: p.version,
description: p.description,

View File

@@ -99,9 +99,11 @@ describe('Test plugins', function () {
const theme = config.theme.registered.find(r => r.name === 'background-red')
expect(theme).to.not.be.undefined
expect(theme.npmName).to.equal('peertube-theme-background-red')
const plugin = config.plugin.registered.find(r => r.name === 'hello-world')
expect(plugin).to.not.be.undefined
expect(plugin.npmName).to.equal('peertube-plugin-hello-world')
})
it('Should update the default theme in the configuration', async function () {