diff options
-rw-r--r-- | config/default.yaml | 1 | ||||
-rw-r--r-- | config/production.yaml.example | 1 | ||||
-rw-r--r-- | config/test-1.yaml | 1 | ||||
-rw-r--r-- | config/test-2.yaml | 1 | ||||
-rw-r--r-- | config/test-3.yaml | 1 | ||||
-rw-r--r-- | config/test-4.yaml | 1 | ||||
-rw-r--r-- | config/test-5.yaml | 1 | ||||
-rw-r--r-- | config/test-6.yaml | 1 | ||||
-rw-r--r-- | server/controllers/well-known.ts | 7 | ||||
-rw-r--r-- | server/initializers/checker-before-init.ts | 2 | ||||
-rw-r--r-- | server/initializers/config.ts | 3 | ||||
-rw-r--r-- | server/initializers/constants.ts | 3 | ||||
-rw-r--r-- | server/tests/api/redundancy/redundancy.ts | 8 | ||||
-rw-r--r-- | server/tests/api/users/users-multiple-servers.ts | 2 | ||||
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 2 | ||||
-rw-r--r-- | server/tests/misc-endpoints.ts | 30 | ||||
-rw-r--r-- | server/tests/shared/actors.ts | 8 | ||||
-rw-r--r-- | server/tests/shared/directories.ts | 8 | ||||
-rw-r--r-- | server/tests/shared/playlists.ts | 9 | ||||
-rw-r--r-- | shared/server-commands/server/server.ts | 33 | ||||
-rw-r--r-- | support/docker/production/config/production.yaml | 1 |
21 files changed, 83 insertions, 41 deletions
diff --git a/config/default.yaml b/config/default.yaml index 3a0b494fb..2d8aaf1ea 100644 --- a/config/default.yaml +++ b/config/default.yaml | |||
@@ -122,6 +122,7 @@ storage: | |||
122 | captions: 'storage/captions/' | 122 | captions: 'storage/captions/' |
123 | cache: 'storage/cache/' | 123 | cache: 'storage/cache/' |
124 | plugins: 'storage/plugins/' | 124 | plugins: 'storage/plugins/' |
125 | well_known: 'storage/well-known/' | ||
125 | # Overridable client files in client/dist/assets/images: | 126 | # Overridable client files in client/dist/assets/images: |
126 | # - logo.svg | 127 | # - logo.svg |
127 | # - favicon.png | 128 | # - favicon.png |
diff --git a/config/production.yaml.example b/config/production.yaml.example index dafc15915..46d574e42 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example | |||
@@ -120,6 +120,7 @@ storage: | |||
120 | captions: '/var/www/peertube/storage/captions/' | 120 | captions: '/var/www/peertube/storage/captions/' |
121 | cache: '/var/www/peertube/storage/cache/' | 121 | cache: '/var/www/peertube/storage/cache/' |
122 | plugins: '/var/www/peertube/storage/plugins/' | 122 | plugins: '/var/www/peertube/storage/plugins/' |
123 | well_known: '/var/www/peertube/storage/well-known/' | ||
123 | # Overridable client files in client/dist/assets/images: | 124 | # Overridable client files in client/dist/assets/images: |
124 | # - logo.svg | 125 | # - logo.svg |
125 | # - favicon.png | 126 | # - favicon.png |
diff --git a/config/test-1.yaml b/config/test-1.yaml index fd6a5a341..1402f3048 100644 --- a/config/test-1.yaml +++ b/config/test-1.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test1/captions/' | 23 | captions: 'test1/captions/' |
24 | cache: 'test1/cache/' | 24 | cache: 'test1/cache/' |
25 | plugins: 'test1/plugins/' | 25 | plugins: 'test1/plugins/' |
26 | well_known: 'test1/well-known/' | ||
26 | client_overrides: 'test1/client-overrides/' | 27 | client_overrides: 'test1/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/config/test-2.yaml b/config/test-2.yaml index 5a4ba0abd..5d9db762f 100644 --- a/config/test-2.yaml +++ b/config/test-2.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test2/captions/' | 23 | captions: 'test2/captions/' |
24 | cache: 'test2/cache/' | 24 | cache: 'test2/cache/' |
25 | plugins: 'test2/plugins/' | 25 | plugins: 'test2/plugins/' |
26 | well_known: 'test2/well-known/' | ||
26 | client_overrides: 'test2/client-overrides/' | 27 | client_overrides: 'test2/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/config/test-3.yaml b/config/test-3.yaml index c04df6029..97fe9cd44 100644 --- a/config/test-3.yaml +++ b/config/test-3.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test3/captions/' | 23 | captions: 'test3/captions/' |
24 | cache: 'test3/cache/' | 24 | cache: 'test3/cache/' |
25 | plugins: 'test3/plugins/' | 25 | plugins: 'test3/plugins/' |
26 | well_known: 'test3/well-known/' | ||
26 | client_overrides: 'test3/client-overrides/' | 27 | client_overrides: 'test3/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/config/test-4.yaml b/config/test-4.yaml index 963dee547..328e70fa6 100644 --- a/config/test-4.yaml +++ b/config/test-4.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test4/captions/' | 23 | captions: 'test4/captions/' |
24 | cache: 'test4/cache/' | 24 | cache: 'test4/cache/' |
25 | plugins: 'test4/plugins/' | 25 | plugins: 'test4/plugins/' |
26 | well_known: 'test4/well-known/' | ||
26 | client_overrides: 'test4/client-overrides/' | 27 | client_overrides: 'test4/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/config/test-5.yaml b/config/test-5.yaml index f41378c24..3e6ca9c12 100644 --- a/config/test-5.yaml +++ b/config/test-5.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test5/captions/' | 23 | captions: 'test5/captions/' |
24 | cache: 'test5/cache/' | 24 | cache: 'test5/cache/' |
25 | plugins: 'test5/plugins/' | 25 | plugins: 'test5/plugins/' |
26 | well_known: 'test5/well-known/' | ||
26 | client_overrides: 'test5/client-overrides/' | 27 | client_overrides: 'test5/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/config/test-6.yaml b/config/test-6.yaml index 574f89d19..89a71593f 100644 --- a/config/test-6.yaml +++ b/config/test-6.yaml | |||
@@ -23,6 +23,7 @@ storage: | |||
23 | captions: 'test6/captions/' | 23 | captions: 'test6/captions/' |
24 | cache: 'test6/cache/' | 24 | cache: 'test6/cache/' |
25 | plugins: 'test6/plugins/' | 25 | plugins: 'test6/plugins/' |
26 | well_known: 'test6/well-known/' | ||
26 | client_overrides: 'test6/client-overrides/' | 27 | client_overrides: 'test6/client-overrides/' |
27 | 28 | ||
28 | admin: | 29 | admin: |
diff --git a/server/controllers/well-known.ts b/server/controllers/well-known.ts index f467bd629..ce5883571 100644 --- a/server/controllers/well-known.ts +++ b/server/controllers/well-known.ts | |||
@@ -5,6 +5,7 @@ import { root } from '@shared/core-utils' | |||
5 | import { CONFIG } from '../initializers/config' | 5 | import { CONFIG } from '../initializers/config' |
6 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' | 6 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' |
7 | import { cacheRoute } from '../middlewares/cache/cache' | 7 | import { cacheRoute } from '../middlewares/cache/cache' |
8 | import { handleStaticError } from '@server/middlewares' | ||
8 | 9 | ||
9 | const wellKnownRouter = express.Router() | 10 | const wellKnownRouter = express.Router() |
10 | 11 | ||
@@ -69,6 +70,12 @@ wellKnownRouter.use('/.well-known/host-meta', | |||
69 | } | 70 | } |
70 | ) | 71 | ) |
71 | 72 | ||
73 | wellKnownRouter.use('/.well-known/', | ||
74 | cacheRoute(ROUTE_CACHE_LIFETIME.WELL_KNOWN), | ||
75 | express.static(CONFIG.STORAGE.WELL_KNOWN_DIR, { fallthrough: false }), | ||
76 | handleStaticError | ||
77 | ) | ||
78 | |||
72 | // --------------------------------------------------------------------------- | 79 | // --------------------------------------------------------------------------- |
73 | 80 | ||
74 | export { | 81 | export { |
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 3188903be..1fd4ba248 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -16,7 +16,7 @@ function checkMissedConfig () { | |||
16 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', | 16 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', |
17 | 'email.body.signature', 'email.subject.prefix', | 17 | 'email.body.signature', 'email.subject.prefix', |
18 | 'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', | 18 | 'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', |
19 | 'storage.redundancy', 'storage.tmp', 'storage.streaming_playlists', 'storage.plugins', | 19 | 'storage.redundancy', 'storage.tmp', 'storage.streaming_playlists', 'storage.plugins', 'storage.well_known', |
20 | 'log.level', | 20 | 'log.level', |
21 | 'user.video_quota', 'user.video_quota_daily', | 21 | 'user.video_quota', 'user.video_quota_daily', |
22 | 'video_channels.max_per_user', | 22 | 'video_channels.max_per_user', |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 2c92bea22..287bf6f6d 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -107,7 +107,8 @@ const CONFIG = { | |||
107 | TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')), | 107 | TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')), |
108 | CACHE_DIR: buildPath(config.get<string>('storage.cache')), | 108 | CACHE_DIR: buildPath(config.get<string>('storage.cache')), |
109 | PLUGINS_DIR: buildPath(config.get<string>('storage.plugins')), | 109 | PLUGINS_DIR: buildPath(config.get<string>('storage.plugins')), |
110 | CLIENT_OVERRIDES_DIR: buildPath(config.get<string>('storage.client_overrides')) | 110 | CLIENT_OVERRIDES_DIR: buildPath(config.get<string>('storage.client_overrides')), |
111 | WELL_KNOWN_DIR: buildPath(config.get<string>('storage.well_known')) | ||
111 | }, | 112 | }, |
112 | OBJECT_STORAGE: { | 113 | OBJECT_STORAGE: { |
113 | ENABLED: config.get<boolean>('object_storage.enabled'), | 114 | ENABLED: config.get<boolean>('object_storage.enabled'), |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 7039ab457..9257ebf93 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -116,7 +116,8 @@ const ROUTE_CACHE_LIFETIME = { | |||
116 | ACTIVITY_PUB: { | 116 | ACTIVITY_PUB: { |
117 | VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example | 117 | VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example |
118 | }, | 118 | }, |
119 | STATS: '4 hours' | 119 | STATS: '4 hours', |
120 | WELL_KNOWN: '1 day' | ||
120 | } | 121 | } |
121 | 122 | ||
122 | // --------------------------------------------------------------------------- | 123 | // --------------------------------------------------------------------------- |
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 5abed358f..0f4973184 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -159,8 +159,8 @@ async function check2Webseeds (videoUUID?: string) { | |||
159 | const { webtorrentFilenames } = await ensureSameFilenames(videoUUID) | 159 | const { webtorrentFilenames } = await ensureSameFilenames(videoUUID) |
160 | 160 | ||
161 | const directories = [ | 161 | const directories = [ |
162 | 'test' + servers[0].internalServerNumber + '/redundancy', | 162 | servers[0].getDirectoryPath('redundancy'), |
163 | 'test' + servers[1].internalServerNumber + '/videos' | 163 | servers[1].getDirectoryPath('videos') |
164 | ] | 164 | ] |
165 | 165 | ||
166 | for (const directory of directories) { | 166 | for (const directory of directories) { |
@@ -214,8 +214,8 @@ async function check1PlaylistRedundancies (videoUUID?: string) { | |||
214 | const { hlsFilenames } = await ensureSameFilenames(videoUUID) | 214 | const { hlsFilenames } = await ensureSameFilenames(videoUUID) |
215 | 215 | ||
216 | const directories = [ | 216 | const directories = [ |
217 | 'test' + servers[0].internalServerNumber + '/redundancy/hls', | 217 | servers[0].getDirectoryPath('redundancy/hls'), |
218 | 'test' + servers[1].internalServerNumber + '/streaming-playlists/hls' | 218 | servers[1].getDirectoryPath('streaming-playlists/hls') |
219 | ] | 219 | ] |
220 | 220 | ||
221 | for (const directory of directories) { | 221 | for (const directory of directories) { |
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 62d668d1e..188e6f137 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -197,7 +197,7 @@ describe('Test users with multiple servers', function () { | |||
197 | it('Should not have actor files', async () => { | 197 | it('Should not have actor files', async () => { |
198 | for (const server of servers) { | 198 | for (const server of servers) { |
199 | for (const userAvatarFilename of userAvatarFilenames) { | 199 | for (const userAvatarFilename of userAvatarFilenames) { |
200 | await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) | 200 | await checkActorFilesWereRemoved(userAvatarFilename, server) |
201 | } | 201 | } |
202 | } | 202 | } |
203 | }) | 203 | }) |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index a0c743170..9d223de48 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -1049,7 +1049,7 @@ describe('Test video playlists', function () { | |||
1049 | this.timeout(30000) | 1049 | this.timeout(30000) |
1050 | 1050 | ||
1051 | for (const server of servers) { | 1051 | for (const server of servers) { |
1052 | await checkPlaylistFilesWereRemoved(playlistServer1UUID, server.internalServerNumber) | 1052 | await checkPlaylistFilesWereRemoved(playlistServer1UUID, server) |
1053 | } | 1053 | } |
1054 | }) | 1054 | }) |
1055 | 1055 | ||
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 663ac044a..d2072342e 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -1,18 +1,24 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 4 | import { writeJson } from 'fs-extra' |
5 | import { join } from 'path' | ||
5 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
7 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
6 | import { expectLogDoesNotContain } from './shared' | 8 | import { expectLogDoesNotContain } from './shared' |
7 | 9 | ||
8 | describe('Test misc endpoints', function () { | 10 | describe('Test misc endpoints', function () { |
9 | let server: PeerTubeServer | 11 | let server: PeerTubeServer |
12 | let wellKnownPath: string | ||
10 | 13 | ||
11 | before(async function () { | 14 | before(async function () { |
12 | this.timeout(120000) | 15 | this.timeout(120000) |
13 | 16 | ||
14 | server = await createSingleServer(1) | 17 | server = await createSingleServer(1) |
18 | |||
15 | await setAccessTokensToServers([ server ]) | 19 | await setAccessTokensToServers([ server ]) |
20 | |||
21 | wellKnownPath = server.getDirectoryPath('well-known') | ||
16 | }) | 22 | }) |
17 | 23 | ||
18 | describe('Test a well known endpoints', function () { | 24 | describe('Test a well known endpoints', function () { |
@@ -93,6 +99,28 @@ describe('Test misc endpoints', function () { | |||
93 | expect(remoteInteract).to.exist | 99 | expect(remoteInteract).to.exist |
94 | expect(remoteInteract.template).to.equal(server.url + '/remote-interaction?uri={uri}') | 100 | expect(remoteInteract.template).to.equal(server.url + '/remote-interaction?uri={uri}') |
95 | }) | 101 | }) |
102 | |||
103 | it('Should return 404 for non-existing files in /.well-known', async function () { | ||
104 | await makeGetRequest({ | ||
105 | url: server.url, | ||
106 | path: '/.well-known/non-existing-file', | ||
107 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | ||
108 | }) | ||
109 | }) | ||
110 | |||
111 | it('Should return custom file from /.well-known', async function () { | ||
112 | const filename = 'existing-file.json' | ||
113 | |||
114 | await writeJson(join(wellKnownPath, filename), { iThink: 'therefore I am' }) | ||
115 | |||
116 | const { body } = await makeGetRequest({ | ||
117 | url: server.url, | ||
118 | path: '/.well-known/' + filename, | ||
119 | expectedStatus: HttpStatusCode.OK_200 | ||
120 | }) | ||
121 | |||
122 | expect(body.iThink).to.equal('therefore I am') | ||
123 | }) | ||
96 | }) | 124 | }) |
97 | 125 | ||
98 | describe('Test classic static endpoints', function () { | 126 | describe('Test classic static endpoints', function () { |
diff --git a/server/tests/shared/actors.ts b/server/tests/shared/actors.ts index f8f4a5137..41fd72e89 100644 --- a/server/tests/shared/actors.ts +++ b/server/tests/shared/actors.ts | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | ||
6 | import { root } from '@shared/core-utils' | ||
7 | import { Account, VideoChannel } from '@shared/models' | 5 | import { Account, VideoChannel } from '@shared/models' |
8 | import { PeerTubeServer } from '@shared/server-commands' | 6 | import { PeerTubeServer } from '@shared/server-commands' |
9 | 7 | ||
@@ -31,11 +29,9 @@ async function expectAccountFollows (options: { | |||
31 | return expectActorFollow({ ...options, data }) | 29 | return expectActorFollow({ ...options, data }) |
32 | } | 30 | } |
33 | 31 | ||
34 | async function checkActorFilesWereRemoved (filename: string, serverNumber: number) { | 32 | async function checkActorFilesWereRemoved (filename: string, server: PeerTubeServer) { |
35 | const testDirectory = 'test' + serverNumber | ||
36 | |||
37 | for (const directory of [ 'avatars' ]) { | 33 | for (const directory of [ 'avatars' ]) { |
38 | const directoryPath = join(root(), testDirectory, directory) | 34 | const directoryPath = server.getDirectoryPath(directory) |
39 | 35 | ||
40 | const directoryExists = await pathExists(directoryPath) | 36 | const directoryExists = await pathExists(directoryPath) |
41 | expect(directoryExists).to.be.true | 37 | expect(directoryExists).to.be.true |
diff --git a/server/tests/shared/directories.ts b/server/tests/shared/directories.ts index c7065a767..90d534a06 100644 --- a/server/tests/shared/directories.ts +++ b/server/tests/shared/directories.ts | |||
@@ -2,22 +2,18 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | ||
6 | import { root } from '@shared/core-utils' | ||
7 | import { PeerTubeServer } from '@shared/server-commands' | 5 | import { PeerTubeServer } from '@shared/server-commands' |
8 | 6 | ||
9 | async function checkTmpIsEmpty (server: PeerTubeServer) { | 7 | async function checkTmpIsEmpty (server: PeerTubeServer) { |
10 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) | 8 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) |
11 | 9 | ||
12 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { | 10 | if (await pathExists(server.getDirectoryPath('tmp/hls'))) { |
13 | await checkDirectoryIsEmpty(server, 'tmp/hls') | 11 | await checkDirectoryIsEmpty(server, 'tmp/hls') |
14 | } | 12 | } |
15 | } | 13 | } |
16 | 14 | ||
17 | async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { | 15 | async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { |
18 | const testDirectory = 'test' + server.internalServerNumber | 16 | const directoryPath = server.getDirectoryPath(directory) |
19 | |||
20 | const directoryPath = join(root(), testDirectory, directory) | ||
21 | 17 | ||
22 | const directoryExists = await pathExists(directoryPath) | 18 | const directoryExists = await pathExists(directoryPath) |
23 | expect(directoryExists).to.be.true | 19 | expect(directoryExists).to.be.true |
diff --git a/server/tests/shared/playlists.ts b/server/tests/shared/playlists.ts index fdd541d20..8db303fd8 100644 --- a/server/tests/shared/playlists.ts +++ b/server/tests/shared/playlists.ts | |||
@@ -1,17 +1,14 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { readdir } from 'fs-extra' | 2 | import { readdir } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { PeerTubeServer } from '@shared/server-commands' |
4 | import { root } from '@shared/core-utils' | ||
5 | 4 | ||
6 | async function checkPlaylistFilesWereRemoved ( | 5 | async function checkPlaylistFilesWereRemoved ( |
7 | playlistUUID: string, | 6 | playlistUUID: string, |
8 | internalServerNumber: number, | 7 | server: PeerTubeServer, |
9 | directories = [ 'thumbnails' ] | 8 | directories = [ 'thumbnails' ] |
10 | ) { | 9 | ) { |
11 | const testDirectory = 'test' + internalServerNumber | ||
12 | |||
13 | for (const directory of directories) { | 10 | for (const directory of directories) { |
14 | const directoryPath = join(root(), testDirectory, directory) | 11 | const directoryPath = server.getDirectoryPath(directory) |
15 | 12 | ||
16 | const files = await readdir(directoryPath) | 13 | const files = await readdir(directoryPath) |
17 | for (const file of files) { | 14 | for (const file of files) { |
diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts index 2b4c9c9f8..a8f8c1d84 100644 --- a/shared/server-commands/server/server.ts +++ b/shared/server-commands/server/server.ts | |||
@@ -182,6 +182,12 @@ export class PeerTubeServer { | |||
182 | this.port = parseInt(parsed.port) | 182 | this.port = parseInt(parsed.port) |
183 | } | 183 | } |
184 | 184 | ||
185 | getDirectoryPath (directoryName: string) { | ||
186 | const testDirectory = 'test' + this.internalServerNumber | ||
187 | |||
188 | return join(root(), testDirectory, directoryName) | ||
189 | } | ||
190 | |||
185 | async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) { | 191 | async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) { |
186 | await ServersCommand.flushTests(this.internalServerNumber) | 192 | await ServersCommand.flushTests(this.internalServerNumber) |
187 | 193 | ||
@@ -341,19 +347,20 @@ export class PeerTubeServer { | |||
341 | suffix: '_test' + this.internalServerNumber | 347 | suffix: '_test' + this.internalServerNumber |
342 | }, | 348 | }, |
343 | storage: { | 349 | storage: { |
344 | tmp: `test${this.internalServerNumber}/tmp/`, | 350 | tmp: this.getDirectoryPath('tmp') + '/', |
345 | bin: `test${this.internalServerNumber}/bin/`, | 351 | bin: this.getDirectoryPath('bin') + '/', |
346 | avatars: `test${this.internalServerNumber}/avatars/`, | 352 | avatars: this.getDirectoryPath('avatars') + '/', |
347 | videos: `test${this.internalServerNumber}/videos/`, | 353 | videos: this.getDirectoryPath('videos') + '/', |
348 | streaming_playlists: `test${this.internalServerNumber}/streaming-playlists/`, | 354 | streaming_playlists: this.getDirectoryPath('streaming-playlists') + '/', |
349 | redundancy: `test${this.internalServerNumber}/redundancy/`, | 355 | redundancy: this.getDirectoryPath('redundancy') + '/', |
350 | logs: `test${this.internalServerNumber}/logs/`, | 356 | logs: this.getDirectoryPath('logs') + '/', |
351 | previews: `test${this.internalServerNumber}/previews/`, | 357 | previews: this.getDirectoryPath('previews') + '/', |
352 | thumbnails: `test${this.internalServerNumber}/thumbnails/`, | 358 | thumbnails: this.getDirectoryPath('thumbnails') + '/', |
353 | torrents: `test${this.internalServerNumber}/torrents/`, | 359 | torrents: this.getDirectoryPath('torrents') + '/', |
354 | captions: `test${this.internalServerNumber}/captions/`, | 360 | captions: this.getDirectoryPath('captions') + '/', |
355 | cache: `test${this.internalServerNumber}/cache/`, | 361 | cache: this.getDirectoryPath('cache') + '/', |
356 | plugins: `test${this.internalServerNumber}/plugins/` | 362 | plugins: this.getDirectoryPath('plugins') + '/', |
363 | well_known: this.getDirectoryPath('well-known') + '/' | ||
357 | }, | 364 | }, |
358 | admin: { | 365 | admin: { |
359 | email: `admin${this.internalServerNumber}@example.com` | 366 | email: `admin${this.internalServerNumber}@example.com` |
diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml index 2a9117242..f1d698580 100644 --- a/support/docker/production/config/production.yaml +++ b/support/docker/production/config/production.yaml | |||
@@ -56,6 +56,7 @@ storage: | |||
56 | captions: '../data/captions/' | 56 | captions: '../data/captions/' |
57 | cache: '../data/cache/' | 57 | cache: '../data/cache/' |
58 | plugins: '../data/plugins/' | 58 | plugins: '../data/plugins/' |
59 | well_known: '../data/well-known/' | ||
59 | # Overridable client files in client/dist/assets/images : | 60 | # Overridable client files in client/dist/assets/images : |
60 | # - logo.svg | 61 | # - logo.svg |
61 | # - favicon.png | 62 | # - favicon.png |