aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-26 15:03:00 +0200
committerChocobozzz <me@florianbigard.com>2020-08-26 15:03:00 +0200
commit20dcfd74982f4ec8a143696abed02b059d30d9ec (patch)
tree8956b19749f7d95a3a0e1b17c57c9b73a9ca6497
parent000ca2a898a36214bbf8f787fef4af4cf5ad3c8d (diff)
downloadPeerTube-20dcfd74982f4ec8a143696abed02b059d30d9ec.tar.gz
PeerTube-20dcfd74982f4ec8a143696abed02b059d30d9ec.tar.zst
PeerTube-20dcfd74982f4ec8a143696abed02b059d30d9ec.zip
Deprecate old static routes
-rw-r--r--CHANGELOG.md4
-rw-r--r--server/initializers/constants.ts4
-rw-r--r--server/tests/api/server/services.ts2
-rw-r--r--server/tests/api/videos/video-captions.ts10
-rw-r--r--server/tests/api/videos/video-imports.ts2
-rw-r--r--support/doc/api/openapi.yaml2
6 files changed, 14 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab25788af..8561fc859 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@
5### IMPORTANT NOTES 5### IMPORTANT NOTES
6 6
7 * The minimum ffmpeg version required is now 4.1 7 * The minimum ffmpeg version required is now 4.1
8 * Deprecate static routes that will be removed in 3.0 (you may not have to do anything if you used paths returned by the video REST API):
9 * `/static/avatars/`: use `/lazy-static/avatars/` instead
10 * `/static/previews/`: use `/lazy-static/previews/` instead
11 * `/static/video-captions/`: use `/lazy-static/video-captions/` instead
8 * Use `playlistPosition` URL parameter for playlists instead of `videoId` to set the current playlist position 12 * Use `playlistPosition` URL parameter for playlists instead of `videoId` to set the current playlist position
9 13
10### Maintenance 14### Maintenance
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c26c3a88c..171e9e9c2 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -545,8 +545,8 @@ const STATIC_DOWNLOAD_PATHS = {
545} 545}
546const LAZY_STATIC_PATHS = { 546const LAZY_STATIC_PATHS = {
547 AVATARS: '/lazy-static/avatars/', 547 AVATARS: '/lazy-static/avatars/',
548 PREVIEWS: '/static/previews/', 548 PREVIEWS: '/lazy-static/previews/',
549 VIDEO_CAPTIONS: '/static/video-captions/' 549 VIDEO_CAPTIONS: '/lazy-static/video-captions/'
550} 550}
551 551
552// Cache control 552// Cache control
diff --git a/server/tests/api/server/services.ts b/server/tests/api/server/services.ts
index 897f37c04..680e7a817 100644
--- a/server/tests/api/server/services.ts
+++ b/server/tests/api/server/services.ts
@@ -70,7 +70,7 @@ describe('Test services', function () {
70 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' + 70 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
71 `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` + 71 `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` +
72 'frameborder="0" allowfullscreen></iframe>' 72 'frameborder="0" allowfullscreen></iframe>'
73 const expectedThumbnailUrl = 'http://localhost:' + server.port + '/static/previews/' + server.video.uuid + '.jpg' 73 const expectedThumbnailUrl = 'http://localhost:' + server.port + '/lazy-static/previews/' + server.video.uuid + '.jpg'
74 74
75 expect(res.body.html).to.equal(expectedHtml) 75 expect(res.body.html).to.equal(expectedHtml)
76 expect(res.body.title).to.equal(server.video.name) 76 expect(res.body.title).to.equal(server.video.name)
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index b4ecb39f4..00e04d69d 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -83,13 +83,13 @@ describe('Test video captions', function () {
83 const caption1: VideoCaption = res.body.data[0] 83 const caption1: VideoCaption = res.body.data[0]
84 expect(caption1.language.id).to.equal('ar') 84 expect(caption1.language.id).to.equal('ar')
85 expect(caption1.language.label).to.equal('Arabic') 85 expect(caption1.language.label).to.equal('Arabic')
86 expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt') 86 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
87 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.') 87 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.')
88 88
89 const caption2: VideoCaption = res.body.data[1] 89 const caption2: VideoCaption = res.body.data[1]
90 expect(caption2.language.id).to.equal('zh') 90 expect(caption2.language.id).to.equal('zh')
91 expect(caption2.language.label).to.equal('Chinese') 91 expect(caption2.language.label).to.equal('Chinese')
92 expect(caption2.captionPath).to.equal('/static/video-captions/' + videoUUID + '-zh.vtt') 92 expect(caption2.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt')
93 await testCaptionFile(server.url, caption2.captionPath, 'Subtitle good 2.') 93 await testCaptionFile(server.url, caption2.captionPath, 'Subtitle good 2.')
94 } 94 }
95 }) 95 })
@@ -117,7 +117,7 @@ describe('Test video captions', function () {
117 const caption1: VideoCaption = res.body.data[0] 117 const caption1: VideoCaption = res.body.data[0]
118 expect(caption1.language.id).to.equal('ar') 118 expect(caption1.language.id).to.equal('ar')
119 expect(caption1.language.label).to.equal('Arabic') 119 expect(caption1.language.label).to.equal('Arabic')
120 expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt') 120 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
121 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 2.') 121 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 2.')
122 } 122 }
123 }) 123 })
@@ -148,7 +148,7 @@ describe('Test video captions', function () {
148 const caption1: VideoCaption = res.body.data[0] 148 const caption1: VideoCaption = res.body.data[0]
149 expect(caption1.language.id).to.equal('ar') 149 expect(caption1.language.id).to.equal('ar')
150 expect(caption1.language.label).to.equal('Arabic') 150 expect(caption1.language.label).to.equal('Arabic')
151 expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt') 151 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
152 152
153 const expected = 'WEBVTT FILE\r\n' + 153 const expected = 'WEBVTT FILE\r\n' +
154 '\r\n' + 154 '\r\n' +
@@ -185,7 +185,7 @@ describe('Test video captions', function () {
185 185
186 expect(caption.language.id).to.equal('zh') 186 expect(caption.language.id).to.equal('zh')
187 expect(caption.language.label).to.equal('Chinese') 187 expect(caption.language.label).to.equal('Chinese')
188 expect(caption.captionPath).to.equal('/static/video-captions/' + videoUUID + '-zh.vtt') 188 expect(caption.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt')
189 await testCaptionFile(server.url, caption.captionPath, 'Subtitle good 2.') 189 await testCaptionFile(server.url, caption.captionPath, 'Subtitle good 2.')
190 } 190 }
191 }) 191 })
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index efda4fc7b..adb97aba4 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -123,7 +123,7 @@ describe('Test video imports', function () {
123 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) 123 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes)
124 expect(res.body.video.name).to.equal('small video - youtube') 124 expect(res.body.video.name).to.equal('small video - youtube')
125 expect(res.body.video.thumbnailPath).to.equal(`/static/thumbnails/${res.body.video.uuid}.jpg`) 125 expect(res.body.video.thumbnailPath).to.equal(`/static/thumbnails/${res.body.video.uuid}.jpg`)
126 expect(res.body.video.previewPath).to.equal(`/static/previews/${res.body.video.uuid}.jpg`) 126 expect(res.body.video.previewPath).to.equal(`/lazy-static/previews/${res.body.video.uuid}.jpg`)
127 await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath) 127 await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath)
128 await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath) 128 await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath)
129 129
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index 756c610c1..464dcfbce 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -3887,7 +3887,7 @@ components:
3887 example: /static/thumbnails/a65bc12f-9383-462e-81ae-8207e8b434ee.jpg 3887 example: /static/thumbnails/a65bc12f-9383-462e-81ae-8207e8b434ee.jpg
3888 previewPath: 3888 previewPath:
3889 type: string 3889 type: string
3890 example: /static/previews/a65bc12f-9383-462e-81ae-8207e8b434ee.jpg 3890 example: /lazy-static/previews/a65bc12f-9383-462e-81ae-8207e8b434ee.jpg
3891 embedPath: 3891 embedPath:
3892 type: string 3892 type: string
3893 example: /videos/embed/a65bc12f-9383-462e-81ae-8207e8b434ee 3893 example: /videos/embed/a65bc12f-9383-462e-81ae-8207e8b434ee