diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-31 16:42:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-31 16:42:40 +0100 |
commit | 66b16cafb380012d3eca14e524d86f2450e04069 (patch) | |
tree | 02a6d2327e2499dbe921c22a03b8a9d741773dd6 /server | |
parent | 81ebea48bfba2d81e62dd7a0f01a0cadf41d2607 (diff) | |
download | PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.tar.gz PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.tar.zst PeerTube-66b16cafb380012d3eca14e524d86f2450e04069.zip |
Add new name/terms/description config options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/config.ts | 5 | ||||
-rw-r--r-- | server/initializers/checker.ts | 3 | ||||
-rw-r--r-- | server/initializers/constants.ts | 5 | ||||
-rw-r--r-- | server/tests/api/check-params/config.ts | 5 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 12 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 2 |
6 files changed, 29 insertions, 3 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index bc804d9ba..e4cb02820 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -105,6 +105,11 @@ export { | |||
105 | 105 | ||
106 | function customConfig (): CustomConfig { | 106 | function customConfig (): CustomConfig { |
107 | return { | 107 | return { |
108 | instance: { | ||
109 | name: CONFIG.INSTANCE.NAME, | ||
110 | description: CONFIG.INSTANCE.DESCRIPTION, | ||
111 | terms: CONFIG.INSTANCE.TERMS | ||
112 | }, | ||
108 | cache: { | 113 | cache: { |
109 | previews: { | 114 | previews: { |
110 | size: CONFIG.CACHE.PREVIEWS.SIZE | 115 | size: CONFIG.CACHE.PREVIEWS.SIZE |
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts index d550fd23f..e5cc1b7be 100644 --- a/server/initializers/checker.ts +++ b/server/initializers/checker.ts | |||
@@ -23,7 +23,8 @@ function checkMissedConfig () { | |||
23 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', | 23 | 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', |
24 | 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', 'storage.torrents', 'storage.cache', 'log.level', | 24 | 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', 'storage.torrents', 'storage.cache', 'log.level', |
25 | 'cache.previews.size', 'admin.email', 'signup.enabled', 'signup.limit', 'transcoding.enabled', 'transcoding.threads', | 25 | 'cache.previews.size', 'admin.email', 'signup.enabled', 'signup.limit', 'transcoding.enabled', 'transcoding.threads', |
26 | 'user.video_quota', 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address' | 26 | 'user.video_quota', 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', |
27 | 'instance.name', 'instance.description', 'instance.terms' | ||
27 | ] | 28 | ] |
28 | const miss: string[] = [] | 29 | const miss: string[] = [] |
29 | 30 | ||
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index e7b1656e2..e531c4c39 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -154,6 +154,11 @@ const CONFIG = { | |||
154 | PREVIEWS: { | 154 | PREVIEWS: { |
155 | get SIZE () { return config.get<number>('cache.previews.size') } | 155 | get SIZE () { return config.get<number>('cache.previews.size') } |
156 | } | 156 | } |
157 | }, | ||
158 | INSTANCE: { | ||
159 | get NAME () { return config.get<string>('instance.name') }, | ||
160 | get DESCRIPTION () { return config.get<string>('instance.description') }, | ||
161 | get TERMS () { return config.get<string>('instance.terms') } | ||
157 | } | 162 | } |
158 | } | 163 | } |
159 | 164 | ||
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index a2a404702..efc1e4e09 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -14,6 +14,11 @@ describe('Test config API validators', function () { | |||
14 | let server: ServerInfo | 14 | let server: ServerInfo |
15 | let userAccessToken: string | 15 | let userAccessToken: string |
16 | const updateParams: CustomConfig = { | 16 | const updateParams: CustomConfig = { |
17 | instance: { | ||
18 | name: 'PeerTube updated', | ||
19 | description: 'my super description', | ||
20 | terms: 'my super terms' | ||
21 | }, | ||
17 | cache: { | 22 | cache: { |
18 | previews: { | 23 | previews: { |
19 | size: 2 | 24 | size: 2 |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index a1f8212bb..f83e21e82 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -49,6 +49,9 @@ describe('Test config', function () { | |||
49 | const res = await getCustomConfig(server.url, server.accessToken) | 49 | const res = await getCustomConfig(server.url, server.accessToken) |
50 | const data = res.body | 50 | const data = res.body |
51 | 51 | ||
52 | expect(data.instance.name).to.equal('PeerTube') | ||
53 | expect(data.instance.description).to.be.empty | ||
54 | expect(data.instance.terms).to.be.empty | ||
52 | expect(data.cache.previews.size).to.equal(1) | 55 | expect(data.cache.previews.size).to.equal(1) |
53 | expect(data.signup.enabled).to.be.true | 56 | expect(data.signup.enabled).to.be.true |
54 | expect(data.signup.limit).to.equal(4) | 57 | expect(data.signup.limit).to.equal(4) |
@@ -65,6 +68,11 @@ describe('Test config', function () { | |||
65 | 68 | ||
66 | it('Should update the customized configuration', async function () { | 69 | it('Should update the customized configuration', async function () { |
67 | const newCustomConfig = { | 70 | const newCustomConfig = { |
71 | instance: { | ||
72 | name: 'PeerTube updated', | ||
73 | description: 'my super description', | ||
74 | terms: 'my super terms' | ||
75 | }, | ||
68 | cache: { | 76 | cache: { |
69 | previews: { | 77 | previews: { |
70 | size: 2 | 78 | size: 2 |
@@ -97,7 +105,9 @@ describe('Test config', function () { | |||
97 | const res = await getCustomConfig(server.url, server.accessToken) | 105 | const res = await getCustomConfig(server.url, server.accessToken) |
98 | const data = res.body | 106 | const data = res.body |
99 | 107 | ||
100 | expect(data.cache.previews.size).to.equal(2) | 108 | expect(data.instance.name).to.equal('PeerTube updated') |
109 | expect(data.instance.description).to.equal('my super description') | ||
110 | expect(data.instance.terms).to.equal('my super terms') | ||
101 | expect(data.signup.enabled).to.be.false | 111 | expect(data.signup.enabled).to.be.false |
102 | expect(data.signup.limit).to.equal(5) | 112 | expect(data.signup.limit).to.equal(5) |
103 | expect(data.admin.email).to.equal('superadmin1@example.com') | 113 | expect(data.admin.email).to.equal('superadmin1@example.com') |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 860f04fd8..0b28edd48 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -373,7 +373,7 @@ async function completeVideoCheck ( | |||
373 | expect(dateIsValid(video.createdAt)).to.be.true | 373 | expect(dateIsValid(video.createdAt)).to.be.true |
374 | expect(dateIsValid(video.updatedAt)).to.be.true | 374 | expect(dateIsValid(video.updatedAt)).to.be.true |
375 | 375 | ||
376 | const res = await getVideo(url, video.id) | 376 | const res = await getVideo(url, video.uuid) |
377 | const videoDetails = res.body | 377 | const videoDetails = res.body |
378 | 378 | ||
379 | expect(videoDetails.files).to.have.lengthOf(attributes.files.length) | 379 | expect(videoDetails.files).to.have.lengthOf(attributes.files.length) |