diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/initializers/config.ts | 6 | ||||
-rw-r--r-- | server/lib/server-config-manager.ts | 10 | ||||
-rw-r--r-- | server/middlewares/validators/config.ts | 3 | ||||
-rw-r--r-- | server/tests/api/server/auto-follows.ts | 4 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 4 |
5 files changed, 20 insertions, 7 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index a37aae551..48bb5ab8e 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -206,8 +206,8 @@ const CONFIG = { | |||
206 | }, | 206 | }, |
207 | WEBADMIN: { | 207 | WEBADMIN: { |
208 | CONFIGURATION: { | 208 | CONFIGURATION: { |
209 | EDITS: { | 209 | EDITION: { |
210 | ALLOWED: config.get<boolean>('webadmin.configuration.edit.allowed') | 210 | ALLOWED: config.get<boolean>('webadmin.configuration.edition.allowed') |
211 | } | 211 | } |
212 | } | 212 | } |
213 | }, | 213 | }, |
@@ -463,7 +463,7 @@ export function reloadConfig () { | |||
463 | 463 | ||
464 | function getConfigDirectories () { | 464 | function getConfigDirectories () { |
465 | if (process.env.NODE_CONFIG_DIR) { | 465 | if (process.env.NODE_CONFIG_DIR) { |
466 | return process.env.NODE_CONFIG_DIR.split(":") | 466 | return process.env.NODE_CONFIG_DIR.split(':') |
467 | } | 467 | } |
468 | 468 | ||
469 | return [ join(root(), 'config') ] | 469 | return [ join(root(), 'config') ] |
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index 58a37b56c..b78251e8c 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts | |||
@@ -42,7 +42,6 @@ class ServerConfigManager { | |||
42 | const defaultTheme = getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) | 42 | const defaultTheme = getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) |
43 | 43 | ||
44 | return { | 44 | return { |
45 | allowEdits: CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED, | ||
46 | client: { | 45 | client: { |
47 | videos: { | 46 | videos: { |
48 | miniature: { | 47 | miniature: { |
@@ -50,6 +49,15 @@ class ServerConfigManager { | |||
50 | } | 49 | } |
51 | } | 50 | } |
52 | }, | 51 | }, |
52 | |||
53 | webadmin: { | ||
54 | configuration: { | ||
55 | edition: { | ||
56 | allowed: CONFIG.WEBADMIN.CONFIGURATION.EDITION.ALLOWED | ||
57 | } | ||
58 | } | ||
59 | }, | ||
60 | |||
53 | instance: { | 61 | instance: { |
54 | name: CONFIG.INSTANCE.NAME, | 62 | name: CONFIG.INSTANCE.NAME, |
55 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, | 63 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, |
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index 5f1ac89bc..f0385ab44 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts | |||
@@ -106,12 +106,13 @@ const customConfigUpdateValidator = [ | |||
106 | ] | 106 | ] |
107 | 107 | ||
108 | function ensureConfigIsEditable (req: express.Request, res: express.Response, next: express.NextFunction) { | 108 | function ensureConfigIsEditable (req: express.Request, res: express.Response, next: express.NextFunction) { |
109 | if (!CONFIG.WEBADMIN.CONFIGURATION.EDITS.ALLOWED) { | 109 | if (!CONFIG.WEBADMIN.CONFIGURATION.EDITION.ALLOWED) { |
110 | return res.fail({ | 110 | return res.fail({ |
111 | status: HttpStatusCode.METHOD_NOT_ALLOWED_405, | 111 | status: HttpStatusCode.METHOD_NOT_ALLOWED_405, |
112 | message: 'Server configuration is static and cannot be edited' | 112 | message: 'Server configuration is static and cannot be edited' |
113 | }) | 113 | }) |
114 | } | 114 | } |
115 | |||
115 | return next() | 116 | return next() |
116 | } | 117 | } |
117 | 118 | ||
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts index ca6475bd5..90a668edb 100644 --- a/server/tests/api/server/auto-follows.ts +++ b/server/tests/api/server/auto-follows.ts | |||
@@ -186,6 +186,10 @@ describe('Test auto follows', function () { | |||
186 | await checkFollow(servers[0], servers[1], false) | 186 | await checkFollow(servers[0], servers[1], false) |
187 | await checkFollow(servers[0], servers[2], true) | 187 | await checkFollow(servers[0], servers[2], true) |
188 | }) | 188 | }) |
189 | |||
190 | after(async function () { | ||
191 | await instanceIndexServer.terminate() | ||
192 | }) | ||
189 | }) | 193 | }) |
190 | 194 | ||
191 | after(async function () { | 195 | after(async function () { |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 8363318f6..1d996d454 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -379,14 +379,14 @@ describe('Test static config', function () { | |||
379 | before(async function () { | 379 | before(async function () { |
380 | this.timeout(30000) | 380 | this.timeout(30000) |
381 | 381 | ||
382 | server = await createSingleServer(1, { webadmin: { configuration: { edit: { allowed: false } } } }) | 382 | server = await createSingleServer(1, { webadmin: { configuration: { edition: { allowed: false } } } }) |
383 | await setAccessTokensToServers([ server ]) | 383 | await setAccessTokensToServers([ server ]) |
384 | }) | 384 | }) |
385 | 385 | ||
386 | it('Should tell the client that edits are not allowed', async function () { | 386 | it('Should tell the client that edits are not allowed', async function () { |
387 | const data = await server.config.getConfig() | 387 | const data = await server.config.getConfig() |
388 | 388 | ||
389 | expect(data.allowEdits).to.be.false | 389 | expect(data.webadmin.configuration.edition.allowed).to.be.false |
390 | }) | 390 | }) |
391 | 391 | ||
392 | it('Should error when client tries to update', async function () { | 392 | it('Should error when client tries to update', async function () { |