aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/config.ts43
-rw-r--r--server/controllers/api/users/me.ts1
2 files changed, 29 insertions, 15 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 8563b7437..088234074 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { snakeCase } from 'lodash' 2import { snakeCase } from 'lodash'
3import { ServerConfig, ServerConfigPlugin, UserRight } from '../../../shared' 3import { ServerConfig, UserRight } from '../../../shared'
4import { About } from '../../../shared/models/server/about.model' 4import { About } from '../../../shared/models/server/about.model'
5import { CustomConfig } from '../../../shared/models/server/custom-config.model' 5import { CustomConfig } from '../../../shared/models/server/custom-config.model'
6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' 6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
@@ -16,7 +16,7 @@ import { isNumeric } from 'validator'
16import { objectConverter } from '../../helpers/core-utils' 16import { objectConverter } from '../../helpers/core-utils'
17import { CONFIG, reloadConfig } from '../../initializers/config' 17import { CONFIG, reloadConfig } from '../../initializers/config'
18import { PluginManager } from '../../lib/plugins/plugin-manager' 18import { PluginManager } from '../../lib/plugins/plugin-manager'
19import { PluginType } from '../../../shared/models/plugins/plugin.type' 19import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
20 20
21const packageJSON = require('../../../../package.json') 21const packageJSON = require('../../../../package.json')
22const configRouter = express.Router() 22const configRouter = express.Router()
@@ -56,19 +56,23 @@ async function getConfig (req: express.Request, res: express.Response) {
56 .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true) 56 .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
57 .map(r => parseInt(r, 10)) 57 .map(r => parseInt(r, 10))
58 58
59 const plugins: ServerConfigPlugin[] = []
60 const registeredPlugins = PluginManager.Instance.getRegisteredPlugins() 59 const registeredPlugins = PluginManager.Instance.getRegisteredPlugins()
61 for (const pluginName of Object.keys(registeredPlugins)) { 60 .map(p => ({
62 const plugin = registeredPlugins[ pluginName ] 61 name: p.name,
63 if (plugin.type !== PluginType.PLUGIN) continue 62 version: p.version,
64 63 description: p.description,
65 plugins.push({ 64 clientScripts: p.clientScripts
66 name: plugin.name, 65 }))
67 version: plugin.version, 66
68 description: plugin.description, 67 const registeredThemes = PluginManager.Instance.getRegisteredThemes()
69 clientScripts: plugin.clientScripts 68 .map(t => ({
70 }) 69 name: t.name,
71 } 70 version: t.version,
71 description: t.description,
72 clientScripts: t.clientScripts
73 }))
74
75 const defaultTheme = getThemeOrDefault(CONFIG.THEME.DEFAULT)
72 76
73 const json: ServerConfig = { 77 const json: ServerConfig = {
74 instance: { 78 instance: {
@@ -82,7 +86,13 @@ async function getConfig (req: express.Request, res: express.Response) {
82 css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS 86 css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS
83 } 87 }
84 }, 88 },
85 plugins, 89 plugin: {
90 registered: registeredPlugins
91 },
92 theme: {
93 registered: registeredThemes,
94 default: defaultTheme
95 },
86 email: { 96 email: {
87 enabled: Emailer.isEnabled() 97 enabled: Emailer.isEnabled()
88 }, 98 },
@@ -240,6 +250,9 @@ function customConfig (): CustomConfig {
240 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT 250 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT
241 } 251 }
242 }, 252 },
253 theme: {
254 default: CONFIG.THEME.DEFAULT
255 },
243 services: { 256 services: {
244 twitter: { 257 twitter: {
245 username: CONFIG.SERVICES.TWITTER.USERNAME, 258 username: CONFIG.SERVICES.TWITTER.USERNAME,
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index a078334fe..e7ed3de64 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -183,6 +183,7 @@ async function updateMe (req: express.Request, res: express.Response) {
183 if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo 183 if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
184 if (body.videosHistoryEnabled !== undefined) user.videosHistoryEnabled = body.videosHistoryEnabled 184 if (body.videosHistoryEnabled !== undefined) user.videosHistoryEnabled = body.videosHistoryEnabled
185 if (body.videoLanguages !== undefined) user.videoLanguages = body.videoLanguages 185 if (body.videoLanguages !== undefined) user.videoLanguages = body.videoLanguages
186 if (body.theme !== undefined) user.theme = body.theme
186 187
187 if (body.email !== undefined) { 188 if (body.email !== undefined) {
188 if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) { 189 if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {