]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/server/config.ts
Add x-powered-by header
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / config.ts
CommitLineData
a1587156 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
0e1dc3e7 2
86347717 3import { expect } from 'chai'
c55e3d72
C
4import { parallelTests } from '@shared/core-utils'
5import { CustomConfig, HttpStatusCode } from '@shared/models'
0e1dc3e7 6import {
7c3b7976 7 cleanupTests,
254d3579 8 createSingleServer,
a1587156 9 killallServers,
8155db66 10 makeGetRequest,
254d3579 11 PeerTubeServer,
d23dd9fb 12 setAccessTokensToServers
bf54587a 13} from '@shared/server-commands'
0e1dc3e7 14
254d3579 15function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
40e87e9e
C
16 expect(data.instance.name).to.equal('PeerTube')
17 expect(data.instance.shortDescription).to.equal(
482fa503 18 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
40e87e9e
C
19 )
20 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
ccc00cb2 21
40e87e9e 22 expect(data.instance.terms).to.equal('No terms for now.')
8ae03c37 23 expect(data.instance.creationReason).to.be.empty
ccc00cb2
C
24 expect(data.instance.codeOfConduct).to.be.empty
25 expect(data.instance.moderationInformation).to.be.empty
26 expect(data.instance.administrator).to.be.empty
27 expect(data.instance.maintenanceLifetime).to.be.empty
28 expect(data.instance.businessModel).to.be.empty
be04c6fd 29 expect(data.instance.hardwareInformation).to.be.empty
ccc00cb2
C
30
31 expect(data.instance.languages).to.have.lengthOf(0)
32 expect(data.instance.categories).to.have.lengthOf(0)
33
40e87e9e 34 expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
f8802489 35 expect(data.instance.isNSFW).to.be.false
40e87e9e
C
36 expect(data.instance.defaultNSFWPolicy).to.equal('display')
37 expect(data.instance.customizations.css).to.be.empty
38 expect(data.instance.customizations.javascript).to.be.empty
a4101923 39
40e87e9e
C
40 expect(data.services.twitter.username).to.equal('@Chocobozzz')
41 expect(data.services.twitter.whitelisted).to.be.false
a4101923 42
0bc53e20
C
43 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.false
44 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.false
45
40e87e9e
C
46 expect(data.cache.previews.size).to.equal(1)
47 expect(data.cache.captions.size).to.equal(1)
b3d5cb92 48 expect(data.cache.torrents.size).to.equal(1)
a4101923 49
40e87e9e
C
50 expect(data.signup.enabled).to.be.true
51 expect(data.signup.limit).to.equal(4)
1f256e7d 52 expect(data.signup.minimumAge).to.equal(16)
b379759f 53 expect(data.signup.requiresApproval).to.be.false
d9eaee39 54 expect(data.signup.requiresEmailVerification).to.be.false
a4101923 55
48f07b4a 56 expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com')
a4101923
C
57 expect(data.contactForm.enabled).to.be.true
58
40e87e9e 59 expect(data.user.videoQuota).to.equal(5242880)
9ee92651 60 expect(data.user.videoQuotaDaily).to.equal(-1)
c6c0fa6c 61
754b6f5f
FC
62 expect(data.videoChannels.maxPerUser).to.equal(20)
63
40e87e9e 64 expect(data.transcoding.enabled).to.be.false
14e2014a 65 expect(data.transcoding.allowAdditionalExtensions).to.be.false
536598cf 66 expect(data.transcoding.allowAudioFiles).to.be.false
40e87e9e 67 expect(data.transcoding.threads).to.equal(2)
9129b769 68 expect(data.transcoding.concurrency).to.equal(2)
1896bca0 69 expect(data.transcoding.profile).to.equal('default')
8dd754c7 70 expect(data.transcoding.resolutions['144p']).to.be.false
40e87e9e
C
71 expect(data.transcoding.resolutions['240p']).to.be.true
72 expect(data.transcoding.resolutions['360p']).to.be.true
73 expect(data.transcoding.resolutions['480p']).to.be.true
74 expect(data.transcoding.resolutions['720p']).to.be.true
75 expect(data.transcoding.resolutions['1080p']).to.be.true
b7085c71 76 expect(data.transcoding.resolutions['1440p']).to.be.true
db714ab4 77 expect(data.transcoding.resolutions['2160p']).to.be.true
84cae54e 78 expect(data.transcoding.alwaysTranscodeOriginalResolution).to.be.true
d7a25329 79 expect(data.transcoding.webtorrent.enabled).to.be.true
09209296
C
80 expect(data.transcoding.hls.enabled).to.be.true
81
c6c0fa6c 82 expect(data.live.enabled).to.be.false
c655c9ef 83 expect(data.live.allowReplay).to.be.false
f443a746 84 expect(data.live.latencySetting.enabled).to.be.true
c9bc850e 85 expect(data.live.maxDuration).to.equal(-1)
a056ca48
C
86 expect(data.live.maxInstanceLives).to.equal(20)
87 expect(data.live.maxUserLives).to.equal(3)
c6c0fa6c
C
88 expect(data.live.transcoding.enabled).to.be.false
89 expect(data.live.transcoding.threads).to.equal(2)
1896bca0 90 expect(data.live.transcoding.profile).to.equal('default')
8dd754c7 91 expect(data.live.transcoding.resolutions['144p']).to.be.false
c6c0fa6c
C
92 expect(data.live.transcoding.resolutions['240p']).to.be.false
93 expect(data.live.transcoding.resolutions['360p']).to.be.false
94 expect(data.live.transcoding.resolutions['480p']).to.be.false
95 expect(data.live.transcoding.resolutions['720p']).to.be.false
96 expect(data.live.transcoding.resolutions['1080p']).to.be.false
b7085c71 97 expect(data.live.transcoding.resolutions['1440p']).to.be.false
c6c0fa6c 98 expect(data.live.transcoding.resolutions['2160p']).to.be.false
84cae54e 99 expect(data.live.transcoding.alwaysTranscodeOriginalResolution).to.be.true
c6c0fa6c 100
92e66e04 101 expect(data.videoStudio.enabled).to.be.false
c729caf6 102
9129b769 103 expect(data.import.videos.concurrency).to.equal(2)
5d08a6a7 104 expect(data.import.videos.http.enabled).to.be.true
a84b8fa5 105 expect(data.import.videos.torrent.enabled).to.be.true
7ccddd7b 106 expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.false
5b9c965d
C
107
108 expect(data.followers.instance.enabled).to.be.true
14893eb7 109 expect(data.followers.instance.manualApproval).to.be.false
8424c402
C
110
111 expect(data.followings.instance.autoFollowBack.enabled).to.be.false
112 expect(data.followings.instance.autoFollowIndex.enabled).to.be.false
c9215a1b 113 expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('')
72c33e71
C
114
115 expect(data.broadcastMessage.enabled).to.be.false
116 expect(data.broadcastMessage.level).to.equal('info')
117 expect(data.broadcastMessage.message).to.equal('')
118 expect(data.broadcastMessage.dismissable).to.be.false
40e87e9e
C
119}
120
121function checkUpdatedConfig (data: CustomConfig) {
122 expect(data.instance.name).to.equal('PeerTube updated')
123 expect(data.instance.shortDescription).to.equal('my short description')
124 expect(data.instance.description).to.equal('my super description')
ccc00cb2 125
40e87e9e 126 expect(data.instance.terms).to.equal('my super terms')
8ae03c37 127 expect(data.instance.creationReason).to.equal('my super creation reason')
ccc00cb2
C
128 expect(data.instance.codeOfConduct).to.equal('my super coc')
129 expect(data.instance.moderationInformation).to.equal('my super moderation information')
130 expect(data.instance.administrator).to.equal('Kuja')
131 expect(data.instance.maintenanceLifetime).to.equal('forever')
132 expect(data.instance.businessModel).to.equal('my super business model')
be04c6fd 133 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
ccc00cb2
C
134
135 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
136 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
137
40e87e9e 138 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
f8802489 139 expect(data.instance.isNSFW).to.be.true
40e87e9e
C
140 expect(data.instance.defaultNSFWPolicy).to.equal('blur')
141 expect(data.instance.customizations.javascript).to.equal('alert("coucou")')
142 expect(data.instance.customizations.css).to.equal('body { background-color: red; }')
a4101923 143
40e87e9e
C
144 expect(data.services.twitter.username).to.equal('@Kuja')
145 expect(data.services.twitter.whitelisted).to.be.true
a4101923 146
0bc53e20
C
147 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.true
148 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.true
149
40e87e9e
C
150 expect(data.cache.previews.size).to.equal(2)
151 expect(data.cache.captions.size).to.equal(3)
b3d5cb92 152 expect(data.cache.torrents.size).to.equal(4)
a4101923 153
40e87e9e
C
154 expect(data.signup.enabled).to.be.false
155 expect(data.signup.limit).to.equal(5)
b379759f 156 expect(data.signup.requiresApproval).to.be.false
576ad67a 157 expect(data.signup.requiresEmailVerification).to.be.false
1f256e7d 158 expect(data.signup.minimumAge).to.equal(10)
a4101923 159
48f07b4a
C
160 // We override admin email in parallel tests, so skip this exception
161 if (parallelTests() === false) {
162 expect(data.admin.email).to.equal('superadmin1@example.com')
163 }
164
a4101923
C
165 expect(data.contactForm.enabled).to.be.false
166
40e87e9e 167 expect(data.user.videoQuota).to.equal(5242881)
bee0abff 168 expect(data.user.videoQuotaDaily).to.equal(318742)
a4101923 169
754b6f5f
FC
170 expect(data.videoChannels.maxPerUser).to.equal(24)
171
40e87e9e
C
172 expect(data.transcoding.enabled).to.be.true
173 expect(data.transcoding.threads).to.equal(1)
9129b769 174 expect(data.transcoding.concurrency).to.equal(3)
14e2014a 175 expect(data.transcoding.allowAdditionalExtensions).to.be.true
536598cf 176 expect(data.transcoding.allowAudioFiles).to.be.true
1896bca0 177 expect(data.transcoding.profile).to.equal('vod_profile')
8dd754c7 178 expect(data.transcoding.resolutions['144p']).to.be.false
40e87e9e
C
179 expect(data.transcoding.resolutions['240p']).to.be.false
180 expect(data.transcoding.resolutions['360p']).to.be.true
181 expect(data.transcoding.resolutions['480p']).to.be.true
182 expect(data.transcoding.resolutions['720p']).to.be.false
183 expect(data.transcoding.resolutions['1080p']).to.be.false
db714ab4 184 expect(data.transcoding.resolutions['2160p']).to.be.false
84cae54e 185 expect(data.transcoding.alwaysTranscodeOriginalResolution).to.be.false
09209296 186 expect(data.transcoding.hls.enabled).to.be.false
d7a25329 187 expect(data.transcoding.webtorrent.enabled).to.be.true
a4101923 188
c6c0fa6c 189 expect(data.live.enabled).to.be.true
c655c9ef 190 expect(data.live.allowReplay).to.be.true
f443a746 191 expect(data.live.latencySetting.enabled).to.be.false
fb719404 192 expect(data.live.maxDuration).to.equal(5000)
a056ca48
C
193 expect(data.live.maxInstanceLives).to.equal(-1)
194 expect(data.live.maxUserLives).to.equal(10)
c6c0fa6c
C
195 expect(data.live.transcoding.enabled).to.be.true
196 expect(data.live.transcoding.threads).to.equal(4)
1896bca0 197 expect(data.live.transcoding.profile).to.equal('live_profile')
8dd754c7 198 expect(data.live.transcoding.resolutions['144p']).to.be.true
c6c0fa6c
C
199 expect(data.live.transcoding.resolutions['240p']).to.be.true
200 expect(data.live.transcoding.resolutions['360p']).to.be.true
201 expect(data.live.transcoding.resolutions['480p']).to.be.true
202 expect(data.live.transcoding.resolutions['720p']).to.be.true
203 expect(data.live.transcoding.resolutions['1080p']).to.be.true
204 expect(data.live.transcoding.resolutions['2160p']).to.be.true
84cae54e 205 expect(data.live.transcoding.alwaysTranscodeOriginalResolution).to.be.false
c6c0fa6c 206
92e66e04 207 expect(data.videoStudio.enabled).to.be.true
c729caf6 208
9129b769 209 expect(data.import.videos.concurrency).to.equal(4)
5d08a6a7 210 expect(data.import.videos.http.enabled).to.be.false
a84b8fa5 211 expect(data.import.videos.torrent.enabled).to.be.false
7ccddd7b 212 expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.true
5b9c965d
C
213
214 expect(data.followers.instance.enabled).to.be.false
14893eb7 215 expect(data.followers.instance.manualApproval).to.be.true
8424c402
C
216
217 expect(data.followings.instance.autoFollowBack.enabled).to.be.true
218 expect(data.followings.instance.autoFollowIndex.enabled).to.be.true
219 expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('https://updated.example.com')
72c33e71
C
220
221 expect(data.broadcastMessage.enabled).to.be.true
222 expect(data.broadcastMessage.level).to.equal('error')
223 expect(data.broadcastMessage.message).to.equal('super bad message')
224 expect(data.broadcastMessage.dismissable).to.be.true
40e87e9e
C
225}
226
8d8a037e
JB
227const newCustomConfig: CustomConfig = {
228 instance: {
229 name: 'PeerTube updated',
230 shortDescription: 'my short description',
231 description: 'my super description',
232 terms: 'my super terms',
233 codeOfConduct: 'my super coc',
234
235 creationReason: 'my super creation reason',
236 moderationInformation: 'my super moderation information',
237 administrator: 'Kuja',
238 maintenanceLifetime: 'forever',
239 businessModel: 'my super business model',
240 hardwareInformation: '2vCore 3GB RAM',
241
242 languages: [ 'en', 'es' ],
243 categories: [ 1, 2 ],
244
245 isNSFW: true,
246 defaultNSFWPolicy: 'blur' as 'blur',
247
248 defaultClientRoute: '/videos/recently-added',
249
250 customizations: {
251 javascript: 'alert("coucou")',
252 css: 'body { background-color: red; }'
253 }
254 },
255 theme: {
256 default: 'default'
257 },
258 services: {
259 twitter: {
260 username: '@Kuja',
261 whitelisted: true
262 }
263 },
0bc53e20
C
264 client: {
265 videos: {
266 miniature: {
267 preferAuthorDisplayName: true
268 }
269 },
270 menu: {
271 login: {
272 redirectOnSingleExternalAuth: true
273 }
274 }
275 },
8d8a037e
JB
276 cache: {
277 previews: {
278 size: 2
279 },
280 captions: {
281 size: 3
282 },
283 torrents: {
284 size: 4
285 }
286 },
287 signup: {
288 enabled: false,
289 limit: 5,
b379759f 290 requiresApproval: false,
8d8a037e
JB
291 requiresEmailVerification: false,
292 minimumAge: 10
293 },
294 admin: {
295 email: 'superadmin1@example.com'
296 },
297 contactForm: {
298 enabled: false
299 },
300 user: {
301 videoQuota: 5242881,
302 videoQuotaDaily: 318742
303 },
754b6f5f
FC
304 videoChannels: {
305 maxPerUser: 24
306 },
8d8a037e
JB
307 transcoding: {
308 enabled: true,
309 allowAdditionalExtensions: true,
310 allowAudioFiles: true,
311 threads: 1,
312 concurrency: 3,
313 profile: 'vod_profile',
314 resolutions: {
315 '0p': false,
8dd754c7 316 '144p': false,
8d8a037e
JB
317 '240p': false,
318 '360p': true,
319 '480p': true,
320 '720p': false,
321 '1080p': false,
322 '1440p': false,
323 '2160p': false
324 },
84cae54e 325 alwaysTranscodeOriginalResolution: false,
8d8a037e
JB
326 webtorrent: {
327 enabled: true
328 },
329 hls: {
330 enabled: false
331 }
332 },
333 live: {
334 enabled: true,
335 allowReplay: true,
f443a746
C
336 latencySetting: {
337 enabled: false
338 },
8d8a037e
JB
339 maxDuration: 5000,
340 maxInstanceLives: -1,
341 maxUserLives: 10,
342 transcoding: {
343 enabled: true,
344 threads: 4,
345 profile: 'live_profile',
346 resolutions: {
8dd754c7 347 '144p': true,
8d8a037e
JB
348 '240p': true,
349 '360p': true,
350 '480p': true,
351 '720p': true,
352 '1080p': true,
353 '1440p': true,
354 '2160p': true
84cae54e
C
355 },
356 alwaysTranscodeOriginalResolution: false
8d8a037e
JB
357 }
358 },
92e66e04 359 videoStudio: {
c729caf6
C
360 enabled: true
361 },
8d8a037e
JB
362 import: {
363 videos: {
364 concurrency: 4,
365 http: {
366 enabled: false
367 },
368 torrent: {
369 enabled: false
370 }
2a491182
F
371 },
372 videoChannelSynchronization: {
373 enabled: false,
374 maxPerUser: 10
8d8a037e
JB
375 }
376 },
377 trending: {
378 videos: {
379 algorithms: {
010382b6 380 enabled: [ 'hot', 'most-viewed', 'most-liked' ],
8d8a037e
JB
381 default: 'hot'
382 }
383 }
384 },
385 autoBlacklist: {
386 videos: {
387 ofUsers: {
388 enabled: true
389 }
390 }
391 },
392 followers: {
393 instance: {
394 enabled: false,
395 manualApproval: true
396 }
397 },
398 followings: {
399 instance: {
400 autoFollowBack: {
401 enabled: true
402 },
403 autoFollowIndex: {
404 enabled: true,
405 indexUrl: 'https://updated.example.com'
406 }
407 }
408 },
409 broadcastMessage: {
410 enabled: true,
411 level: 'error',
412 message: 'super bad message',
413 dismissable: true
414 },
415 search: {
416 remoteUri: {
417 anonymous: true,
418 users: true
419 },
420 searchIndex: {
421 enabled: true,
422 url: 'https://search.joinpeertube.org',
423 disableLocalSearch: true,
424 isDefaultSearch: true
425 }
426 }
427}
428
429describe('Test static config', function () {
430 let server: PeerTubeServer = null
431
432 before(async function () {
433 this.timeout(30000)
434
cf0c8ee5 435 server = await createSingleServer(1, { webadmin: { configuration: { edition: { allowed: false } } } })
8d8a037e
JB
436 await setAccessTokensToServers([ server ])
437 })
438
439 it('Should tell the client that edits are not allowed', async function () {
440 const data = await server.config.getConfig()
441
cf0c8ee5 442 expect(data.webadmin.configuration.edition.allowed).to.be.false
8d8a037e
JB
443 })
444
445 it('Should error when client tries to update', async function () {
446 await server.config.updateCustomConfig({ newCustomConfig, expectedStatus: 405 })
447 })
f87d82b9
C
448
449 after(async function () {
450 await cleanupTests([ server ])
451 })
8d8a037e
JB
452})
453
0e1dc3e7 454describe('Test config', function () {
254d3579 455 let server: PeerTubeServer = null
0e1dc3e7
C
456
457 before(async function () {
e212f887 458 this.timeout(30000)
48f07b4a 459
254d3579 460 server = await createSingleServer(1)
fd206f0b 461 await setAccessTokensToServers([ server ])
0e1dc3e7
C
462 })
463
464 it('Should have a correct config on a server with registration enabled', async function () {
89d241a7 465 const data = await server.config.getConfig()
0e1dc3e7
C
466
467 expect(data.signup.allowed).to.be.true
468 })
469
470 it('Should have a correct config on a server with registration enabled and a users limit', async function () {
652b3056
C
471 this.timeout(5000)
472
47e0652b 473 await Promise.all([
b379759f
C
474 server.registrations.register({ username: 'user1' }),
475 server.registrations.register({ username: 'user2' }),
476 server.registrations.register({ username: 'user3' })
47e0652b 477 ])
0e1dc3e7 478
89d241a7 479 const data = await server.config.getConfig()
0e1dc3e7
C
480
481 expect(data.signup.allowed).to.be.false
482 })
483
14e2014a 484 it('Should have the correct video allowed extensions', async function () {
89d241a7 485 const data = await server.config.getConfig()
14e2014a
C
486
487 expect(data.video.file.extensions).to.have.lengthOf(3)
488 expect(data.video.file.extensions).to.contain('.mp4')
489 expect(data.video.file.extensions).to.contain('.webm')
490 expect(data.video.file.extensions).to.contain('.ogv')
a4101923 491
89d241a7
C
492 await server.videos.upload({ attributes: { fixture: 'video_short.mkv' }, expectedStatus: HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 })
493 await server.videos.upload({ attributes: { fixture: 'sample.ogg' }, expectedStatus: HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 })
b345a804 494
a4101923 495 expect(data.contactForm.enabled).to.be.true
14e2014a
C
496 })
497
fd206f0b 498 it('Should get the customized configuration', async function () {
89d241a7 499 const data = await server.config.getCustomConfig()
fd206f0b 500
48f07b4a 501 checkInitialConfig(server, data)
fd206f0b
C
502 })
503
504 it('Should update the customized configuration', async function () {
89d241a7 505 await server.config.updateCustomConfig({ newCustomConfig })
fd206f0b 506
89d241a7 507 const data = await server.config.getCustomConfig()
40e87e9e 508 checkUpdatedConfig(data)
fd206f0b
C
509 })
510
14e2014a 511 it('Should have the correct updated video allowed extensions', async function () {
0cbcaccb 512 this.timeout(30000)
30bc55c8 513
89d241a7 514 const data = await server.config.getConfig()
14e2014a 515
30bc55c8 516 expect(data.video.file.extensions).to.have.length.above(4)
14e2014a
C
517 expect(data.video.file.extensions).to.contain('.mp4')
518 expect(data.video.file.extensions).to.contain('.webm')
519 expect(data.video.file.extensions).to.contain('.ogv')
520 expect(data.video.file.extensions).to.contain('.flv')
fccbbc1a 521 expect(data.video.file.extensions).to.contain('.wmv')
14e2014a 522 expect(data.video.file.extensions).to.contain('.mkv')
b345a804
C
523 expect(data.video.file.extensions).to.contain('.mp3')
524 expect(data.video.file.extensions).to.contain('.ogg')
525 expect(data.video.file.extensions).to.contain('.flac')
526
89d241a7
C
527 await server.videos.upload({ attributes: { fixture: 'video_short.mkv' }, expectedStatus: HttpStatusCode.OK_200 })
528 await server.videos.upload({ attributes: { fixture: 'sample.ogg' }, expectedStatus: HttpStatusCode.OK_200 })
14e2014a
C
529 })
530
fd206f0b 531 it('Should have the configuration updated after a restart', async function () {
61e9908c 532 this.timeout(30000)
23e27dd5 533
9293139f 534 await killallServers([ server ])
fd206f0b 535
254d3579 536 await server.run()
fd206f0b 537
89d241a7 538 const data = await server.config.getCustomConfig()
fd206f0b 539
40e87e9e 540 checkUpdatedConfig(data)
fd206f0b
C
541 })
542
36f9424f 543 it('Should fetch the about information', async function () {
89d241a7 544 const data = await server.config.getAbout()
36f9424f
C
545
546 expect(data.instance.name).to.equal('PeerTube updated')
2e3a0215 547 expect(data.instance.shortDescription).to.equal('my short description')
36f9424f
C
548 expect(data.instance.description).to.equal('my super description')
549 expect(data.instance.terms).to.equal('my super terms')
be04c6fd
C
550 expect(data.instance.codeOfConduct).to.equal('my super coc')
551
552 expect(data.instance.creationReason).to.equal('my super creation reason')
553 expect(data.instance.moderationInformation).to.equal('my super moderation information')
554 expect(data.instance.administrator).to.equal('Kuja')
555 expect(data.instance.maintenanceLifetime).to.equal('forever')
556 expect(data.instance.businessModel).to.equal('my super business model')
557 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
558
559 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
560 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
36f9424f
C
561 })
562
fd206f0b 563 it('Should remove the custom configuration', async function () {
89d241a7 564 await server.config.deleteCustomConfig()
fd206f0b 565
89d241a7 566 const data = await server.config.getCustomConfig()
48f07b4a 567 checkInitialConfig(server, data)
fd206f0b
C
568 })
569
47653481 570 it('Should enable/disable security headers', async function () {
8155db66
C
571 this.timeout(25000)
572
573 {
574 const res = await makeGetRequest({
575 url: server.url,
576 path: '/api/v1/config',
c0e8b12e 577 expectedStatus: 200
8155db66
C
578 })
579
580 expect(res.headers['x-frame-options']).to.exist
47653481 581 expect(res.headers['x-powered-by']).to.equal('PeerTube')
8155db66
C
582 }
583
9293139f 584 await killallServers([ server ])
8155db66
C
585
586 const config = {
587 security: {
47653481
C
588 frameguard: { enabled: false },
589 powered_by_header: { enabled: false }
8155db66
C
590 }
591 }
254d3579 592 await server.run(config)
8155db66
C
593
594 {
595 const res = await makeGetRequest({
596 url: server.url,
597 path: '/api/v1/config',
c0e8b12e 598 expectedStatus: 200
8155db66
C
599 })
600
601 expect(res.headers['x-frame-options']).to.not.exist
47653481 602 expect(res.headers['x-powered-by']).to.not.exist
8155db66
C
603 }
604 })
605
7c3b7976
C
606 after(async function () {
607 await cleanupTests([ server ])
0e1dc3e7
C
608 })
609})