diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-23 15:23:27 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-09-05 10:17:02 +0200 |
commit | ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b (patch) | |
tree | 364e1beecb1db90af60f23bbb5219ff2f964cc0d /server | |
parent | 2ba613a5438f993c3874376dd79be9d460ea81d1 (diff) | |
download | PeerTube-ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b.tar.gz PeerTube-ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b.tar.zst PeerTube-ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b.zip |
Add more attributes to about page
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/config.ts | 21 | ||||
-rw-r--r-- | server/initializers/config.ts | 10 | ||||
-rw-r--r-- | server/tests/api/check-params/config.ts | 10 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 30 |
4 files changed, 70 insertions, 1 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 0c52bfa7a..b5244756d 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -158,7 +158,16 @@ function getAbout (req: express.Request, res: express.Response) { | |||
158 | name: CONFIG.INSTANCE.NAME, | 158 | name: CONFIG.INSTANCE.NAME, |
159 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, | 159 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, |
160 | description: CONFIG.INSTANCE.DESCRIPTION, | 160 | description: CONFIG.INSTANCE.DESCRIPTION, |
161 | terms: CONFIG.INSTANCE.TERMS | 161 | terms: CONFIG.INSTANCE.TERMS, |
162 | codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, | ||
163 | |||
164 | moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, | ||
165 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, | ||
166 | maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, | ||
167 | businessModel: CONFIG.INSTANCE.BUSINESS_MODEL, | ||
168 | |||
169 | languages: CONFIG.INSTANCE.LANGUAGES, | ||
170 | categories: CONFIG.INSTANCE.CATEGORIES | ||
162 | } | 171 | } |
163 | } | 172 | } |
164 | 173 | ||
@@ -221,6 +230,16 @@ function customConfig (): CustomConfig { | |||
221 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, | 230 | shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, |
222 | description: CONFIG.INSTANCE.DESCRIPTION, | 231 | description: CONFIG.INSTANCE.DESCRIPTION, |
223 | terms: CONFIG.INSTANCE.TERMS, | 232 | terms: CONFIG.INSTANCE.TERMS, |
233 | codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, | ||
234 | |||
235 | moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, | ||
236 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, | ||
237 | maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, | ||
238 | businessModel: CONFIG.INSTANCE.BUSINESS_MODEL, | ||
239 | |||
240 | languages: CONFIG.INSTANCE.LANGUAGES, | ||
241 | categories: CONFIG.INSTANCE.CATEGORIES, | ||
242 | |||
224 | isNSFW: CONFIG.INSTANCE.IS_NSFW, | 243 | isNSFW: CONFIG.INSTANCE.IS_NSFW, |
225 | defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, | 244 | defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, |
226 | defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, | 245 | defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 599f3f5ac..4e2b07e64 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -209,6 +209,16 @@ const CONFIG = { | |||
209 | get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') }, | 209 | get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') }, |
210 | get DESCRIPTION () { return config.get<string>('instance.description') }, | 210 | get DESCRIPTION () { return config.get<string>('instance.description') }, |
211 | get TERMS () { return config.get<string>('instance.terms') }, | 211 | get TERMS () { return config.get<string>('instance.terms') }, |
212 | get CODE_OF_CONDUCT () { return config.get<string>('instance.code_of_conduct') }, | ||
213 | |||
214 | get MODERATION_INFORMATION () { return config.get<string>('instance.moderation_information') }, | ||
215 | get ADMINISTRATOR () { return config.get<string>('instance.administrator') }, | ||
216 | get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') }, | ||
217 | get BUSINESS_MODEL () { return config.get<string>('instance.business_model') }, | ||
218 | |||
219 | get LANGUAGES () { return config.get<string[]>('instance.languages') || [] }, | ||
220 | get CATEGORIES () { return config.get<number[]>('instance.categories') || [] }, | ||
221 | |||
212 | get IS_NSFW () { return config.get<boolean>('instance.is_nsfw') }, | 222 | get IS_NSFW () { return config.get<boolean>('instance.is_nsfw') }, |
213 | get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, | 223 | get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, |
214 | get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') }, | 224 | get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') }, |
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 1221735c5..f716dc673 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -27,6 +27,16 @@ describe('Test config API validators', function () { | |||
27 | shortDescription: 'my short description', | 27 | shortDescription: 'my short description', |
28 | description: 'my super description', | 28 | description: 'my super description', |
29 | terms: 'my super terms', | 29 | terms: 'my super terms', |
30 | codeOfConduct: 'my super coc', | ||
31 | |||
32 | moderationInformation: 'my super moderation information', | ||
33 | administrator: 'Kuja', | ||
34 | maintenanceLifetime: 'forever', | ||
35 | businessModel: 'my super business model', | ||
36 | |||
37 | languages: [ 'en', 'es' ], | ||
38 | categories: [ 1, 2 ], | ||
39 | |||
30 | isNSFW: true, | 40 | isNSFW: true, |
31 | defaultClientRoute: '/videos/recently-added', | 41 | defaultClientRoute: '/videos/recently-added', |
32 | defaultNSFWPolicy: 'blur', | 42 | defaultNSFWPolicy: 'blur', |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index b2f1933d1..da75495a5 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -28,7 +28,17 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) { | |||
28 | 'with WebTorrent and Angular.' | 28 | 'with WebTorrent and Angular.' |
29 | ) | 29 | ) |
30 | expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') | 30 | expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') |
31 | |||
31 | expect(data.instance.terms).to.equal('No terms for now.') | 32 | expect(data.instance.terms).to.equal('No terms for now.') |
33 | expect(data.instance.codeOfConduct).to.be.empty | ||
34 | expect(data.instance.moderationInformation).to.be.empty | ||
35 | expect(data.instance.administrator).to.be.empty | ||
36 | expect(data.instance.maintenanceLifetime).to.be.empty | ||
37 | expect(data.instance.businessModel).to.be.empty | ||
38 | |||
39 | expect(data.instance.languages).to.have.lengthOf(0) | ||
40 | expect(data.instance.categories).to.have.lengthOf(0) | ||
41 | |||
32 | expect(data.instance.defaultClientRoute).to.equal('/videos/trending') | 42 | expect(data.instance.defaultClientRoute).to.equal('/videos/trending') |
33 | expect(data.instance.isNSFW).to.be.false | 43 | expect(data.instance.isNSFW).to.be.false |
34 | expect(data.instance.defaultNSFWPolicy).to.equal('display') | 44 | expect(data.instance.defaultNSFWPolicy).to.equal('display') |
@@ -78,7 +88,17 @@ function checkUpdatedConfig (data: CustomConfig) { | |||
78 | expect(data.instance.name).to.equal('PeerTube updated') | 88 | expect(data.instance.name).to.equal('PeerTube updated') |
79 | expect(data.instance.shortDescription).to.equal('my short description') | 89 | expect(data.instance.shortDescription).to.equal('my short description') |
80 | expect(data.instance.description).to.equal('my super description') | 90 | expect(data.instance.description).to.equal('my super description') |
91 | |||
81 | expect(data.instance.terms).to.equal('my super terms') | 92 | expect(data.instance.terms).to.equal('my super terms') |
93 | expect(data.instance.codeOfConduct).to.equal('my super coc') | ||
94 | expect(data.instance.moderationInformation).to.equal('my super moderation information') | ||
95 | expect(data.instance.administrator).to.equal('Kuja') | ||
96 | expect(data.instance.maintenanceLifetime).to.equal('forever') | ||
97 | expect(data.instance.businessModel).to.equal('my super business model') | ||
98 | |||
99 | expect(data.instance.languages).to.deep.equal([ 'en', 'es' ]) | ||
100 | expect(data.instance.categories).to.deep.equal([ 1, 2 ]) | ||
101 | |||
82 | expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') | 102 | expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') |
83 | expect(data.instance.isNSFW).to.be.true | 103 | expect(data.instance.isNSFW).to.be.true |
84 | expect(data.instance.defaultNSFWPolicy).to.equal('blur') | 104 | expect(data.instance.defaultNSFWPolicy).to.equal('blur') |
@@ -190,6 +210,16 @@ describe('Test config', function () { | |||
190 | shortDescription: 'my short description', | 210 | shortDescription: 'my short description', |
191 | description: 'my super description', | 211 | description: 'my super description', |
192 | terms: 'my super terms', | 212 | terms: 'my super terms', |
213 | codeOfConduct: 'my super coc', | ||
214 | |||
215 | moderationInformation: 'my super moderation information', | ||
216 | administrator: 'Kuja', | ||
217 | maintenanceLifetime: 'forever', | ||
218 | businessModel: 'my super business model', | ||
219 | |||
220 | languages: [ 'en', 'es' ], | ||
221 | categories: [ 1, 2 ], | ||
222 | |||
193 | defaultClientRoute: '/videos/recently-added', | 223 | defaultClientRoute: '/videos/recently-added', |
194 | isNSFW: true, | 224 | isNSFW: true, |
195 | defaultNSFWPolicy: 'blur' as 'blur', | 225 | defaultNSFWPolicy: 'blur' as 'blur', |