aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--client/e2e/src/suites-all/private-videos.e2e-spec.ts8
-rw-r--r--client/e2e/src/suites-all/videos.e2e-spec.ts4
-rw-r--r--client/e2e/src/utils/urls.ts6
-rw-r--r--client/e2e/wdio.local-test.conf.ts18
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html6
-rw-r--r--client/src/app/+admin/overview/videos/video-admin.service.ts12
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html12
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts22
-rw-r--r--client/src/app/core/users/user.model.ts2
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts4
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts6
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts12
-rw-r--r--config/default.yaml8
-rw-r--r--config/production.yaml.example9
-rwxr-xr-xscripts/prune-storage.ts8
-rw-r--r--server/controllers/api/runners/jobs-files.ts4
-rw-r--r--server/controllers/api/users/me.ts9
-rw-r--r--server/controllers/api/videos/files.ts34
-rw-r--r--server/controllers/object-storage-proxy.ts12
-rw-r--r--server/controllers/static.ts10
-rw-r--r--server/helpers/custom-validators/metrics.ts3
-rw-r--r--server/helpers/custom-validators/video-transcoding.ts2
-rw-r--r--server/helpers/query.ts3
-rw-r--r--server/initializers/checker-after-init.ts2
-rw-r--r--server/lib/activitypub/videos/shared/abstract-builder.ts2
-rw-r--r--server/lib/activitypub/videos/shared/creator.ts2
-rw-r--r--server/lib/activitypub/videos/updater.ts2
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts10
-rw-r--r--server/lib/job-queue/handlers/video-file-import.ts6
-rw-r--r--server/lib/job-queue/handlers/video-import.ts4
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts32
-rw-r--r--server/lib/object-storage/keys.ts4
-rw-r--r--server/lib/object-storage/pre-signed-urls.ts8
-rw-r--r--server/lib/object-storage/proxy.ts8
-rw-r--r--server/lib/object-storage/urls.ts8
-rw-r--r--server/lib/object-storage/videos.ts34
-rw-r--r--server/lib/paths.ts4
-rw-r--r--server/lib/plugins/plugin-helpers-builder.ts10
-rw-r--r--server/lib/runners/job-handlers/shared/vod-helpers.ts4
-rw-r--r--server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts2
-rw-r--r--server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts4
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts4
-rw-r--r--server/lib/transcoding/create-transcoding-job.ts2
-rw-r--r--server/lib/transcoding/shared/job-builders/abstract-job-builder.ts2
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts40
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts4
-rw-r--r--server/lib/transcoding/web-transcoding.ts24
-rw-r--r--server/lib/video-file.ts18
-rw-r--r--server/lib/video-path-manager.ts4
-rw-r--r--server/lib/video-privacy.ts16
-rw-r--r--server/lib/video-studio.ts8
-rw-r--r--server/lib/video-urls.ts4
-rw-r--r--server/middlewares/validators/static.ts8
-rw-r--r--server/middlewares/validators/videos/video-files.ts26
-rw-r--r--server/middlewares/validators/videos/videos.ts6
-rw-r--r--server/models/redundancy/video-redundancy.ts2
-rw-r--r--server/models/user/user.ts6
-rw-r--r--server/models/video/sql/video/shared/abstract-video-query-builder.ts4
-rw-r--r--server/models/video/sql/video/shared/video-file-query-builder.ts12
-rw-r--r--server/models/video/sql/video/shared/video-model-builder.ts20
-rw-r--r--server/models/video/sql/video/video-model-get-query-builder.ts12
-rw-r--r--server/models/video/sql/video/videos-id-list-query-builder.ts16
-rw-r--r--server/models/video/sql/video/videos-model-list-query-builder.ts10
-rw-r--r--server/models/video/video-change-ownership.ts2
-rw-r--r--server/models/video/video-file.ts30
-rw-r--r--server/models/video/video.ts27
-rw-r--r--server/tests/api/check-params/config.ts2
-rw-r--r--server/tests/api/check-params/transcoding.ts14
-rw-r--r--server/tests/api/check-params/video-files.ts44
-rw-r--r--server/tests/api/object-storage/video-static-file-privacy.ts30
-rw-r--r--server/tests/api/object-storage/videos.ts38
-rw-r--r--server/tests/api/redundancy/redundancy.ts18
-rw-r--r--server/tests/api/transcoding/audio-only.ts6
-rw-r--r--server/tests/api/transcoding/create-transcoding.ts14
-rw-r--r--server/tests/api/transcoding/hls.ts2
-rw-r--r--server/tests/api/transcoding/transcoder.ts28
-rw-r--r--server/tests/api/transcoding/update-while-transcoding.ts2
-rw-r--r--server/tests/api/transcoding/video-studio.ts6
-rw-r--r--server/tests/api/users/user-videos.ts2
-rw-r--r--server/tests/api/users/users.ts24
-rw-r--r--server/tests/api/videos/video-files.ts34
-rw-r--r--server/tests/api/videos/videos-common-filters.ts34
-rw-r--r--server/tests/peertube-runner/studio-transcoding.ts4
-rw-r--r--server/tests/peertube-runner/vod-transcoding.ts46
-rw-r--r--server/tests/plugins/plugin-helpers.ts6
-rw-r--r--server/tests/plugins/plugin-transcoding.ts2
-rw-r--r--server/tests/shared/videos.ts10
-rw-r--r--server/tools/peertube-redundancy.ts8
-rw-r--r--server/types/models/video/video-file.ts2
-rw-r--r--server/types/plugins/register-server-option.model.ts12
-rw-r--r--shared/models/search/videos-common-query.model.ts4
-rw-r--r--shared/models/server/job.model.ts12
-rw-r--r--shared/models/users/user-update-me.model.ts2
-rw-r--r--shared/models/users/user.model.ts2
-rw-r--r--shared/models/videos/transcoding/video-transcoding-create.model.ts2
-rw-r--r--shared/server-commands/server/config-command.ts8
-rw-r--r--shared/server-commands/server/servers-command.ts2
-rw-r--r--shared/server-commands/videos/videos-command.ts10
-rw-r--r--support/doc/api/embeds.md2
-rw-r--r--support/doc/api/openapi.yaml46
-rw-r--r--support/doc/tools.md2
102 files changed, 579 insertions, 570 deletions
diff --git a/README.md b/README.md
index 0c2989c62..09585aa15 100644
--- a/README.md
+++ b/README.md
@@ -116,7 +116,7 @@ Be it as a user or an instance administrator, you can decide what your experienc
116 116
117<h3 align="right">Communities that help each other</h3> 117<h3 align="right">Communities that help each other</h3>
118<p align="right"> 118<p align="right">
119In addition to visitors using WebTorrent to share the load among them, instances can help each other by caching one another's videos. This way even small instances have a way to show content to a wider audience, as they will be shouldered by friend instances (more about that in our <a href="https://docs.joinpeertube.org/contribute/architecture#redundancy-between-instances">redundancy guide</a>). 119In addition to visitors using P2P with WebRTC to share the load among them, instances can help each other by caching one another's videos. This way even small instances have a way to show content to a wider audience, as they will be shouldered by friend instances (more about that in our <a href="https://docs.joinpeertube.org/contribute/architecture#redundancy-between-instances">redundancy guide</a>).
120</p> 120</p>
121<p align="right"> 121<p align="right">
122Content creators can get help from their viewers in the simplest way possible: a support button showing a message linking to their donation accounts or really anything else. No more pay-per-view and advertisements that hurt visitors and alter creativity (more about that in our <a href="https://github.com/Chocobozzz/PeerTube/blob/develop/FAQ.md">FAQ</a>). 122Content creators can get help from their viewers in the simplest way possible: a support button showing a message linking to their donation accounts or really anything else. No more pay-per-view and advertisements that hurt visitors and alter creativity (more about that in our <a href="https://github.com/Chocobozzz/PeerTube/blob/develop/FAQ.md">FAQ</a>).
diff --git a/client/e2e/src/suites-all/private-videos.e2e-spec.ts b/client/e2e/src/suites-all/private-videos.e2e-spec.ts
index a25208bb3..829d76a84 100644
--- a/client/e2e/src/suites-all/private-videos.e2e-spec.ts
+++ b/client/e2e/src/suites-all/private-videos.e2e-spec.ts
@@ -31,8 +31,8 @@ describe('Private videos all workflow', () => {
31 return loginPage.loginOnPeerTube2() 31 return loginPage.loginOnPeerTube2()
32 }) 32 })
33 33
34 it('Should play an internal webtorrent video', async () => { 34 it('Should play an internal web video video', async () => {
35 await go(FIXTURE_URLS.INTERNAL_WEBTORRENT_VIDEO) 35 await go(FIXTURE_URLS.INTERNAL_WEB_VIDEO)
36 36
37 await videoWatchPage.waitWatchVideoName(internalVideoName) 37 await videoWatchPage.waitWatchVideoName(internalVideoName)
38 await checkCorrectlyPlay(playerPage) 38 await checkCorrectlyPlay(playerPage)
@@ -52,8 +52,8 @@ describe('Private videos all workflow', () => {
52 await checkCorrectlyPlay(playerPage) 52 await checkCorrectlyPlay(playerPage)
53 }) 53 })
54 54
55 it('Should play an internal WebTorrent video in embed', async () => { 55 it('Should play an internal Web Video in embed', async () => {
56 await go(FIXTURE_URLS.INTERNAL_EMBED_WEBTORRENT_VIDEO) 56 await go(FIXTURE_URLS.INTERNAL_EMBED_WEB_VIDEO)
57 57
58 await videoWatchPage.waitEmbedForDisplayed() 58 await videoWatchPage.waitEmbedForDisplayed()
59 await checkCorrectlyPlay(playerPage) 59 await checkCorrectlyPlay(playerPage)
diff --git a/client/e2e/src/suites-all/videos.e2e-spec.ts b/client/e2e/src/suites-all/videos.e2e-spec.ts
index d1ab9aef3..5d0f8c152 100644
--- a/client/e2e/src/suites-all/videos.e2e-spec.ts
+++ b/client/e2e/src/suites-all/videos.e2e-spec.ts
@@ -89,7 +89,7 @@ describe('Videos all workflow', () => {
89 let videoNameToExcept = videoName 89 let videoNameToExcept = videoName
90 90
91 if (isMobileDevice() || isSafari()) { 91 if (isMobileDevice() || isSafari()) {
92 await go(FIXTURE_URLS.WEBTORRENT_VIDEO) 92 await go(FIXTURE_URLS.WEB_VIDEO)
93 videoNameToExcept = 'E2E tests' 93 videoNameToExcept = 'E2E tests'
94 } else { 94 } else {
95 await videoListPage.clickOnVideo(videoName) 95 await videoListPage.clickOnVideo(videoName)
@@ -176,7 +176,7 @@ describe('Videos all workflow', () => {
176 await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000) 176 await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000)
177 }) 177 })
178 178
179 it('Should watch the webtorrent playlist in the embed', async () => { 179 it('Should watch the WEB VIDEO playlist in the embed', async () => {
180 if (isUploadUnsupported()) return 180 if (isUploadUnsupported()) return
181 181
182 const accessToken = await browser.execute(`return window.localStorage.getItem('access_token');`) 182 const accessToken = await browser.execute(`return window.localStorage.getItem('access_token');`)
diff --git a/client/e2e/src/utils/urls.ts b/client/e2e/src/utils/urls.ts
index cc0bdfbff..eafe0aa5d 100644
--- a/client/e2e/src/utils/urls.ts
+++ b/client/e2e/src/utils/urls.ts
@@ -1,14 +1,14 @@
1const FIXTURE_URLS = { 1const FIXTURE_URLS = {
2 INTERNAL_WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?mode=webtorrent&start=0', 2 INTERNAL_WEB_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?mode=web-video&start=0',
3 INTERNAL_HLS_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?start=0', 3 INTERNAL_HLS_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?start=0',
4 4
5 INTERNAL_EMBED_WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?mode=webtorrent&start=0', 5 INTERNAL_EMBED_WEB_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?mode=web-video&start=0',
6 INTERNAL_EMBED_HLS_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?start=0', 6 INTERNAL_EMBED_HLS_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?start=0',
7 7
8 INTERNAL_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/w/tKQmHcqdYZRdCszLUiWM3V?start=0', 8 INTERNAL_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/w/tKQmHcqdYZRdCszLUiWM3V?start=0',
9 INTERNAL_EMBED_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/videos/embed/tKQmHcqdYZRdCszLUiWM3V?start=0', 9 INTERNAL_EMBED_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/videos/embed/tKQmHcqdYZRdCszLUiWM3V?start=0',
10 10
11 WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e', 11 WEB_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e',
12 12
13 HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50', 13 HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50',
14 HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a', 14 HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a',
diff --git a/client/e2e/wdio.local-test.conf.ts b/client/e2e/wdio.local-test.conf.ts
index 96ddc67ca..6c0171372 100644
--- a/client/e2e/wdio.local-test.conf.ts
+++ b/client/e2e/wdio.local-test.conf.ts
@@ -24,19 +24,19 @@ module.exports = {
24 specFileRetries: 0, 24 specFileRetries: 0,
25 25
26 capabilities: [ 26 capabilities: [
27 { 27 // {
28 'browserName': 'chrome', 28 // 'browserName': 'chrome',
29 'acceptInsecureCerts': true, 29 // 'acceptInsecureCerts': true,
30 'goog:chromeOptions': { 30 // 'goog:chromeOptions': {
31 args: [ '--disable-gpu', windowSizeArg ], 31 // args: [ '--disable-gpu', windowSizeArg ],
32 prefs 32 // prefs
33 } 33 // }
34 }, 34 // },
35 { 35 {
36 'browserName': 'firefox', 36 'browserName': 'firefox',
37 'moz:firefoxOptions': { 37 'moz:firefoxOptions': {
38 binary: '/usr/bin/firefox-developer-edition', 38 binary: '/usr/bin/firefox-developer-edition',
39 args: [ '--headless', windowSizeArg ], 39 // args: [ '--headless', windowSizeArg ],
40 40
41 prefs 41 prefs
42 } 42 }
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
index fb750aca6..7218511a9 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
@@ -71,7 +71,7 @@
71 <div class="form-group" [ngClass]="getTranscodingDisabledClass()"> 71 <div class="form-group" [ngClass]="getTranscodingDisabledClass()">
72 <my-peertube-checkbox 72 <my-peertube-checkbox
73 inputName="transcodingWebTorrentEnabled" formControlName="enabled" 73 inputName="transcodingWebTorrentEnabled" formControlName="enabled"
74 i18n-labelText labelText="WebTorrent enabled" 74 i18n-labelText labelText="Web Videos enabled"
75 > 75 >
76 <ng-template ptTemplate="help"> 76 <ng-template ptTemplate="help">
77 <ng-container> 77 <ng-container>
@@ -93,14 +93,14 @@
93 <ng-container i18n> 93 <ng-container i18n>
94 <strong>Requires ffmpeg >= 4.1</strong> 94 <strong>Requires ffmpeg >= 4.1</strong>
95 95
96 <p>Generate HLS playlists and fragmented MP4 files resulting in a better playback than with plain WebTorrent:</p> 96 <p>Generate HLS playlists and fragmented MP4 files resulting in a better playback than with Web Videos:</p>
97 <ul> 97 <ul>
98 <li>Resolution change is smoother</li> 98 <li>Resolution change is smoother</li>
99 <li>Faster playback especially with long videos</li> 99 <li>Faster playback especially with long videos</li>
100 <li>More stable playback (less bugs/infinite loading)</li> 100 <li>More stable playback (less bugs/infinite loading)</li>
101 </ul> 101 </ul>
102 102
103 <p>If you also enabled WebTorrent support, it will multiply videos storage by 2</p> 103 <p>If you also enabled Web Videos support, it will multiply videos storage by 2</p>
104 </ng-container> 104 </ng-container>
105 </ng-template> 105 </ng-template>
106 </my-peertube-checkbox> 106 </my-peertube-checkbox>
diff --git a/client/src/app/+admin/overview/videos/video-admin.service.ts b/client/src/app/+admin/overview/videos/video-admin.service.ts
index 195b265a1..722495706 100644
--- a/client/src/app/+admin/overview/videos/video-admin.service.ts
+++ b/client/src/app/+admin/overview/videos/video-admin.service.ts
@@ -59,12 +59,12 @@ export class VideoAdminService {
59 title: $localize`Video files`, 59 title: $localize`Video files`,
60 children: [ 60 children: [
61 { 61 {
62 value: 'webtorrent:true isLocal:true', 62 value: 'webVideos:true isLocal:true',
63 label: $localize`With WebTorrent` 63 label: $localize`With Web Videos`
64 }, 64 },
65 { 65 {
66 value: 'webtorrent:false isLocal:true', 66 value: 'webVideos:false isLocal:true',
67 label: $localize`Without WebTorrent` 67 label: $localize`Without Web Videos`
68 }, 68 },
69 { 69 {
70 value: 'hls:true isLocal:true', 70 value: 'hls:true isLocal:true',
@@ -126,8 +126,8 @@ export class VideoAdminService {
126 prefix: 'hls:', 126 prefix: 'hls:',
127 isBoolean: true 127 isBoolean: true
128 }, 128 },
129 hasWebtorrentFiles: { 129 hasWebVideoFiles: {
130 prefix: 'webtorrent:', 130 prefix: 'webVideos:',
131 isBoolean: true 131 isBoolean: true
132 }, 132 },
133 isLive: { 133 isLive: {
diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html
index c4f78cadc..3a4666435 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -83,8 +83,8 @@
83 </td> 83 </td>
84 84
85 <td> 85 <td>
86 <span *ngIf="isHLS(video)" class="pt-badge badge-blue">HLS</span> 86 <span *ngIf="hasHLS(video)" class="pt-badge badge-blue">HLS</span>
87 <span *ngIf="isWebTorrent(video)" class="pt-badge badge-blue">WebTorrent ({{ video.files.length }})</span> 87 <span *ngIf="hasWebVideos(video)" class="pt-badge badge-blue">Web Videos ({{ video.files.length }})</span>
88 <span i18n *ngIf="video.isLive" class="pt-badge badge-blue">Live</span> 88 <span i18n *ngIf="video.isLive" class="pt-badge badge-blue">Live</span>
89 <span i18n *ngIf="hasObjectStorage(video)" class="pt-badge badge-purple">Object storage</span> 89 <span i18n *ngIf="hasObjectStorage(video)" class="pt-badge badge-purple">Object storage</span>
90 90
@@ -102,8 +102,8 @@
102 <tr> 102 <tr>
103 <td class="video-info expand-cell" myAutoColspan> 103 <td class="video-info expand-cell" myAutoColspan>
104 <div> 104 <div>
105 <div *ngIf="isWebTorrent(video)"> 105 <div *ngIf="hasWebVideos(video)">
106 WebTorrent: 106 Web Videos:
107 107
108 <ul> 108 <ul>
109 <li *ngFor="let file of video.files"> 109 <li *ngFor="let file of video.files">
@@ -112,13 +112,13 @@
112 <my-global-icon 112 <my-global-icon
113 *ngIf="canRemoveOneFile(video)" 113 *ngIf="canRemoveOneFile(video)"
114 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button" 114 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button"
115 (click)="removeVideoFile(video, file, 'webtorrent')" 115 (click)="removeVideoFile(video, file, 'web-videos')"
116 ></my-global-icon> 116 ></my-global-icon>
117 </li> 117 </li>
118 </ul> 118 </ul>
119 </div> 119 </div>
120 120
121 <div *ngIf="isHLS(video)"> 121 <div *ngIf="hasHLS(video)">
122 HLS: 122 HLS:
123 123
124 <ul> 124 <ul>
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index e9c526193..52f02d8d0 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -99,8 +99,8 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
99 iconName: 'cog' 99 iconName: 'cog'
100 }, 100 },
101 { 101 {
102 label: $localize`Run WebTorrent transcoding`, 102 label: $localize`Run Web Video transcoding`,
103 handler: videos => this.runTranscoding(videos, 'webtorrent'), 103 handler: videos => this.runTranscoding(videos, 'web-video'),
104 isDisplayed: videos => videos.every(v => v.canRunTranscoding(this.authUser)), 104 isDisplayed: videos => videos.every(v => v.canRunTranscoding(this.authUser)),
105 iconName: 'cog' 105 iconName: 'cog'
106 }, 106 },
@@ -111,8 +111,8 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
111 iconName: 'delete' 111 iconName: 'delete'
112 }, 112 },
113 { 113 {
114 label: $localize`Delete WebTorrent files`, 114 label: $localize`Delete Web Video files`,
115 handler: videos => this.removeVideoFiles(videos, 'webtorrent'), 115 handler: videos => this.removeVideoFiles(videos, 'web-videos'),
116 isDisplayed: videos => videos.every(v => v.canRemoveFiles(this.authUser)), 116 isDisplayed: videos => videos.every(v => v.canRemoveFiles(this.authUser)),
117 iconName: 'delete' 117 iconName: 'delete'
118 } 118 }
@@ -150,14 +150,14 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
150 return video.state.id === VideoState.TO_IMPORT 150 return video.state.id === VideoState.TO_IMPORT
151 } 151 }
152 152
153 isHLS (video: Video) { 153 hasHLS (video: Video) {
154 const p = video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS) 154 const p = video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
155 if (!p) return false 155 if (!p) return false
156 156
157 return p.files.length !== 0 157 return p.files.length !== 0
158 } 158 }
159 159
160 isWebTorrent (video: Video) { 160 hasWebVideos (video: Video) {
161 return video.files.length !== 0 161 return video.files.length !== 0
162 } 162 }
163 163
@@ -176,14 +176,14 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
176 getFilesSize (video: Video) { 176 getFilesSize (video: Video) {
177 let files = video.files 177 let files = video.files
178 178
179 if (this.isHLS(video)) { 179 if (this.hasHLS(video)) {
180 files = files.concat(video.streamingPlaylists[0].files) 180 files = files.concat(video.streamingPlaylists[0].files)
181 } 181 }
182 182
183 return files.reduce((p, f) => p += f.size, 0) 183 return files.reduce((p, f) => p += f.size, 0)
184 } 184 }
185 185
186 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') { 186 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'web-videos') {
187 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?` 187 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
188 const res = await this.confirmService.confirm(message, $localize`Delete file`) 188 const res = await this.confirmService.confirm(message, $localize`Delete file`)
189 if (res === false) return 189 if (res === false) return
@@ -262,7 +262,7 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
262 }) 262 })
263 } 263 }
264 264
265 private async removeVideoFiles (videos: Video[], type: 'hls' | 'webtorrent') { 265 private async removeVideoFiles (videos: Video[], type: 'hls' | 'web-videos') {
266 let message: string 266 let message: string
267 267
268 if (type === 'hls') { 268 if (type === 'hls') {
@@ -274,7 +274,7 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
274 } else { 274 } else {
275 // eslint-disable-next-line max-len 275 // eslint-disable-next-line max-len
276 message = formatICU( 276 message = formatICU(
277 $localize`Are you sure you want to delete WebTorrent files of {count, plural, =1 {1 video} other {{count} videos}}?`, 277 $localize`Are you sure you want to delete Web Video files of {count, plural, =1 {1 video} other {{count} videos}}?`,
278 { count: videos.length } 278 { count: videos.length }
279 ) 279 )
280 } 280 }
@@ -293,7 +293,7 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
293 }) 293 })
294 } 294 }
295 295
296 private runTranscoding (videos: Video[], type: 'hls' | 'webtorrent') { 296 private runTranscoding (videos: Video[], type: 'hls' | 'web-video') {
297 this.videoService.runTranscoding(videos.map(v => v.id), type) 297 this.videoService.runTranscoding(videos.map(v => v.id), type)
298 .subscribe({ 298 .subscribe({
299 next: () => { 299 next: () => {
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts
index d57608f1c..5aa02e472 100644
--- a/client/src/app/core/users/user.model.ts
+++ b/client/src/app/core/users/user.model.ts
@@ -30,8 +30,6 @@ export class User implements UserServerModel {
30 autoPlayNextVideoPlaylist: boolean 30 autoPlayNextVideoPlaylist: boolean
31 31
32 p2pEnabled: boolean 32 p2pEnabled: boolean
33 // FIXME: deprecated in 4.1
34 webTorrentEnabled: never
35 33
36 videosHistoryEnabled: boolean 34 videosHistoryEnabled: boolean
37 videoLanguages: string[] 35 videoLanguages: string[]
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index e94087dbe..1ffc40411 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -252,7 +252,7 @@ export class Video implements VideoServerModel {
252 user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) && 252 user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&
253 this.state.id !== VideoState.TO_TRANSCODE && 253 this.state.id !== VideoState.TO_TRANSCODE &&
254 this.hasHLS() && 254 this.hasHLS() &&
255 this.hasWebTorrent() 255 this.hasWebVideos()
256 } 256 }
257 257
258 canRunTranscoding (user: AuthUser) { 258 canRunTranscoding (user: AuthUser) {
@@ -265,7 +265,7 @@ export class Video implements VideoServerModel {
265 return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS) 265 return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
266 } 266 }
267 267
268 hasWebTorrent () { 268 hasWebVideos () {
269 return this.files && this.files.length !== 0 269 return this.files && this.files.length !== 0
270 } 270 }
271 271
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index 4e8b84dfc..20145b9c5 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -311,7 +311,7 @@ export class VideoService {
311 ) 311 )
312 } 312 }
313 313
314 removeVideoFiles (videoIds: (number | string)[], type: 'hls' | 'webtorrent') { 314 removeVideoFiles (videoIds: (number | string)[], type: 'hls' | 'web-videos') {
315 return from(videoIds) 315 return from(videoIds)
316 .pipe( 316 .pipe(
317 concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + id + '/' + type)), 317 concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + id + '/' + type)),
@@ -320,12 +320,12 @@ export class VideoService {
320 ) 320 )
321 } 321 }
322 322
323 removeFile (videoId: number | string, fileId: number, type: 'hls' | 'webtorrent') { 323 removeFile (videoId: number | string, fileId: number, type: 'hls' | 'web-videos') {
324 return this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + videoId + '/' + type + '/' + fileId) 324 return this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + videoId + '/' + type + '/' + fileId)
325 .pipe(catchError(err => this.restExtractor.handleError(err))) 325 .pipe(catchError(err => this.restExtractor.handleError(err)))
326 } 326 }
327 327
328 runTranscoding (videoIds: (number | string)[], type: 'hls' | 'webtorrent') { 328 runTranscoding (videoIds: (number | string)[], type: 'hls' | 'web-video') {
329 const body: VideoTranscodingCreate = { transcodingType: type } 329 const body: VideoTranscodingCreate = { transcodingType: type }
330 330
331 return from(videoIds) 331 return from(videoIds)
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 56527ddfa..0a3ada711 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -273,7 +273,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
273 }) 273 })
274 } 274 }
275 275
276 async removeVideoFiles (video: Video, type: 'hls' | 'webtorrent') { 276 async removeVideoFiles (video: Video, type: 'hls' | 'web-videos') {
277 const confirmMessage = $localize`Do you really want to remove "${this.video.name}" files?` 277 const confirmMessage = $localize`Do you really want to remove "${this.video.name}" files?`
278 278
279 const res = await this.confirmService.confirm(confirmMessage, $localize`Remove "${this.video.name}" files`) 279 const res = await this.confirmService.confirm(confirmMessage, $localize`Remove "${this.video.name}" files`)
@@ -290,7 +290,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
290 }) 290 })
291 } 291 }
292 292
293 runTranscoding (video: Video, type: 'hls' | 'webtorrent') { 293 runTranscoding (video: Video, type: 'hls' | 'web-video') {
294 this.videoService.runTranscoding([ video.id ], type) 294 this.videoService.runTranscoding([ video.id ], type)
295 .subscribe({ 295 .subscribe({
296 next: () => { 296 next: () => {
@@ -394,8 +394,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
394 iconName: 'cog' 394 iconName: 'cog'
395 }, 395 },
396 { 396 {
397 label: $localize`Run WebTorrent transcoding`, 397 label: $localize`Run Web Video transcoding`,
398 handler: ({ video }) => this.runTranscoding(video, 'webtorrent'), 398 handler: ({ video }) => this.runTranscoding(video, 'web-video'),
399 isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(), 399 isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
400 iconName: 'cog' 400 iconName: 'cog'
401 }, 401 },
@@ -406,8 +406,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
406 iconName: 'delete' 406 iconName: 'delete'
407 }, 407 },
408 { 408 {
409 label: $localize`Delete WebTorrent files`, 409 label: $localize`Delete Web Video files`,
410 handler: ({ video }) => this.removeVideoFiles(video, 'webtorrent'), 410 handler: ({ video }) => this.removeVideoFiles(video, 'web-videos'),
411 isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(), 411 isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),
412 iconName: 'delete' 412 iconName: 'delete'
413 } 413 }
diff --git a/config/default.yaml b/config/default.yaml
index e54c93ac5..6f78fb7e9 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -201,7 +201,7 @@ object_storage:
201 # Useful when you want to use a CDN/external proxy 201 # Useful when you want to use a CDN/external proxy
202 base_url: '' # Example: 'https://mirror.example.com' 202 base_url: '' # Example: 'https://mirror.example.com'
203 203
204 # Same settings but for webtorrent videos 204 # Same settings but for web videos
205 videos: 205 videos:
206 bucket_name: 'videos' 206 bucket_name: 'videos'
207 prefix: '' 207 prefix: ''
@@ -480,18 +480,18 @@ transcoding:
480 # Transcode and keep original resolution, even if it's above your maximum enabled resolution 480 # Transcode and keep original resolution, even if it's above your maximum enabled resolution
481 always_transcode_original_resolution: true 481 always_transcode_original_resolution: true
482 482
483 # Generate videos in a WebTorrent format (what we do since the first PeerTube release) 483 # Generate videos in a web compatible format
484 # If you also enabled the hls format, it will multiply videos storage by 2 484 # If you also enabled the hls format, it will multiply videos storage by 2
485 # If disabled, breaks federation with PeerTube instances < 2.1 485 # If disabled, breaks federation with PeerTube instances < 2.1
486 webtorrent: 486 webtorrent:
487 enabled: false 487 enabled: false
488 488
489 # /!\ Requires ffmpeg >= 4.1 489 # /!\ Requires ffmpeg >= 4.1
490 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: 490 # Generate HLS playlists and fragmented MP4 files. Better playback than with Web Videos:
491 # * Resolution change is smoother 491 # * Resolution change is smoother
492 # * Faster playback in particular with long videos 492 # * Faster playback in particular with long videos
493 # * More stable playback (less bugs/infinite loading) 493 # * More stable playback (less bugs/infinite loading)
494 # If you also enabled the webtorrent format, it will multiply videos storage by 2 494 # If you also enabled the web videos format, it will multiply videos storage by 2
495 hls: 495 hls:
496 enabled: true 496 enabled: true
497 497
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 83ee48dae..2898a45ac 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -199,7 +199,7 @@ object_storage:
199 # Useful when you want to use a CDN/external proxy 199 # Useful when you want to use a CDN/external proxy
200 base_url: '' # Example: 'https://mirror.example.com' 200 base_url: '' # Example: 'https://mirror.example.com'
201 201
202 # Same settings but for webtorrent videos 202 # Same settings but for web videos
203 videos: 203 videos:
204 bucket_name: 'videos' 204 bucket_name: 'videos'
205 prefix: '' 205 prefix: ''
@@ -490,18 +490,18 @@ transcoding:
490 # Transcode and keep original resolution, even if it's above your maximum enabled resolution 490 # Transcode and keep original resolution, even if it's above your maximum enabled resolution
491 always_transcode_original_resolution: true 491 always_transcode_original_resolution: true
492 492
493 # Generate videos in a WebTorrent format (what we do since the first PeerTube release) 493 # Generate videos in a web compatible format
494 # If you also enabled the hls format, it will multiply videos storage by 2 494 # If you also enabled the hls format, it will multiply videos storage by 2
495 # If disabled, breaks federation with PeerTube instances < 2.1 495 # If disabled, breaks federation with PeerTube instances < 2.1
496 webtorrent: 496 webtorrent:
497 enabled: false 497 enabled: false
498 498
499 # /!\ Requires ffmpeg >= 4.1 499 # /!\ Requires ffmpeg >= 4.1
500 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: 500 # Generate HLS playlists and fragmented MP4 files. Better playback than with Web Videos:
501 # * Resolution change is smoother 501 # * Resolution change is smoother
502 # * Faster playback in particular with long videos 502 # * Faster playback in particular with long videos
503 # * More stable playback (less bugs/infinite loading) 503 # * More stable playback (less bugs/infinite loading)
504 # If you also enabled the webtorrent format, it will multiply videos storage by 2 504 # If you also enabled the web videos format, it will multiply videos storage by 2
505 hls: 505 hls:
506 enabled: true 506 enabled: true
507 507
@@ -599,7 +599,6 @@ video_studio:
599 # If enabled, users can create transcoding tasks as they wish 599 # If enabled, users can create transcoding tasks as they wish
600 enabled: false 600 enabled: false
601 601
602
603 # Enable remote runners to transcode studio tasks 602 # Enable remote runners to transcode studio tasks
604 # If enabled, your instance won't transcode the videos itself 603 # If enabled, your instance won't transcode the videos itself
605 # At least 1 remote runner must be configured to transcode your videos 604 # At least 1 remote runner must be configured to transcode your videos
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index d19594a60..8d1ded59b 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -37,8 +37,8 @@ async function run () {
37 console.log('Detecting files to remove, it could take a while...') 37 console.log('Detecting files to remove, it could take a while...')
38 38
39 toDelete = toDelete.concat( 39 toDelete = toDelete.concat(
40 await pruneDirectory(DIRECTORIES.VIDEOS.PUBLIC, doesWebTorrentFileExist()), 40 await pruneDirectory(DIRECTORIES.VIDEOS.PUBLIC, doesWebVideoFileExist()),
41 await pruneDirectory(DIRECTORIES.VIDEOS.PRIVATE, doesWebTorrentFileExist()), 41 await pruneDirectory(DIRECTORIES.VIDEOS.PRIVATE, doesWebVideoFileExist()),
42 42
43 await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, doesHLSPlaylistExist()), 43 await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, doesHLSPlaylistExist()),
44 await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, doesHLSPlaylistExist()), 44 await pruneDirectory(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, doesHLSPlaylistExist()),
@@ -93,12 +93,12 @@ async function pruneDirectory (directory: string, existFun: ExistFun) {
93 return toDelete 93 return toDelete
94} 94}
95 95
96function doesWebTorrentFileExist () { 96function doesWebVideoFileExist () {
97 return (filePath: string) => { 97 return (filePath: string) => {
98 // Don't delete private directory 98 // Don't delete private directory
99 if (filePath === DIRECTORIES.VIDEOS.PRIVATE) return true 99 if (filePath === DIRECTORIES.VIDEOS.PRIVATE) return true
100 100
101 return VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) 101 return VideoFileModel.doesOwnedWebVideoFileExist(basename(filePath))
102 } 102 }
103} 103}
104 104
diff --git a/server/controllers/api/runners/jobs-files.ts b/server/controllers/api/runners/jobs-files.ts
index 4e69fb902..cb4eff570 100644
--- a/server/controllers/api/runners/jobs-files.ts
+++ b/server/controllers/api/runners/jobs-files.ts
@@ -1,6 +1,6 @@
1import express from 'express' 1import express from 'express'
2import { logger, loggerTagsFactory } from '@server/helpers/logger' 2import { logger, loggerTagsFactory } from '@server/helpers/logger'
3import { proxifyHLS, proxifyWebTorrentFile } from '@server/lib/object-storage' 3import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage'
4import { VideoPathManager } from '@server/lib/video-path-manager' 4import { VideoPathManager } from '@server/lib/video-path-manager'
5import { getStudioTaskFilePath } from '@server/lib/video-studio' 5import { getStudioTaskFilePath } from '@server/lib/video-studio'
6import { apiRateLimiter, asyncMiddleware } from '@server/middlewares' 6import { apiRateLimiter, asyncMiddleware } from '@server/middlewares'
@@ -70,7 +70,7 @@ async function getMaxQualityVideoFile (req: express.Request, res: express.Respon
70 } 70 }
71 71
72 // Web video 72 // Web video
73 return proxifyWebTorrentFile({ 73 return proxifyWebVideoFile({
74 req, 74 req,
75 res, 75 res,
76 filename: file.filename 76 filename: file.filename
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 218091d91..4753308e8 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -213,19 +213,14 @@ async function updateMe (req: express.Request, res: express.Response) {
213 'noInstanceConfigWarningModal', 213 'noInstanceConfigWarningModal',
214 'noAccountSetupWarningModal', 214 'noAccountSetupWarningModal',
215 'noWelcomeModal', 215 'noWelcomeModal',
216 'emailPublic' 216 'emailPublic',
217 'p2pEnabled'
217 ] 218 ]
218 219
219 for (const key of keysToUpdate) { 220 for (const key of keysToUpdate) {
220 if (body[key] !== undefined) user.set(key, body[key]) 221 if (body[key] !== undefined) user.set(key, body[key])
221 } 222 }
222 223
223 if (body.p2pEnabled !== undefined) {
224 user.set('p2pEnabled', body.p2pEnabled)
225 } else if (body.webTorrentEnabled !== undefined) { // FIXME: deprecated in 4.1
226 user.set('p2pEnabled', body.webTorrentEnabled)
227 }
228
229 if (body.email !== undefined) { 224 if (body.email !== undefined) {
230 if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) { 225 if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
231 user.pendingEmail = body.email 226 user.pendingEmail = body.email
diff --git a/server/controllers/api/videos/files.ts b/server/controllers/api/videos/files.ts
index 6d9c0b843..67b60ff63 100644
--- a/server/controllers/api/videos/files.ts
+++ b/server/controllers/api/videos/files.ts
@@ -2,7 +2,8 @@ import express from 'express'
2import toInt from 'validator/lib/toInt' 2import toInt from 'validator/lib/toInt'
3import { logger, loggerTagsFactory } from '@server/helpers/logger' 3import { logger, loggerTagsFactory } from '@server/helpers/logger'
4import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' 4import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'
5import { removeAllWebTorrentFiles, removeHLSFile, removeHLSPlaylist, removeWebTorrentFile } from '@server/lib/video-file' 5import { updatePlaylistAfterFileChange } from '@server/lib/hls'
6import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file'
6import { VideoFileModel } from '@server/models/video/video-file' 7import { VideoFileModel } from '@server/models/video/video-file'
7import { HttpStatusCode, UserRight } from '@shared/models' 8import { HttpStatusCode, UserRight } from '@shared/models'
8import { 9import {
@@ -12,11 +13,10 @@ import {
12 videoFileMetadataGetValidator, 13 videoFileMetadataGetValidator,
13 videoFilesDeleteHLSFileValidator, 14 videoFilesDeleteHLSFileValidator,
14 videoFilesDeleteHLSValidator, 15 videoFilesDeleteHLSValidator,
15 videoFilesDeleteWebTorrentFileValidator, 16 videoFilesDeleteWebVideoFileValidator,
16 videoFilesDeleteWebTorrentValidator, 17 videoFilesDeleteWebVideoValidator,
17 videosGetValidator 18 videosGetValidator
18} from '../../../middlewares' 19} from '../../../middlewares'
19import { updatePlaylistAfterFileChange } from '@server/lib/hls'
20 20
21const lTags = loggerTagsFactory('api', 'video') 21const lTags = loggerTagsFactory('api', 'video')
22const filesRouter = express.Router() 22const filesRouter = express.Router()
@@ -40,17 +40,19 @@ filesRouter.delete('/:id/hls/:videoFileId',
40 asyncMiddleware(removeHLSFileController) 40 asyncMiddleware(removeHLSFileController)
41) 41)
42 42
43filesRouter.delete('/:id/webtorrent', 43filesRouter.delete(
44 [ '/:id/webtorrent', '/:id/web-videos' ], // TODO: remove webtorrent in V7
44 authenticate, 45 authenticate,
45 ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), 46 ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES),
46 asyncMiddleware(videoFilesDeleteWebTorrentValidator), 47 asyncMiddleware(videoFilesDeleteWebVideoValidator),
47 asyncMiddleware(removeAllWebTorrentFilesController) 48 asyncMiddleware(removeAllWebVideoFilesController)
48) 49)
49filesRouter.delete('/:id/webtorrent/:videoFileId', 50filesRouter.delete(
51 [ '/:id/webtorrent/:videoFileId', '/:id/web-videos/:videoFileId' ], // TODO: remove webtorrent in V7
50 authenticate, 52 authenticate,
51 ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), 53 ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES),
52 asyncMiddleware(videoFilesDeleteWebTorrentFileValidator), 54 asyncMiddleware(videoFilesDeleteWebVideoFileValidator),
53 asyncMiddleware(removeWebTorrentFileController) 55 asyncMiddleware(removeWebVideoFileController)
54) 56)
55 57
56// --------------------------------------------------------------------------- 58// ---------------------------------------------------------------------------
@@ -96,24 +98,24 @@ async function removeHLSFileController (req: express.Request, res: express.Respo
96 98
97// --------------------------------------------------------------------------- 99// ---------------------------------------------------------------------------
98 100
99async function removeAllWebTorrentFilesController (req: express.Request, res: express.Response) { 101async function removeAllWebVideoFilesController (req: express.Request, res: express.Response) {
100 const video = res.locals.videoAll 102 const video = res.locals.videoAll
101 103
102 logger.info('Deleting WebTorrent files of %s.', video.url, lTags(video.uuid)) 104 logger.info('Deleting Web Video files of %s.', video.url, lTags(video.uuid))
103 105
104 await removeAllWebTorrentFiles(video) 106 await removeAllWebVideoFiles(video)
105 await federateVideoIfNeeded(video, false, undefined) 107 await federateVideoIfNeeded(video, false, undefined)
106 108
107 return res.sendStatus(HttpStatusCode.NO_CONTENT_204) 109 return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
108} 110}
109 111
110async function removeWebTorrentFileController (req: express.Request, res: express.Response) { 112async function removeWebVideoFileController (req: express.Request, res: express.Response) {
111 const video = res.locals.videoAll 113 const video = res.locals.videoAll
112 114
113 const videoFileId = +req.params.videoFileId 115 const videoFileId = +req.params.videoFileId
114 logger.info('Deleting WebTorrent file %d of %s.', videoFileId, video.url, lTags(video.uuid)) 116 logger.info('Deleting Web Video file %d of %s.', videoFileId, video.url, lTags(video.uuid))
115 117
116 await removeWebTorrentFile(video, videoFileId) 118 await removeWebVideoFile(video, videoFileId)
117 await federateVideoIfNeeded(video, false, undefined) 119 await federateVideoIfNeeded(video, false, undefined)
118 120
119 return res.sendStatus(HttpStatusCode.NO_CONTENT_204) 121 return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
diff --git a/server/controllers/object-storage-proxy.ts b/server/controllers/object-storage-proxy.ts
index 8e2cc4af9..0edde64fe 100644
--- a/server/controllers/object-storage-proxy.ts
+++ b/server/controllers/object-storage-proxy.ts
@@ -1,11 +1,11 @@
1import cors from 'cors' 1import cors from 'cors'
2import express from 'express' 2import express from 'express'
3import { OBJECT_STORAGE_PROXY_PATHS } from '@server/initializers/constants' 3import { OBJECT_STORAGE_PROXY_PATHS } from '@server/initializers/constants'
4import { proxifyHLS, proxifyWebTorrentFile } from '@server/lib/object-storage' 4import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage'
5import { 5import {
6 asyncMiddleware, 6 asyncMiddleware,
7 ensureCanAccessPrivateVideoHLSFiles, 7 ensureCanAccessPrivateVideoHLSFiles,
8 ensureCanAccessVideoPrivateWebTorrentFiles, 8 ensureCanAccessVideoPrivateWebVideoFiles,
9 ensurePrivateObjectStorageProxyIsEnabled, 9 ensurePrivateObjectStorageProxyIsEnabled,
10 optionalAuthenticate 10 optionalAuthenticate
11} from '@server/middlewares' 11} from '@server/middlewares'
@@ -18,8 +18,8 @@ objectStorageProxyRouter.use(cors())
18objectStorageProxyRouter.get(OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + ':filename', 18objectStorageProxyRouter.get(OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + ':filename',
19 ensurePrivateObjectStorageProxyIsEnabled, 19 ensurePrivateObjectStorageProxyIsEnabled,
20 optionalAuthenticate, 20 optionalAuthenticate,
21 asyncMiddleware(ensureCanAccessVideoPrivateWebTorrentFiles), 21 asyncMiddleware(ensureCanAccessVideoPrivateWebVideoFiles),
22 asyncMiddleware(proxifyWebTorrentController) 22 asyncMiddleware(proxifyWebVideoController)
23) 23)
24 24
25objectStorageProxyRouter.get(OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + ':videoUUID/:filename', 25objectStorageProxyRouter.get(OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + ':videoUUID/:filename',
@@ -35,10 +35,10 @@ export {
35 objectStorageProxyRouter 35 objectStorageProxyRouter
36} 36}
37 37
38function proxifyWebTorrentController (req: express.Request, res: express.Response) { 38function proxifyWebVideoController (req: express.Request, res: express.Response) {
39 const filename = req.params.filename 39 const filename = req.params.filename
40 40
41 return proxifyWebTorrentFile({ req, res, filename }) 41 return proxifyWebVideoFile({ req, res, filename })
42} 42}
43 43
44function proxifyHLSController (req: express.Request, res: express.Response) { 44function proxifyHLSController (req: express.Request, res: express.Response) {
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index bbd0dd011..5ce739bfc 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -6,7 +6,7 @@ import { injectQueryToPlaylistUrls } from '@server/lib/hls'
6import { 6import {
7 asyncMiddleware, 7 asyncMiddleware,
8 ensureCanAccessPrivateVideoHLSFiles, 8 ensureCanAccessPrivateVideoHLSFiles,
9 ensureCanAccessVideoPrivateWebTorrentFiles, 9 ensureCanAccessVideoPrivateWebVideoFiles,
10 handleStaticError, 10 handleStaticError,
11 optionalAuthenticate 11 optionalAuthenticate
12} from '@server/middlewares' 12} from '@server/middlewares'
@@ -21,16 +21,16 @@ const staticRouter = express.Router()
21staticRouter.use(cors()) 21staticRouter.use(cors())
22 22
23// --------------------------------------------------------------------------- 23// ---------------------------------------------------------------------------
24// WebTorrent/Classic videos 24// Web videos/Classic videos
25// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
26 26
27const privateWebTorrentStaticMiddlewares = CONFIG.STATIC_FILES.PRIVATE_FILES_REQUIRE_AUTH === true 27const privateWebVideoStaticMiddlewares = CONFIG.STATIC_FILES.PRIVATE_FILES_REQUIRE_AUTH === true
28 ? [ optionalAuthenticate, asyncMiddleware(ensureCanAccessVideoPrivateWebTorrentFiles) ] 28 ? [ optionalAuthenticate, asyncMiddleware(ensureCanAccessVideoPrivateWebVideoFiles) ]
29 : [] 29 : []
30 30
31staticRouter.use( 31staticRouter.use(
32 STATIC_PATHS.PRIVATE_WEBSEED, 32 STATIC_PATHS.PRIVATE_WEBSEED,
33 ...privateWebTorrentStaticMiddlewares, 33 ...privateWebVideoStaticMiddlewares,
34 express.static(DIRECTORIES.VIDEOS.PRIVATE, { fallthrough: false }), 34 express.static(DIRECTORIES.VIDEOS.PRIVATE, { fallthrough: false }),
35 handleStaticError 35 handleStaticError
36) 36)
diff --git a/server/helpers/custom-validators/metrics.ts b/server/helpers/custom-validators/metrics.ts
index 533f8988d..44a863630 100644
--- a/server/helpers/custom-validators/metrics.ts
+++ b/server/helpers/custom-validators/metrics.ts
@@ -1,5 +1,6 @@
1function isValidPlayerMode (value: any) { 1function isValidPlayerMode (value: any) {
2 return value === 'webtorrent' || value === 'p2p-media-loader' 2 // TODO: remove webtorrent in v7
3 return value === 'webtorrent' || value === 'web-video' || value === 'p2p-media-loader'
3} 4}
4 5
5// --------------------------------------------------------------------------- 6// ---------------------------------------------------------------------------
diff --git a/server/helpers/custom-validators/video-transcoding.ts b/server/helpers/custom-validators/video-transcoding.ts
index cf792f996..220530de4 100644
--- a/server/helpers/custom-validators/video-transcoding.ts
+++ b/server/helpers/custom-validators/video-transcoding.ts
@@ -2,7 +2,7 @@ import { exists } from './misc'
2 2
3function isValidCreateTranscodingType (value: any) { 3function isValidCreateTranscodingType (value: any) {
4 return exists(value) && 4 return exists(value) &&
5 (value === 'hls' || value === 'webtorrent') 5 (value === 'hls' || value === 'webtorrent' || value === 'web-video') // TODO: remove webtorrent in v7
6} 6}
7 7
8// --------------------------------------------------------------------------- 8// ---------------------------------------------------------------------------
diff --git a/server/helpers/query.ts b/server/helpers/query.ts
index 10efae41c..c0f78368f 100644
--- a/server/helpers/query.ts
+++ b/server/helpers/query.ts
@@ -23,7 +23,8 @@ function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {
23 'include', 23 'include',
24 'skipCount', 24 'skipCount',
25 'hasHLSFiles', 25 'hasHLSFiles',
26 'hasWebtorrentFiles', 26 'hasWebtorrentFiles', // TODO: Remove in v7
27 'hasWebVideoFiles',
27 'search', 28 'search',
28 'excludeAlreadyWatched' 29 'excludeAlreadyWatched'
29 ]) 30 ])
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index 68dea909d..21bc5911c 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -199,7 +199,7 @@ function checkStorageConfig () {
199function checkTranscodingConfig () { 199function checkTranscodingConfig () {
200 if (CONFIG.TRANSCODING.ENABLED) { 200 if (CONFIG.TRANSCODING.ENABLED) {
201 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false && CONFIG.TRANSCODING.HLS.ENABLED === false) { 201 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false && CONFIG.TRANSCODING.HLS.ENABLED === false) {
202 throw new Error('You need to enable at least WebTorrent transcoding or HLS transcoding.') 202 throw new Error('You need to enable at least Web Video transcoding or HLS transcoding.')
203 } 203 }
204 204
205 if (CONFIG.TRANSCODING.CONCURRENCY <= 0) { 205 if (CONFIG.TRANSCODING.CONCURRENCY <= 0) {
diff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/lib/activitypub/videos/shared/abstract-builder.ts
index 8b6a7fd75..98c2f58eb 100644
--- a/server/lib/activitypub/videos/shared/abstract-builder.ts
+++ b/server/lib/activitypub/videos/shared/abstract-builder.ts
@@ -126,7 +126,7 @@ export abstract class APVideoAbstractBuilder {
126 video.VideoLive = videoLive 126 video.VideoLive = videoLive
127 } 127 }
128 128
129 protected async setWebTorrentFiles (video: MVideoFullLight, t: Transaction) { 129 protected async setWebVideoFiles (video: MVideoFullLight, t: Transaction) {
130 const videoFileAttributes = getFileAttributesFromUrl(video, this.videoObject.url) 130 const videoFileAttributes = getFileAttributesFromUrl(video, this.videoObject.url)
131 const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a)) 131 const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a))
132 132
diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/lib/activitypub/videos/shared/creator.ts
index 3d646ef66..bc139e4fa 100644
--- a/server/lib/activitypub/videos/shared/creator.ts
+++ b/server/lib/activitypub/videos/shared/creator.ts
@@ -33,7 +33,7 @@ export class APVideoCreator extends APVideoAbstractBuilder {
33 33
34 await this.setThumbnail(videoCreated, t) 34 await this.setThumbnail(videoCreated, t)
35 await this.setPreview(videoCreated, t) 35 await this.setPreview(videoCreated, t)
36 await this.setWebTorrentFiles(videoCreated, t) 36 await this.setWebVideoFiles(videoCreated, t)
37 await this.setStreamingPlaylists(videoCreated, t) 37 await this.setStreamingPlaylists(videoCreated, t)
38 await this.setTags(videoCreated, t) 38 await this.setTags(videoCreated, t)
39 await this.setTrackers(videoCreated, t) 39 await this.setTrackers(videoCreated, t)
diff --git a/server/lib/activitypub/videos/updater.ts b/server/lib/activitypub/videos/updater.ts
index c98bce662..522d7b043 100644
--- a/server/lib/activitypub/videos/updater.ts
+++ b/server/lib/activitypub/videos/updater.ts
@@ -50,7 +50,7 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
50 if (thumbnailModel) await videoUpdated.addAndSaveThumbnail(thumbnailModel) 50 if (thumbnailModel) await videoUpdated.addAndSaveThumbnail(thumbnailModel)
51 51
52 await runInReadCommittedTransaction(async t => { 52 await runInReadCommittedTransaction(async t => {
53 await this.setWebTorrentFiles(videoUpdated, t) 53 await this.setWebVideoFiles(videoUpdated, t)
54 await this.setStreamingPlaylists(videoUpdated, t) 54 await this.setStreamingPlaylists(videoUpdated, t)
55 }) 55 })
56 56
diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts
index 26752ff37..9a99b6722 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -4,7 +4,7 @@ import { join } from 'path'
4import { logger, loggerTagsFactory } from '@server/helpers/logger' 4import { logger, loggerTagsFactory } from '@server/helpers/logger'
5import { updateTorrentMetadata } from '@server/helpers/webtorrent' 5import { updateTorrentMetadata } from '@server/helpers/webtorrent'
6import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants' 6import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants'
7import { storeHLSFileFromFilename, storeWebTorrentFile } from '@server/lib/object-storage' 7import { storeHLSFileFromFilename, storeWebVideoFile } from '@server/lib/object-storage'
8import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' 8import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'
9import { VideoPathManager } from '@server/lib/video-path-manager' 9import { VideoPathManager } from '@server/lib/video-path-manager'
10import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state' 10import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state'
@@ -33,9 +33,9 @@ export async function processMoveToObjectStorage (job: Job) {
33 33
34 try { 34 try {
35 if (video.VideoFiles) { 35 if (video.VideoFiles) {
36 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags) 36 logger.debug('Moving %d web video files for video %s.', video.VideoFiles.length, video.uuid, lTags)
37 37
38 await moveWebTorrentFiles(video) 38 await moveWebVideoFiles(video)
39 } 39 }
40 40
41 if (video.VideoStreamingPlaylists) { 41 if (video.VideoStreamingPlaylists) {
@@ -75,11 +75,11 @@ export async function onMoveToObjectStorageFailure (job: Job, err: any) {
75 75
76// --------------------------------------------------------------------------- 76// ---------------------------------------------------------------------------
77 77
78async function moveWebTorrentFiles (video: MVideoWithAllFiles) { 78async function moveWebVideoFiles (video: MVideoWithAllFiles) {
79 for (const file of video.VideoFiles) { 79 for (const file of video.VideoFiles) {
80 if (file.storage !== VideoStorage.FILE_SYSTEM) continue 80 if (file.storage !== VideoStorage.FILE_SYSTEM) continue
81 81
82 const fileUrl = await storeWebTorrentFile(video, file) 82 const fileUrl = await storeWebVideoFile(video, file)
83 83
84 const oldPath = VideoPathManager.Instance.getFSVideoFileOutputPath(video, file) 84 const oldPath = VideoPathManager.Instance.getFSVideoFileOutputPath(video, file)
85 await onFileMoved({ videoOrPlaylist: video, file, fileUrl, oldPath }) 85 await onFileMoved({ videoOrPlaylist: video, file, fileUrl, oldPath })
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts
index 9a4550e4d..d221e8968 100644
--- a/server/lib/job-queue/handlers/video-file-import.ts
+++ b/server/lib/job-queue/handlers/video-file-import.ts
@@ -3,7 +3,7 @@ import { copy, stat } from 'fs-extra'
3import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 3import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
4import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
5import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' 5import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'
6import { generateWebTorrentVideoFilename } from '@server/lib/paths' 6import { generateWebVideoFilename } from '@server/lib/paths'
7import { buildMoveToObjectStorageJob } from '@server/lib/video' 7import { buildMoveToObjectStorageJob } from '@server/lib/video'
8import { VideoPathManager } from '@server/lib/video-path-manager' 8import { VideoPathManager } from '@server/lib/video-path-manager'
9import { VideoModel } from '@server/models/video/video' 9import { VideoModel } from '@server/models/video/video'
@@ -56,7 +56,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
56 56
57 if (currentVideoFile) { 57 if (currentVideoFile) {
58 // Remove old file and old torrent 58 // Remove old file and old torrent
59 await video.removeWebTorrentFile(currentVideoFile) 59 await video.removeWebVideoFile(currentVideoFile)
60 // Remove the old video file from the array 60 // Remove the old video file from the array
61 video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile) 61 video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile)
62 62
@@ -66,7 +66,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) {
66 const newVideoFile = new VideoFileModel({ 66 const newVideoFile = new VideoFileModel({
67 resolution, 67 resolution,
68 extname: fileExt, 68 extname: fileExt,
69 filename: generateWebTorrentVideoFilename(resolution, fileExt), 69 filename: generateWebVideoFilename(resolution, fileExt),
70 storage: VideoStorage.FILE_SYSTEM, 70 storage: VideoStorage.FILE_SYSTEM,
71 size, 71 size,
72 fps, 72 fps,
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 436bf3175..e5cd258d6 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -4,7 +4,7 @@ import { retryTransactionWrapper } from '@server/helpers/database-utils'
4import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' 4import { YoutubeDLWrapper } from '@server/helpers/youtube-dl'
5import { CONFIG } from '@server/initializers/config' 5import { CONFIG } from '@server/initializers/config'
6import { isPostImportVideoAccepted } from '@server/lib/moderation' 6import { isPostImportVideoAccepted } from '@server/lib/moderation'
7import { generateWebTorrentVideoFilename } from '@server/lib/paths' 7import { generateWebVideoFilename } from '@server/lib/paths'
8import { Hooks } from '@server/lib/plugins/hooks' 8import { Hooks } from '@server/lib/plugins/hooks'
9import { ServerConfigManager } from '@server/lib/server-config-manager' 9import { ServerConfigManager } from '@server/lib/server-config-manager'
10import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job' 10import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job'
@@ -148,7 +148,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
148 extname: fileExt, 148 extname: fileExt,
149 resolution, 149 resolution,
150 size: stats.size, 150 size: stats.size,
151 filename: generateWebTorrentVideoFilename(resolution, fileExt), 151 filename: generateWebVideoFilename(resolution, fileExt),
152 fps, 152 fps,
153 videoId: videoImport.videoId 153 videoId: videoImport.videoId
154 } 154 }
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index f8758f170..1c8f4fd9f 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -1,8 +1,8 @@
1import { Job } from 'bullmq' 1import { Job } from 'bullmq'
2import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 2import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
3import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding' 3import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding'
4import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebTorrentResolution } from '@server/lib/transcoding/web-transcoding' 4import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebVideoResolution } from '@server/lib/transcoding/web-transcoding'
5import { removeAllWebTorrentFiles } from '@server/lib/video-file' 5import { removeAllWebVideoFiles } from '@server/lib/video-file'
6import { VideoPathManager } from '@server/lib/video-path-manager' 6import { VideoPathManager } from '@server/lib/video-path-manager'
7import { moveToFailedTranscodingState } from '@server/lib/video-state' 7import { moveToFailedTranscodingState } from '@server/lib/video-state'
8import { UserModel } from '@server/models/user/user' 8import { UserModel } from '@server/models/user/user'
@@ -11,7 +11,7 @@ import { MUser, MUserId, MVideoFullLight } from '@server/types/models'
11import { 11import {
12 HLSTranscodingPayload, 12 HLSTranscodingPayload,
13 MergeAudioTranscodingPayload, 13 MergeAudioTranscodingPayload,
14 NewWebTorrentResolutionTranscodingPayload, 14 NewWebVideoResolutionTranscodingPayload,
15 OptimizeTranscodingPayload, 15 OptimizeTranscodingPayload,
16 VideoTranscodingPayload 16 VideoTranscodingPayload
17} from '@shared/models' 17} from '@shared/models'
@@ -22,9 +22,9 @@ type HandlerFunction = (job: Job, payload: VideoTranscodingPayload, video: MVide
22 22
23const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = { 23const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = {
24 'new-resolution-to-hls': handleHLSJob, 24 'new-resolution-to-hls': handleHLSJob,
25 'new-resolution-to-webtorrent': handleNewWebTorrentResolutionJob, 25 'new-resolution-to-web-video': handleNewWebVideoResolutionJob,
26 'merge-audio-to-webtorrent': handleWebTorrentMergeAudioJob, 26 'merge-audio-to-web-video': handleWebVideoMergeAudioJob,
27 'optimize-to-webtorrent': handleWebTorrentOptimizeJob 27 'optimize-to-web-video': handleWebVideoOptimizeJob
28} 28}
29 29
30const lTags = loggerTagsFactory('transcoding') 30const lTags = loggerTagsFactory('transcoding')
@@ -74,7 +74,7 @@ export {
74// Job handlers 74// Job handlers
75// --------------------------------------------------------------------------- 75// ---------------------------------------------------------------------------
76 76
77async function handleWebTorrentMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) { 77async function handleWebVideoMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) {
78 logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 78 logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
79 79
80 await mergeAudioVideofile({ video, resolution: payload.resolution, fps: payload.fps, job }) 80 await mergeAudioVideofile({ video, resolution: payload.resolution, fps: payload.fps, job })
@@ -84,7 +84,7 @@ async function handleWebTorrentMergeAudioJob (job: Job, payload: MergeAudioTrans
84 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: !payload.hasChildren, video }) 84 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: !payload.hasChildren, video })
85} 85}
86 86
87async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) { 87async function handleWebVideoOptimizeJob (job: Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) {
88 logger.info('Handling optimize transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 88 logger.info('Handling optimize transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
89 89
90 await optimizeOriginalVideofile({ video, inputVideoFile: video.getMaxQualityFile(), quickTranscode: payload.quickTranscode, job }) 90 await optimizeOriginalVideofile({ video, inputVideoFile: video.getMaxQualityFile(), quickTranscode: payload.quickTranscode, job })
@@ -96,12 +96,12 @@ async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodi
96 96
97// --------------------------------------------------------------------------- 97// ---------------------------------------------------------------------------
98 98
99async function handleNewWebTorrentResolutionJob (job: Job, payload: NewWebTorrentResolutionTranscodingPayload, video: MVideoFullLight) { 99async function handleNewWebVideoResolutionJob (job: Job, payload: NewWebVideoResolutionTranscodingPayload, video: MVideoFullLight) {
100 logger.info('Handling WebTorrent transcoding job for %s.', video.uuid, lTags(video.uuid), { payload }) 100 logger.info('Handling Web Video transcoding job for %s.', video.uuid, lTags(video.uuid), { payload })
101 101
102 await transcodeNewWebTorrentResolution({ video, resolution: payload.resolution, fps: payload.fps, job }) 102 await transcodeNewWebVideoResolution({ video, resolution: payload.resolution, fps: payload.fps, job })
103 103
104 logger.info('WebTorrent transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload }) 104 logger.info('Web Video transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload })
105 105
106 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video }) 106 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video })
107} 107}
@@ -118,7 +118,7 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, videoArg:
118 video = await VideoModel.loadFull(videoArg.uuid) 118 video = await VideoModel.loadFull(videoArg.uuid)
119 119
120 const videoFileInput = payload.copyCodecs 120 const videoFileInput = payload.copyCodecs
121 ? video.getWebTorrentFile(payload.resolution) 121 ? video.getWebVideoFile(payload.resolution)
122 : video.getMaxQualityFile() 122 : video.getMaxQualityFile()
123 123
124 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist() 124 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist()
@@ -140,10 +140,10 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, videoArg:
140 140
141 logger.info('HLS transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload }) 141 logger.info('HLS transcoding job for %s ended.', video.uuid, lTags(video.uuid), { payload })
142 142
143 if (payload.deleteWebTorrentFiles === true) { 143 if (payload.deleteWebVideoFiles === true) {
144 logger.info('Removing WebTorrent files of %s now we have a HLS version of it.', video.uuid, lTags(video.uuid)) 144 logger.info('Removing Web Video files of %s now we have a HLS version of it.', video.uuid, lTags(video.uuid))
145 145
146 await removeAllWebTorrentFiles(video) 146 await removeAllWebVideoFiles(video)
147 } 147 }
148 148
149 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video }) 149 await onTranscodingEnded({ isNewVideo: payload.isNewVideo, moveVideoToNextState: true, video })
diff --git a/server/lib/object-storage/keys.ts b/server/lib/object-storage/keys.ts
index 4f17073f4..6d2098298 100644
--- a/server/lib/object-storage/keys.ts
+++ b/server/lib/object-storage/keys.ts
@@ -9,12 +9,12 @@ function generateHLSObjectBaseStorageKey (playlist: MStreamingPlaylistVideo) {
9 return join(playlist.getStringType(), playlist.Video.uuid) 9 return join(playlist.getStringType(), playlist.Video.uuid)
10} 10}
11 11
12function generateWebTorrentObjectStorageKey (filename: string) { 12function generateWebVideoObjectStorageKey (filename: string) {
13 return filename 13 return filename
14} 14}
15 15
16export { 16export {
17 generateHLSObjectStorageKey, 17 generateHLSObjectStorageKey,
18 generateHLSObjectBaseStorageKey, 18 generateHLSObjectBaseStorageKey,
19 generateWebTorrentObjectStorageKey 19 generateWebVideoObjectStorageKey
20} 20}
diff --git a/server/lib/object-storage/pre-signed-urls.ts b/server/lib/object-storage/pre-signed-urls.ts
index d8473d01e..313654a57 100644
--- a/server/lib/object-storage/pre-signed-urls.ts
+++ b/server/lib/object-storage/pre-signed-urls.ts
@@ -2,9 +2,9 @@ import { GetObjectCommand } from '@aws-sdk/client-s3'
2import { getSignedUrl } from '@aws-sdk/s3-request-presigner' 2import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
3import { CONFIG } from '@server/initializers/config' 3import { CONFIG } from '@server/initializers/config'
4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' 4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
5import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' 5import { generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'
6import { buildKey, getClient } from './shared' 6import { buildKey, getClient } from './shared'
7import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from './urls' 7import { getHLSPublicFileUrl, getWebVideoPublicFileUrl } from './urls'
8 8
9export async function generateWebVideoPresignedUrl (options: { 9export async function generateWebVideoPresignedUrl (options: {
10 file: MVideoFile 10 file: MVideoFile
@@ -12,7 +12,7 @@ export async function generateWebVideoPresignedUrl (options: {
12}) { 12}) {
13 const { file, downloadFilename } = options 13 const { file, downloadFilename } = options
14 14
15 const key = generateWebTorrentObjectStorageKey(file.filename) 15 const key = generateWebVideoObjectStorageKey(file.filename)
16 16
17 const command = new GetObjectCommand({ 17 const command = new GetObjectCommand({
18 Bucket: CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME, 18 Bucket: CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME,
@@ -22,7 +22,7 @@ export async function generateWebVideoPresignedUrl (options: {
22 22
23 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) 23 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
24 24
25 return getWebTorrentPublicFileUrl(url) 25 return getWebVideoPublicFileUrl(url)
26} 26}
27 27
28export async function generateHLSFilePresignedUrl (options: { 28export async function generateHLSFilePresignedUrl (options: {
diff --git a/server/lib/object-storage/proxy.ts b/server/lib/object-storage/proxy.ts
index c782a8a25..c09a0d1b0 100644
--- a/server/lib/object-storage/proxy.ts
+++ b/server/lib/object-storage/proxy.ts
@@ -7,19 +7,19 @@ import { StreamReplacer } from '@server/helpers/stream-replacer'
7import { MStreamingPlaylist, MVideo } from '@server/types/models' 7import { MStreamingPlaylist, MVideo } from '@server/types/models'
8import { HttpStatusCode } from '@shared/models' 8import { HttpStatusCode } from '@shared/models'
9import { injectQueryToPlaylistUrls } from '../hls' 9import { injectQueryToPlaylistUrls } from '../hls'
10import { getHLSFileReadStream, getWebTorrentFileReadStream } from './videos' 10import { getHLSFileReadStream, getWebVideoFileReadStream } from './videos'
11 11
12export async function proxifyWebTorrentFile (options: { 12export async function proxifyWebVideoFile (options: {
13 req: express.Request 13 req: express.Request
14 res: express.Response 14 res: express.Response
15 filename: string 15 filename: string
16}) { 16}) {
17 const { req, res, filename } = options 17 const { req, res, filename } = options
18 18
19 logger.debug('Proxifying WebTorrent file %s from object storage.', filename) 19 logger.debug('Proxifying Web Video file %s from object storage.', filename)
20 20
21 try { 21 try {
22 const { response: s3Response, stream } = await getWebTorrentFileReadStream({ 22 const { response: s3Response, stream } = await getWebVideoFileReadStream({
23 filename, 23 filename,
24 rangeHeader: req.header('range') 24 rangeHeader: req.header('range')
25 }) 25 })
diff --git a/server/lib/object-storage/urls.ts b/server/lib/object-storage/urls.ts
index b8ef94559..84bc1f6c0 100644
--- a/server/lib/object-storage/urls.ts
+++ b/server/lib/object-storage/urls.ts
@@ -9,7 +9,7 @@ function getInternalUrl (config: BucketInfo, keyWithoutPrefix: string) {
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
12function getWebTorrentPublicFileUrl (fileUrl: string) { 12function getWebVideoPublicFileUrl (fileUrl: string) {
13 const baseUrl = CONFIG.OBJECT_STORAGE.VIDEOS.BASE_URL 13 const baseUrl = CONFIG.OBJECT_STORAGE.VIDEOS.BASE_URL
14 if (!baseUrl) return fileUrl 14 if (!baseUrl) return fileUrl
15 15
@@ -29,7 +29,7 @@ function getHLSPrivateFileUrl (video: MVideoUUID, filename: string) {
29 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + video.uuid + `/${filename}` 29 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.STREAMING_PLAYLISTS.PRIVATE_HLS + video.uuid + `/${filename}`
30} 30}
31 31
32function getWebTorrentPrivateFileUrl (filename: string) { 32function getWebVideoPrivateFileUrl (filename: string) {
33 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + filename 33 return WEBSERVER.URL + OBJECT_STORAGE_PROXY_PATHS.PRIVATE_WEBSEED + filename
34} 34}
35 35
@@ -38,11 +38,11 @@ function getWebTorrentPrivateFileUrl (filename: string) {
38export { 38export {
39 getInternalUrl, 39 getInternalUrl,
40 40
41 getWebTorrentPublicFileUrl, 41 getWebVideoPublicFileUrl,
42 getHLSPublicFileUrl, 42 getHLSPublicFileUrl,
43 43
44 getHLSPrivateFileUrl, 44 getHLSPrivateFileUrl,
45 getWebTorrentPrivateFileUrl, 45 getWebVideoPrivateFileUrl,
46 46
47 replaceByBaseUrl 47 replaceByBaseUrl
48} 48}
diff --git a/server/lib/object-storage/videos.ts b/server/lib/object-storage/videos.ts
index 9152c5352..300c1f7e1 100644
--- a/server/lib/object-storage/videos.ts
+++ b/server/lib/object-storage/videos.ts
@@ -4,7 +4,7 @@ import { CONFIG } from '@server/initializers/config'
4import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models' 4import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models'
5import { getHLSDirectory } from '../paths' 5import { getHLSDirectory } from '../paths'
6import { VideoPathManager } from '../video-path-manager' 6import { VideoPathManager } from '../video-path-manager'
7import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' 7import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'
8import { 8import {
9 createObjectReadStream, 9 createObjectReadStream,
10 listKeysOfPrefix, 10 listKeysOfPrefix,
@@ -55,10 +55,10 @@ function storeHLSFileFromContent (playlist: MStreamingPlaylistVideo, path: strin
55 55
56// --------------------------------------------------------------------------- 56// ---------------------------------------------------------------------------
57 57
58function storeWebTorrentFile (video: MVideo, file: MVideoFile) { 58function storeWebVideoFile (video: MVideo, file: MVideoFile) {
59 return storeObject({ 59 return storeObject({
60 inputPath: VideoPathManager.Instance.getFSVideoFileOutputPath(video, file), 60 inputPath: VideoPathManager.Instance.getFSVideoFileOutputPath(video, file),
61 objectStorageKey: generateWebTorrentObjectStorageKey(file.filename), 61 objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
62 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS, 62 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
63 isPrivate: video.hasPrivateStaticPath() 63 isPrivate: video.hasPrivateStaticPath()
64 }) 64 })
@@ -66,9 +66,9 @@ function storeWebTorrentFile (video: MVideo, file: MVideoFile) {
66 66
67// --------------------------------------------------------------------------- 67// ---------------------------------------------------------------------------
68 68
69async function updateWebTorrentFileACL (video: MVideo, file: MVideoFile) { 69async function updateWebVideoFileACL (video: MVideo, file: MVideoFile) {
70 await updateObjectACL({ 70 await updateObjectACL({
71 objectStorageKey: generateWebTorrentObjectStorageKey(file.filename), 71 objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
72 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS, 72 bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
73 isPrivate: video.hasPrivateStaticPath() 73 isPrivate: video.hasPrivateStaticPath()
74 }) 74 })
@@ -102,8 +102,8 @@ function removeHLSFileObjectStorageByFullKey (key: string) {
102 102
103// --------------------------------------------------------------------------- 103// ---------------------------------------------------------------------------
104 104
105function removeWebTorrentObjectStorage (videoFile: MVideoFile) { 105function removeWebVideoObjectStorage (videoFile: MVideoFile) {
106 return removeObject(generateWebTorrentObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS) 106 return removeObject(generateWebVideoObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS)
107} 107}
108 108
109// --------------------------------------------------------------------------- 109// ---------------------------------------------------------------------------
@@ -122,10 +122,10 @@ async function makeHLSFileAvailable (playlist: MStreamingPlaylistVideo, filename
122 return destination 122 return destination
123} 123}
124 124
125async function makeWebTorrentFileAvailable (filename: string, destination: string) { 125async function makeWebVideoFileAvailable (filename: string, destination: string) {
126 const key = generateWebTorrentObjectStorageKey(filename) 126 const key = generateWebVideoObjectStorageKey(filename)
127 127
128 logger.info('Fetching WebTorrent file %s from object storage to %s.', key, destination, lTags()) 128 logger.info('Fetching Web Video file %s from object storage to %s.', key, destination, lTags())
129 129
130 await makeAvailable({ 130 await makeAvailable({
131 key, 131 key,
@@ -138,13 +138,13 @@ async function makeWebTorrentFileAvailable (filename: string, destination: strin
138 138
139// --------------------------------------------------------------------------- 139// ---------------------------------------------------------------------------
140 140
141function getWebTorrentFileReadStream (options: { 141function getWebVideoFileReadStream (options: {
142 filename: string 142 filename: string
143 rangeHeader: string 143 rangeHeader: string
144}) { 144}) {
145 const { filename, rangeHeader } = options 145 const { filename, rangeHeader } = options
146 146
147 const key = generateWebTorrentObjectStorageKey(filename) 147 const key = generateWebVideoObjectStorageKey(filename)
148 148
149 return createObjectReadStream({ 149 return createObjectReadStream({
150 key, 150 key,
@@ -174,12 +174,12 @@ function getHLSFileReadStream (options: {
174export { 174export {
175 listHLSFileKeysOf, 175 listHLSFileKeysOf,
176 176
177 storeWebTorrentFile, 177 storeWebVideoFile,
178 storeHLSFileFromFilename, 178 storeHLSFileFromFilename,
179 storeHLSFileFromPath, 179 storeHLSFileFromPath,
180 storeHLSFileFromContent, 180 storeHLSFileFromContent,
181 181
182 updateWebTorrentFileACL, 182 updateWebVideoFileACL,
183 updateHLSFilesACL, 183 updateHLSFilesACL,
184 184
185 removeHLSObjectStorage, 185 removeHLSObjectStorage,
@@ -187,11 +187,11 @@ export {
187 removeHLSFileObjectStorageByPath, 187 removeHLSFileObjectStorageByPath,
188 removeHLSFileObjectStorageByFullKey, 188 removeHLSFileObjectStorageByFullKey,
189 189
190 removeWebTorrentObjectStorage, 190 removeWebVideoObjectStorage,
191 191
192 makeWebTorrentFileAvailable, 192 makeWebVideoFileAvailable,
193 makeHLSFileAvailable, 193 makeHLSFileAvailable,
194 194
195 getWebTorrentFileReadStream, 195 getWebVideoFileReadStream,
196 getHLSFileReadStream 196 getHLSFileReadStream
197} 197}
diff --git a/server/lib/paths.ts b/server/lib/paths.ts
index 470970f55..db1cdede2 100644
--- a/server/lib/paths.ts
+++ b/server/lib/paths.ts
@@ -8,7 +8,7 @@ import { isVideoInPrivateDirectory } from './video-privacy'
8 8
9// ################## Video file name ################## 9// ################## Video file name ##################
10 10
11function generateWebTorrentVideoFilename (resolution: number, extname: string) { 11function generateWebVideoFilename (resolution: number, extname: string) {
12 return buildUUID() + '-' + resolution + extname 12 return buildUUID() + '-' + resolution + extname
13} 13}
14 14
@@ -76,7 +76,7 @@ function getFSTorrentFilePath (videoFile: MVideoFile) {
76 76
77export { 77export {
78 generateHLSVideoFilename, 78 generateHLSVideoFilename,
79 generateWebTorrentVideoFilename, 79 generateWebVideoFilename,
80 80
81 generateTorrentFileName, 81 generateTorrentFileName,
82 getFSTorrentFilePath, 82 getFSTorrentFilePath,
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index d235f52c0..b4e3eece4 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -104,7 +104,7 @@ function buildVideosHelpers () {
104 const video = await VideoModel.loadFull(id) 104 const video = await VideoModel.loadFull(id)
105 if (!video) return undefined 105 if (!video) return undefined
106 106
107 const webtorrentVideoFiles = (video.VideoFiles || []).map(f => ({ 107 const webVideoFiles = (video.VideoFiles || []).map(f => ({
108 path: f.storage === VideoStorage.FILE_SYSTEM 108 path: f.storage === VideoStorage.FILE_SYSTEM
109 ? VideoPathManager.Instance.getFSVideoFileOutputPath(video, f) 109 ? VideoPathManager.Instance.getFSVideoFileOutputPath(video, f)
110 : null, 110 : null,
@@ -138,8 +138,12 @@ function buildVideosHelpers () {
138 })) 138 }))
139 139
140 return { 140 return {
141 webtorrent: { 141 webtorrent: { // TODO: remove in v7
142 videoFiles: webtorrentVideoFiles 142 videoFiles: webVideoFiles
143 },
144
145 webVideo: {
146 videoFiles: webVideoFiles
143 }, 147 },
144 148
145 hls: { 149 hls: {
diff --git a/server/lib/runners/job-handlers/shared/vod-helpers.ts b/server/lib/runners/job-handlers/shared/vod-helpers.ts
index 93ae89ff8..1a2ad02ca 100644
--- a/server/lib/runners/job-handlers/shared/vod-helpers.ts
+++ b/server/lib/runners/job-handlers/shared/vod-helpers.ts
@@ -2,7 +2,7 @@ import { move } from 'fs-extra'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { logger, LoggerTagsFn } from '@server/helpers/logger' 3import { logger, LoggerTagsFn } from '@server/helpers/logger'
4import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 4import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
5import { onWebTorrentVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding' 5import { onWebVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding'
6import { buildNewFile } from '@server/lib/video-file' 6import { buildNewFile } from '@server/lib/video-file'
7import { VideoModel } from '@server/models/video/video' 7import { VideoModel } from '@server/models/video/video'
8import { MVideoFullLight } from '@server/types/models' 8import { MVideoFullLight } from '@server/types/models'
@@ -22,7 +22,7 @@ export async function onVODWebVideoOrAudioMergeTranscodingJob (options: {
22 const newVideoFilePath = join(dirname(videoFilePath), videoFile.filename) 22 const newVideoFilePath = join(dirname(videoFilePath), videoFile.filename)
23 await move(videoFilePath, newVideoFilePath) 23 await move(videoFilePath, newVideoFilePath)
24 24
25 await onWebTorrentVideoFileTranscoding({ 25 await onWebVideoFileTranscoding({
26 video, 26 video,
27 videoFile, 27 videoFile,
28 videoOutputPath: newVideoFilePath 28 videoOutputPath: newVideoFilePath
diff --git a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts b/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
index 5f247d792..905007db9 100644
--- a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
+++ b/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts
@@ -83,7 +83,7 @@ export class VODAudioMergeTranscodingJobHandler extends AbstractVODTranscodingJo
83 83
84 // We can remove the old audio file 84 // We can remove the old audio file
85 const oldAudioFile = video.VideoFiles[0] 85 const oldAudioFile = video.VideoFiles[0]
86 await video.removeWebTorrentFile(oldAudioFile) 86 await video.removeWebVideoFile(oldAudioFile)
87 await oldAudioFile.destroy() 87 await oldAudioFile.destroy()
88 video.VideoFiles = [] 88 video.VideoFiles = []
89 89
diff --git a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts b/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
index cc94bcbda..02845952c 100644
--- a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
+++ b/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts
@@ -5,7 +5,7 @@ import { renameVideoFileInPlaylist } from '@server/lib/hls'
5import { getHlsResolutionPlaylistFilename } from '@server/lib/paths' 5import { getHlsResolutionPlaylistFilename } from '@server/lib/paths'
6import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding' 6import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'
7import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding' 7import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding'
8import { buildNewFile, removeAllWebTorrentFiles } from '@server/lib/video-file' 8import { buildNewFile, removeAllWebVideoFiles } from '@server/lib/video-file'
9import { VideoJobInfoModel } from '@server/models/video/video-job-info' 9import { VideoJobInfoModel } from '@server/models/video/video-job-info'
10import { MVideo } from '@server/types/models' 10import { MVideo } from '@server/types/models'
11import { MRunnerJob } from '@server/types/models/runners' 11import { MRunnerJob } from '@server/types/models/runners'
@@ -106,7 +106,7 @@ export class VODHLSTranscodingJobHandler extends AbstractVODTranscodingJobHandle
106 if (privatePayload.deleteWebVideoFiles === true) { 106 if (privatePayload.deleteWebVideoFiles === true) {
107 logger.info('Removing web video files of %s now we have a HLS version of it.', video.uuid, this.lTags(video.uuid)) 107 logger.info('Removing web video files of %s now we have a HLS version of it.', video.uuid, this.lTags(video.uuid))
108 108
109 await removeAllWebTorrentFiles(video) 109 await removeAllWebVideoFiles(video)
110 } 110 }
111 111
112 logger.info('Runner VOD HLS job %s for %s ended.', runnerJob.uuid, video.uuid, this.lTags(runnerJob.uuid, video.uuid)) 112 logger.info('Runner VOD HLS job %s for %s ended.', runnerJob.uuid, video.uuid, this.lTags(runnerJob.uuid, video.uuid))
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index dc450c338..24d340a73 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -23,7 +23,7 @@ import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlayli
23import { getOrCreateAPVideo } from '../activitypub/videos' 23import { getOrCreateAPVideo } from '../activitypub/videos'
24import { downloadPlaylistSegments } from '../hls' 24import { downloadPlaylistSegments } from '../hls'
25import { removeVideoRedundancy } from '../redundancy' 25import { removeVideoRedundancy } from '../redundancy'
26import { generateHLSRedundancyUrl, generateWebTorrentRedundancyUrl } from '../video-urls' 26import { generateHLSRedundancyUrl, generateWebVideoRedundancyUrl } from '../video-urls'
27import { AbstractScheduler } from './abstract-scheduler' 27import { AbstractScheduler } from './abstract-scheduler'
28 28
29const lTags = loggerTagsFactory('redundancy') 29const lTags = loggerTagsFactory('redundancy')
@@ -244,7 +244,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
244 const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({ 244 const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({
245 expiresOn, 245 expiresOn,
246 url: getLocalVideoCacheFileActivityPubUrl(file), 246 url: getLocalVideoCacheFileActivityPubUrl(file),
247 fileUrl: generateWebTorrentRedundancyUrl(file), 247 fileUrl: generateWebVideoRedundancyUrl(file),
248 strategy, 248 strategy,
249 videoFileId: file.id, 249 videoFileId: file.id,
250 actorId: serverActor.id 250 actorId: serverActor.id
diff --git a/server/lib/transcoding/create-transcoding-job.ts b/server/lib/transcoding/create-transcoding-job.ts
index abe32684d..d78e68b87 100644
--- a/server/lib/transcoding/create-transcoding-job.ts
+++ b/server/lib/transcoding/create-transcoding-job.ts
@@ -15,7 +15,7 @@ export function createOptimizeOrMergeAudioJobs (options: {
15// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
16 16
17export function createTranscodingJobs (options: { 17export function createTranscodingJobs (options: {
18 transcodingType: 'hls' | 'webtorrent' 18 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
19 video: MVideoFullLight 19 video: MVideoFullLight
20 resolutions: number[] 20 resolutions: number[]
21 isNewVideo: boolean 21 isNewVideo: boolean
diff --git a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
index 80dc05bfb..15fc814ae 100644
--- a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts
@@ -12,7 +12,7 @@ export abstract class AbstractJobBuilder {
12 }): Promise<any> 12 }): Promise<any>
13 13
14 abstract createTranscodingJobs (options: { 14 abstract createTranscodingJobs (options: {
15 transcodingType: 'hls' | 'webtorrent' 15 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
16 video: MVideoFullLight 16 video: MVideoFullLight
17 resolutions: number[] 17 resolutions: number[]
18 isNewVideo: boolean 18 isNewVideo: boolean
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
index 4f802e2a6..2ecd57249 100644
--- a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts
@@ -12,7 +12,7 @@ import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAud
12import { 12import {
13 HLSTranscodingPayload, 13 HLSTranscodingPayload,
14 MergeAudioTranscodingPayload, 14 MergeAudioTranscodingPayload,
15 NewWebTorrentResolutionTranscodingPayload, 15 NewWebVideoResolutionTranscodingPayload,
16 OptimizeTranscodingPayload, 16 OptimizeTranscodingPayload,
17 VideoTranscodingPayload 17 VideoTranscodingPayload
18} from '@shared/models' 18} from '@shared/models'
@@ -33,7 +33,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
33 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options 33 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options
34 34
35 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload 35 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload
36 let nextTranscodingSequentialJobPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] 36 let nextTranscodingSequentialJobPayloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[][] = []
37 37
38 const mutexReleaser = videoFileAlreadyLocked 38 const mutexReleaser = videoFileAlreadyLocked
39 ? () => {} 39 ? () => {}
@@ -60,7 +60,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
60 if (CONFIG.TRANSCODING.HLS.ENABLED === true) { 60 if (CONFIG.TRANSCODING.HLS.ENABLED === true) {
61 nextTranscodingSequentialJobPayloads.push([ 61 nextTranscodingSequentialJobPayloads.push([
62 this.buildHLSJobPayload({ 62 this.buildHLSJobPayload({
63 deleteWebTorrentFiles: CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false, 63 deleteWebVideoFiles: CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false,
64 64
65 // We had some issues with a web video quick transcoded while producing a HLS version of it 65 // We had some issues with a web video quick transcoded while producing a HLS version of it
66 copyCodecs: !quickTranscode, 66 copyCodecs: !quickTranscode,
@@ -116,7 +116,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
116 // --------------------------------------------------------------------------- 116 // ---------------------------------------------------------------------------
117 117
118 async createTranscodingJobs (options: { 118 async createTranscodingJobs (options: {
119 transcodingType: 'hls' | 'webtorrent' 119 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
120 video: MVideoFullLight 120 video: MVideoFullLight
121 resolutions: number[] 121 resolutions: number[]
122 isNewVideo: boolean 122 isNewVideo: boolean
@@ -138,8 +138,8 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
138 return this.buildHLSJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo }) 138 return this.buildHLSJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo })
139 } 139 }
140 140
141 if (transcodingType === 'webtorrent') { 141 if (transcodingType === 'webtorrent' || transcodingType === 'web-video') {
142 return this.buildWebTorrentJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo }) 142 return this.buildWebVideoJobPayload({ videoUUID: video.uuid, resolution, fps, isNewVideo })
143 } 143 }
144 144
145 throw new Error('Unknown transcoding type') 145 throw new Error('Unknown transcoding type')
@@ -149,7 +149,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
149 149
150 const parent = transcodingType === 'hls' 150 const parent = transcodingType === 'hls'
151 ? this.buildHLSJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo }) 151 ? this.buildHLSJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo })
152 : this.buildWebTorrentJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo }) 152 : this.buildWebVideoJobPayload({ videoUUID: video.uuid, resolution: maxResolution, fps, isNewVideo })
153 153
154 // Process the last resolution after the other ones to prevent concurrency issue 154 // Process the last resolution after the other ones to prevent concurrency issue
155 // Because low resolutions use the biggest one as ffmpeg input 155 // Because low resolutions use the biggest one as ffmpeg input
@@ -160,8 +160,8 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
160 160
161 private async createTranscodingJobsWithChildren (options: { 161 private async createTranscodingJobsWithChildren (options: {
162 videoUUID: string 162 videoUUID: string
163 parent: (HLSTranscodingPayload | NewWebTorrentResolutionTranscodingPayload) 163 parent: (HLSTranscodingPayload | NewWebVideoResolutionTranscodingPayload)
164 children: (HLSTranscodingPayload | NewWebTorrentResolutionTranscodingPayload)[] 164 children: (HLSTranscodingPayload | NewWebVideoResolutionTranscodingPayload)[]
165 user: MUserId | null 165 user: MUserId | null
166 }) { 166 }) {
167 const { videoUUID, parent, children, user } = options 167 const { videoUUID, parent, children, user } = options
@@ -203,14 +203,14 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
203 options 203 options
204 ) 204 )
205 205
206 const sequentialPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] 206 const sequentialPayloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[][] = []
207 207
208 for (const resolution of resolutionsEnabled) { 208 for (const resolution of resolutionsEnabled) {
209 const fps = computeOutputFPS({ inputFPS: inputVideoFPS, resolution }) 209 const fps = computeOutputFPS({ inputFPS: inputVideoFPS, resolution })
210 210
211 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED) { 211 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED) {
212 const payloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[] = [ 212 const payloads: (NewWebVideoResolutionTranscodingPayload | HLSTranscodingPayload)[] = [
213 this.buildWebTorrentJobPayload({ 213 this.buildWebVideoJobPayload({
214 videoUUID: video.uuid, 214 videoUUID: video.uuid,
215 resolution, 215 resolution,
216 fps, 216 fps,
@@ -253,10 +253,10 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
253 resolution: number 253 resolution: number
254 fps: number 254 fps: number
255 isNewVideo: boolean 255 isNewVideo: boolean
256 deleteWebTorrentFiles?: boolean // default false 256 deleteWebVideoFiles?: boolean // default false
257 copyCodecs?: boolean // default false 257 copyCodecs?: boolean // default false
258 }): HLSTranscodingPayload { 258 }): HLSTranscodingPayload {
259 const { videoUUID, resolution, fps, isNewVideo, deleteWebTorrentFiles = false, copyCodecs = false } = options 259 const { videoUUID, resolution, fps, isNewVideo, deleteWebVideoFiles = false, copyCodecs = false } = options
260 260
261 return { 261 return {
262 type: 'new-resolution-to-hls', 262 type: 'new-resolution-to-hls',
@@ -265,20 +265,20 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
265 fps, 265 fps,
266 copyCodecs, 266 copyCodecs,
267 isNewVideo, 267 isNewVideo,
268 deleteWebTorrentFiles 268 deleteWebVideoFiles
269 } 269 }
270 } 270 }
271 271
272 private buildWebTorrentJobPayload (options: { 272 private buildWebVideoJobPayload (options: {
273 videoUUID: string 273 videoUUID: string
274 resolution: number 274 resolution: number
275 fps: number 275 fps: number
276 isNewVideo: boolean 276 isNewVideo: boolean
277 }): NewWebTorrentResolutionTranscodingPayload { 277 }): NewWebVideoResolutionTranscodingPayload {
278 const { videoUUID, resolution, fps, isNewVideo } = options 278 const { videoUUID, resolution, fps, isNewVideo } = options
279 279
280 return { 280 return {
281 type: 'new-resolution-to-webtorrent', 281 type: 'new-resolution-to-web-video',
282 videoUUID, 282 videoUUID,
283 isNewVideo, 283 isNewVideo,
284 resolution, 284 resolution,
@@ -294,7 +294,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
294 const { videoUUID, isNewVideo, hasChildren } = options 294 const { videoUUID, isNewVideo, hasChildren } = options
295 295
296 return { 296 return {
297 type: 'merge-audio-to-webtorrent', 297 type: 'merge-audio-to-web-video',
298 resolution: DEFAULT_AUDIO_RESOLUTION, 298 resolution: DEFAULT_AUDIO_RESOLUTION,
299 fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE, 299 fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE,
300 videoUUID, 300 videoUUID,
@@ -312,7 +312,7 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
312 const { videoUUID, quickTranscode, isNewVideo, hasChildren } = options 312 const { videoUUID, quickTranscode, isNewVideo, hasChildren } = options
313 313
314 return { 314 return {
315 type: 'optimize-to-webtorrent', 315 type: 'optimize-to-web-video',
316 videoUUID, 316 videoUUID,
317 isNewVideo, 317 isNewVideo,
318 hasChildren, 318 hasChildren,
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
index 4b8bc2f3d..b98172c2d 100644
--- a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
@@ -89,7 +89,7 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
89 // --------------------------------------------------------------------------- 89 // ---------------------------------------------------------------------------
90 90
91 async createTranscodingJobs (options: { 91 async createTranscodingJobs (options: {
92 transcodingType: 'hls' | 'webtorrent' 92 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
93 video: MVideoFullLight 93 video: MVideoFullLight
94 resolutions: number[] 94 resolutions: number[]
95 isNewVideo: boolean 95 isNewVideo: boolean
@@ -130,7 +130,7 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
130 continue 130 continue
131 } 131 }
132 132
133 if (transcodingType === 'webtorrent') { 133 if (transcodingType === 'webtorrent' || transcodingType === 'web-video') {
134 await new VODWebVideoTranscodingJobHandler().create({ 134 await new VODWebVideoTranscodingJobHandler().create({
135 video, 135 video,
136 resolution, 136 resolution,
diff --git a/server/lib/transcoding/web-transcoding.ts b/server/lib/transcoding/web-transcoding.ts
index a499db422..f92d457a0 100644
--- a/server/lib/transcoding/web-transcoding.ts
+++ b/server/lib/transcoding/web-transcoding.ts
@@ -10,7 +10,7 @@ import { VideoResolution, VideoStorage } from '@shared/models'
10import { CONFIG } from '../../initializers/config' 10import { CONFIG } from '../../initializers/config'
11import { VideoFileModel } from '../../models/video/video-file' 11import { VideoFileModel } from '../../models/video/video-file'
12import { JobQueue } from '../job-queue' 12import { JobQueue } from '../job-queue'
13import { generateWebTorrentVideoFilename } from '../paths' 13import { generateWebVideoFilename } from '../paths'
14import { buildFileMetadata } from '../video-file' 14import { buildFileMetadata } from '../video-file'
15import { VideoPathManager } from '../video-path-manager' 15import { VideoPathManager } from '../video-path-manager'
16import { buildFFmpegVOD } from './shared' 16import { buildFFmpegVOD } from './shared'
@@ -63,10 +63,10 @@ export async function optimizeOriginalVideofile (options: {
63 // Important to do this before getVideoFilename() to take in account the new filename 63 // Important to do this before getVideoFilename() to take in account the new filename
64 inputVideoFile.resolution = resolution 64 inputVideoFile.resolution = resolution
65 inputVideoFile.extname = newExtname 65 inputVideoFile.extname = newExtname
66 inputVideoFile.filename = generateWebTorrentVideoFilename(resolution, newExtname) 66 inputVideoFile.filename = generateWebVideoFilename(resolution, newExtname)
67 inputVideoFile.storage = VideoStorage.FILE_SYSTEM 67 inputVideoFile.storage = VideoStorage.FILE_SYSTEM
68 68
69 const { videoFile } = await onWebTorrentVideoFileTranscoding({ 69 const { videoFile } = await onWebVideoFileTranscoding({
70 video, 70 video,
71 videoFile: inputVideoFile, 71 videoFile: inputVideoFile,
72 videoOutputPath 72 videoOutputPath
@@ -83,8 +83,8 @@ export async function optimizeOriginalVideofile (options: {
83 } 83 }
84} 84}
85 85
86// Transcode the original video file to a lower resolution compatible with WebTorrent 86// Transcode the original video file to a lower resolution compatible with web browsers
87export async function transcodeNewWebTorrentResolution (options: { 87export async function transcodeNewWebVideoResolution (options: {
88 video: MVideoFullLight 88 video: MVideoFullLight
89 resolution: VideoResolution 89 resolution: VideoResolution
90 fps: number 90 fps: number
@@ -105,7 +105,7 @@ export async function transcodeNewWebTorrentResolution (options: {
105 const newVideoFile = new VideoFileModel({ 105 const newVideoFile = new VideoFileModel({
106 resolution, 106 resolution,
107 extname: newExtname, 107 extname: newExtname,
108 filename: generateWebTorrentVideoFilename(resolution, newExtname), 108 filename: generateWebVideoFilename(resolution, newExtname),
109 size: 0, 109 size: 0,
110 videoId: video.id 110 videoId: video.id
111 }) 111 })
@@ -126,7 +126,7 @@ export async function transcodeNewWebTorrentResolution (options: {
126 126
127 await buildFFmpegVOD(job).transcode(transcodeOptions) 127 await buildFFmpegVOD(job).transcode(transcodeOptions)
128 128
129 return onWebTorrentVideoFileTranscoding({ video, videoFile: newVideoFile, videoOutputPath }) 129 return onWebVideoFileTranscoding({ video, videoFile: newVideoFile, videoOutputPath })
130 }) 130 })
131 131
132 return result 132 return result
@@ -189,14 +189,14 @@ export async function mergeAudioVideofile (options: {
189 // Important to do this before getVideoFilename() to take in account the new file extension 189 // Important to do this before getVideoFilename() to take in account the new file extension
190 inputVideoFile.extname = newExtname 190 inputVideoFile.extname = newExtname
191 inputVideoFile.resolution = resolution 191 inputVideoFile.resolution = resolution
192 inputVideoFile.filename = generateWebTorrentVideoFilename(inputVideoFile.resolution, newExtname) 192 inputVideoFile.filename = generateWebVideoFilename(inputVideoFile.resolution, newExtname)
193 193
194 // ffmpeg generated a new video file, so update the video duration 194 // ffmpeg generated a new video file, so update the video duration
195 // See https://trac.ffmpeg.org/ticket/5456 195 // See https://trac.ffmpeg.org/ticket/5456
196 video.duration = await getVideoStreamDuration(videoOutputPath) 196 video.duration = await getVideoStreamDuration(videoOutputPath)
197 await video.save() 197 await video.save()
198 198
199 return onWebTorrentVideoFileTranscoding({ 199 return onWebVideoFileTranscoding({
200 video, 200 video,
201 videoFile: inputVideoFile, 201 videoFile: inputVideoFile,
202 videoOutputPath, 202 videoOutputPath,
@@ -210,7 +210,7 @@ export async function mergeAudioVideofile (options: {
210 } 210 }
211} 211}
212 212
213export async function onWebTorrentVideoFileTranscoding (options: { 213export async function onWebVideoFileTranscoding (options: {
214 video: MVideoFullLight 214 video: MVideoFullLight
215 videoFile: MVideoFile 215 videoFile: MVideoFile
216 videoOutputPath: string 216 videoOutputPath: string
@@ -239,8 +239,8 @@ export async function onWebTorrentVideoFileTranscoding (options: {
239 239
240 await createTorrentAndSetInfoHash(video, videoFile) 240 await createTorrentAndSetInfoHash(video, videoFile)
241 241
242 const oldFile = await VideoFileModel.loadWebTorrentFile({ videoId: video.id, fps: videoFile.fps, resolution: videoFile.resolution }) 242 const oldFile = await VideoFileModel.loadWebVideoFile({ videoId: video.id, fps: videoFile.fps, resolution: videoFile.resolution })
243 if (oldFile) await video.removeWebTorrentFile(oldFile) 243 if (oldFile) await video.removeWebVideoFile(oldFile)
244 244
245 await VideoFileModel.customUpsert(videoFile, 'video', undefined) 245 await VideoFileModel.customUpsert(videoFile, 'video', undefined)
246 video.VideoFiles = await video.$get('VideoFiles') 246 video.VideoFiles = await video.$get('VideoFiles')
diff --git a/server/lib/video-file.ts b/server/lib/video-file.ts
index 88d48c945..46af67ccd 100644
--- a/server/lib/video-file.ts
+++ b/server/lib/video-file.ts
@@ -7,7 +7,7 @@ import { getFileSize } from '@shared/extra-utils'
7import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg' 7import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg'
8import { VideoFileMetadata, VideoResolution } from '@shared/models' 8import { VideoFileMetadata, VideoResolution } from '@shared/models'
9import { lTags } from './object-storage/shared' 9import { lTags } from './object-storage/shared'
10import { generateHLSVideoFilename, generateWebTorrentVideoFilename } from './paths' 10import { generateHLSVideoFilename, generateWebVideoFilename } from './paths'
11import { VideoPathManager } from './video-path-manager' 11import { VideoPathManager } from './video-path-manager'
12 12
13async function buildNewFile (options: { 13async function buildNewFile (options: {
@@ -33,7 +33,7 @@ async function buildNewFile (options: {
33 } 33 }
34 34
35 videoFile.filename = mode === 'web-video' 35 videoFile.filename = mode === 'web-video'
36 ? generateWebTorrentVideoFilename(videoFile.resolution, videoFile.extname) 36 ? generateWebVideoFilename(videoFile.resolution, videoFile.extname)
37 : generateHLSVideoFilename(videoFile.resolution) 37 : generateHLSVideoFilename(videoFile.resolution)
38 38
39 return videoFile 39 return videoFile
@@ -85,12 +85,12 @@ async function removeHLSFile (video: MVideoWithAllFiles, fileToDeleteId: number)
85 85
86// --------------------------------------------------------------------------- 86// ---------------------------------------------------------------------------
87 87
88async function removeAllWebTorrentFiles (video: MVideoWithAllFiles) { 88async function removeAllWebVideoFiles (video: MVideoWithAllFiles) {
89 const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 89 const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
90 90
91 try { 91 try {
92 for (const file of video.VideoFiles) { 92 for (const file of video.VideoFiles) {
93 await video.removeWebTorrentFile(file) 93 await video.removeWebVideoFile(file)
94 await file.destroy() 94 await file.destroy()
95 } 95 }
96 96
@@ -102,17 +102,17 @@ async function removeAllWebTorrentFiles (video: MVideoWithAllFiles) {
102 return video 102 return video
103} 103}
104 104
105async function removeWebTorrentFile (video: MVideoWithAllFiles, fileToDeleteId: number) { 105async function removeWebVideoFile (video: MVideoWithAllFiles, fileToDeleteId: number) {
106 const files = video.VideoFiles 106 const files = video.VideoFiles
107 107
108 if (files.length === 1) { 108 if (files.length === 1) {
109 return removeAllWebTorrentFiles(video) 109 return removeAllWebVideoFiles(video)
110 } 110 }
111 111
112 const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 112 const videoFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
113 try { 113 try {
114 const toDelete = files.find(f => f.id === fileToDeleteId) 114 const toDelete = files.find(f => f.id === fileToDeleteId)
115 await video.removeWebTorrentFile(toDelete) 115 await video.removeWebVideoFile(toDelete)
116 await toDelete.destroy() 116 await toDelete.destroy()
117 117
118 video.VideoFiles = files.filter(f => f.id !== toDelete.id) 118 video.VideoFiles = files.filter(f => f.id !== toDelete.id)
@@ -138,8 +138,8 @@ export {
138 138
139 removeHLSPlaylist, 139 removeHLSPlaylist,
140 removeHLSFile, 140 removeHLSFile,
141 removeAllWebTorrentFiles, 141 removeAllWebVideoFiles,
142 removeWebTorrentFile, 142 removeWebVideoFile,
143 143
144 buildFileMetadata 144 buildFileMetadata
145} 145}
diff --git a/server/lib/video-path-manager.ts b/server/lib/video-path-manager.ts
index 9953cae5d..133544bb2 100644
--- a/server/lib/video-path-manager.ts
+++ b/server/lib/video-path-manager.ts
@@ -8,7 +8,7 @@ import { DIRECTORIES } from '@server/initializers/constants'
8import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '@server/types/models' 8import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '@server/types/models'
9import { buildUUID } from '@shared/extra-utils' 9import { buildUUID } from '@shared/extra-utils'
10import { VideoStorage } from '@shared/models' 10import { VideoStorage } from '@shared/models'
11import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' 11import { makeHLSFileAvailable, makeWebVideoFileAvailable } from './object-storage'
12import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths' 12import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'
13import { isVideoInPrivateDirectory } from './video-privacy' 13import { isVideoInPrivateDirectory } from './video-privacy'
14 14
@@ -78,7 +78,7 @@ class VideoPathManager {
78 } 78 }
79 79
80 return this.makeAvailableFactory( 80 return this.makeAvailableFactory(
81 () => makeWebTorrentFileAvailable(videoFile.filename, destination), 81 () => makeWebVideoFileAvailable(videoFile.filename, destination),
82 true, 82 true,
83 cb 83 cb
84 ) 84 )
diff --git a/server/lib/video-privacy.ts b/server/lib/video-privacy.ts
index 39430ef1e..5dd4d9781 100644
--- a/server/lib/video-privacy.ts
+++ b/server/lib/video-privacy.ts
@@ -4,7 +4,7 @@ import { logger } from '@server/helpers/logger'
4import { DIRECTORIES } from '@server/initializers/constants' 4import { DIRECTORIES } from '@server/initializers/constants'
5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
6import { VideoPrivacy, VideoStorage } from '@shared/models' 6import { VideoPrivacy, VideoStorage } from '@shared/models'
7import { updateHLSFilesACL, updateWebTorrentFileACL } from './object-storage' 7import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage'
8 8
9const validPrivacySet = new Set([ 9const validPrivacySet = new Set([
10 VideoPrivacy.PRIVATE, 10 VideoPrivacy.PRIVATE,
@@ -67,9 +67,9 @@ async function moveFiles (options: {
67 67
68 for (const file of video.VideoFiles) { 68 for (const file of video.VideoFiles) {
69 if (file.storage === VideoStorage.FILE_SYSTEM) { 69 if (file.storage === VideoStorage.FILE_SYSTEM) {
70 await moveWebTorrentFileOnFS(type, video, file) 70 await moveWebVideoFileOnFS(type, video, file)
71 } else { 71 } else {
72 await updateWebTorrentFileACL(video, file) 72 await updateWebVideoFileACL(video, file)
73 } 73 }
74 } 74 }
75 75
@@ -84,22 +84,22 @@ async function moveFiles (options: {
84 } 84 }
85} 85}
86 86
87async function moveWebTorrentFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) { 87async function moveWebVideoFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) {
88 const directories = getWebTorrentDirectories(type) 88 const directories = getWebVideoDirectories(type)
89 89
90 const source = join(directories.old, file.filename) 90 const source = join(directories.old, file.filename)
91 const destination = join(directories.new, file.filename) 91 const destination = join(directories.new, file.filename)
92 92
93 try { 93 try {
94 logger.info('Moving WebTorrent files of %s after privacy change (%s -> %s).', video.uuid, source, destination) 94 logger.info('Moving web video files of %s after privacy change (%s -> %s).', video.uuid, source, destination)
95 95
96 await move(source, destination) 96 await move(source, destination)
97 } catch (err) { 97 } catch (err) {
98 logger.error('Cannot move webtorrent file %s to %s after privacy change', source, destination, { err }) 98 logger.error('Cannot move web video file %s to %s after privacy change', source, destination, { err })
99 } 99 }
100} 100}
101 101
102function getWebTorrentDirectories (moveType: MoveType) { 102function getWebVideoDirectories (moveType: MoveType) {
103 if (moveType === 'private-to-public') { 103 if (moveType === 'private-to-public') {
104 return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC } 104 return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC }
105 } 105 }
diff --git a/server/lib/video-studio.ts b/server/lib/video-studio.ts
index 0d3db8f60..f549a7084 100644
--- a/server/lib/video-studio.ts
+++ b/server/lib/video-studio.ts
@@ -12,7 +12,7 @@ import { JobQueue } from './job-queue'
12import { VideoStudioTranscodingJobHandler } from './runners' 12import { VideoStudioTranscodingJobHandler } from './runners'
13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job' 13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job'
14import { getTranscodingJobPriority } from './transcoding/transcoding-priority' 14import { getTranscodingJobPriority } from './transcoding/transcoding-priority'
15import { buildNewFile, removeHLSPlaylist, removeWebTorrentFile } from './video-file' 15import { buildNewFile, removeHLSPlaylist, removeWebVideoFile } from './video-file'
16import { VideoPathManager } from './video-path-manager' 16import { VideoPathManager } from './video-path-manager'
17 17
18const lTags = loggerTagsFactory('video-studio') 18const lTags = loggerTagsFactory('video-studio')
@@ -119,12 +119,12 @@ export async function onVideoStudioEnded (options: {
119// Private 119// Private
120// --------------------------------------------------------------------------- 120// ---------------------------------------------------------------------------
121 121
122async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileException: MVideoFile) { 122async function removeAllFiles (video: MVideoWithAllFiles, webVideoFileException: MVideoFile) {
123 await removeHLSPlaylist(video) 123 await removeHLSPlaylist(video)
124 124
125 for (const file of video.VideoFiles) { 125 for (const file of video.VideoFiles) {
126 if (file.id === webTorrentFileException.id) continue 126 if (file.id === webVideoFileException.id) continue
127 127
128 await removeWebTorrentFile(video, file.id) 128 await removeWebVideoFile(video, file.id)
129 } 129 }
130} 130}
diff --git a/server/lib/video-urls.ts b/server/lib/video-urls.ts
index 64c2c9bf9..0597488ad 100644
--- a/server/lib/video-urls.ts
+++ b/server/lib/video-urls.ts
@@ -9,7 +9,7 @@ function generateHLSRedundancyUrl (video: MVideo, playlist: MStreamingPlaylist)
9 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid 9 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid
10} 10}
11 11
12function generateWebTorrentRedundancyUrl (file: MVideoFile) { 12function generateWebVideoRedundancyUrl (file: MVideoFile) {
13 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename 13 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename
14} 14}
15 15
@@ -26,6 +26,6 @@ function getLocalVideoFileMetadataUrl (video: MVideoUUID, videoFile: MVideoFile)
26export { 26export {
27 getLocalVideoFileMetadataUrl, 27 getLocalVideoFileMetadataUrl,
28 28
29 generateWebTorrentRedundancyUrl, 29 generateWebVideoRedundancyUrl,
30 generateHLSRedundancyUrl 30 generateHLSRedundancyUrl
31} 31}
diff --git a/server/middlewares/validators/static.ts b/server/middlewares/validators/static.ts
index 36a94080c..86cc0a8d7 100644
--- a/server/middlewares/validators/static.ts
+++ b/server/middlewares/validators/static.ts
@@ -22,7 +22,7 @@ const staticFileTokenBypass = new LRUCache<string, LRUValue>({
22 ttl: LRU_CACHE.STATIC_VIDEO_FILES_RIGHTS_CHECK.TTL 22 ttl: LRU_CACHE.STATIC_VIDEO_FILES_RIGHTS_CHECK.TTL
23}) 23})
24 24
25const ensureCanAccessVideoPrivateWebTorrentFiles = [ 25const ensureCanAccessVideoPrivateWebVideoFiles = [
26 query('videoFileToken').optional().custom(exists), 26 query('videoFileToken').optional().custom(exists),
27 27
28 isValidVideoPasswordHeader(), 28 isValidVideoPasswordHeader(),
@@ -48,7 +48,7 @@ const ensureCanAccessVideoPrivateWebTorrentFiles = [
48 return res.sendStatus(HttpStatusCode.FORBIDDEN_403) 48 return res.sendStatus(HttpStatusCode.FORBIDDEN_403)
49 } 49 }
50 50
51 const result = await isWebTorrentAllowed(req, res) 51 const result = await isWebVideoAllowed(req, res)
52 52
53 staticFileTokenBypass.set(cacheKey, result) 53 staticFileTokenBypass.set(cacheKey, result)
54 54
@@ -122,13 +122,13 @@ const ensureCanAccessPrivateVideoHLSFiles = [
122] 122]
123 123
124export { 124export {
125 ensureCanAccessVideoPrivateWebTorrentFiles, 125 ensureCanAccessVideoPrivateWebVideoFiles,
126 ensureCanAccessPrivateVideoHLSFiles 126 ensureCanAccessPrivateVideoHLSFiles
127} 127}
128 128
129// --------------------------------------------------------------------------- 129// ---------------------------------------------------------------------------
130 130
131async function isWebTorrentAllowed (req: express.Request, res: express.Response) { 131async function isWebVideoAllowed (req: express.Request, res: express.Response) {
132 const filename = basename(req.path) 132 const filename = basename(req.path)
133 133
134 const file = await VideoFileModel.loadWithVideoByFilename(filename) 134 const file = await VideoFileModel.loadWithVideoByFilename(filename)
diff --git a/server/middlewares/validators/videos/video-files.ts b/server/middlewares/validators/videos/video-files.ts
index 92c5b9483..6c0ecda42 100644
--- a/server/middlewares/validators/videos/video-files.ts
+++ b/server/middlewares/validators/videos/video-files.ts
@@ -5,7 +5,7 @@ import { MVideo } from '@server/types/models'
5import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode } from '@shared/models'
6import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
7 7
8const videoFilesDeleteWebTorrentValidator = [ 8const videoFilesDeleteWebVideoValidator = [
9 isValidVideoIdParam('id'), 9 isValidVideoIdParam('id'),
10 10
11 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
@@ -16,17 +16,17 @@ const videoFilesDeleteWebTorrentValidator = [
16 16
17 if (!checkLocalVideo(video, res)) return 17 if (!checkLocalVideo(video, res)) return
18 18
19 if (!video.hasWebTorrentFiles()) { 19 if (!video.hasWebVideoFiles()) {
20 return res.fail({ 20 return res.fail({
21 status: HttpStatusCode.BAD_REQUEST_400, 21 status: HttpStatusCode.BAD_REQUEST_400,
22 message: 'This video does not have WebTorrent files' 22 message: 'This video does not have Web Video files'
23 }) 23 })
24 } 24 }
25 25
26 if (!video.getHLSPlaylist()) { 26 if (!video.getHLSPlaylist()) {
27 return res.fail({ 27 return res.fail({
28 status: HttpStatusCode.BAD_REQUEST_400, 28 status: HttpStatusCode.BAD_REQUEST_400,
29 message: 'Cannot delete WebTorrent files since this video does not have HLS playlist' 29 message: 'Cannot delete Web Video files since this video does not have HLS playlist'
30 }) 30 })
31 } 31 }
32 32
@@ -34,7 +34,7 @@ const videoFilesDeleteWebTorrentValidator = [
34 } 34 }
35] 35]
36 36
37const videoFilesDeleteWebTorrentFileValidator = [ 37const videoFilesDeleteWebVideoFileValidator = [
38 isValidVideoIdParam('id'), 38 isValidVideoIdParam('id'),
39 39
40 param('videoFileId') 40 param('videoFileId')
@@ -52,14 +52,14 @@ const videoFilesDeleteWebTorrentFileValidator = [
52 if (!files.find(f => f.id === +req.params.videoFileId)) { 52 if (!files.find(f => f.id === +req.params.videoFileId)) {
53 return res.fail({ 53 return res.fail({
54 status: HttpStatusCode.NOT_FOUND_404, 54 status: HttpStatusCode.NOT_FOUND_404,
55 message: 'This video does not have this WebTorrent file id' 55 message: 'This video does not have this Web Video file id'
56 }) 56 })
57 } 57 }
58 58
59 if (files.length === 1 && !video.getHLSPlaylist()) { 59 if (files.length === 1 && !video.getHLSPlaylist()) {
60 return res.fail({ 60 return res.fail({
61 status: HttpStatusCode.BAD_REQUEST_400, 61 status: HttpStatusCode.BAD_REQUEST_400,
62 message: 'Cannot delete WebTorrent files since this video does not have HLS playlist' 62 message: 'Cannot delete Web Video files since this video does not have HLS playlist'
63 }) 63 })
64 } 64 }
65 65
@@ -87,10 +87,10 @@ const videoFilesDeleteHLSValidator = [
87 }) 87 })
88 } 88 }
89 89
90 if (!video.hasWebTorrentFiles()) { 90 if (!video.hasWebVideoFiles()) {
91 return res.fail({ 91 return res.fail({
92 status: HttpStatusCode.BAD_REQUEST_400, 92 status: HttpStatusCode.BAD_REQUEST_400,
93 message: 'Cannot delete HLS playlist since this video does not have WebTorrent files' 93 message: 'Cannot delete HLS playlist since this video does not have Web Video files'
94 }) 94 })
95 } 95 }
96 96
@@ -128,10 +128,10 @@ const videoFilesDeleteHLSFileValidator = [
128 } 128 }
129 129
130 // Last file to delete 130 // Last file to delete
131 if (hlsFiles.length === 1 && !video.hasWebTorrentFiles()) { 131 if (hlsFiles.length === 1 && !video.hasWebVideoFiles()) {
132 return res.fail({ 132 return res.fail({
133 status: HttpStatusCode.BAD_REQUEST_400, 133 status: HttpStatusCode.BAD_REQUEST_400,
134 message: 'Cannot delete last HLS playlist file since this video does not have WebTorrent files' 134 message: 'Cannot delete last HLS playlist file since this video does not have Web Video files'
135 }) 135 })
136 } 136 }
137 137
@@ -140,8 +140,8 @@ const videoFilesDeleteHLSFileValidator = [
140] 140]
141 141
142export { 142export {
143 videoFilesDeleteWebTorrentValidator, 143 videoFilesDeleteWebVideoValidator,
144 videoFilesDeleteWebTorrentFileValidator, 144 videoFilesDeleteWebVideoFileValidator,
145 145
146 videoFilesDeleteHLSValidator, 146 videoFilesDeleteHLSValidator,
147 videoFilesDeleteHLSFileValidator 147 videoFilesDeleteHLSFileValidator
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index b829e4eb4..b39d13a23 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -506,10 +506,14 @@ const commonVideosFiltersValidator = [
506 .optional() 506 .optional()
507 .customSanitizer(toBooleanOrNull) 507 .customSanitizer(toBooleanOrNull)
508 .custom(isBooleanValid).withMessage('Should have a valid hasHLSFiles boolean'), 508 .custom(isBooleanValid).withMessage('Should have a valid hasHLSFiles boolean'),
509 query('hasWebtorrentFiles') 509 query('hasWebtorrentFiles') // TODO: remove in v7
510 .optional() 510 .optional()
511 .customSanitizer(toBooleanOrNull) 511 .customSanitizer(toBooleanOrNull)
512 .custom(isBooleanValid).withMessage('Should have a valid hasWebtorrentFiles boolean'), 512 .custom(isBooleanValid).withMessage('Should have a valid hasWebtorrentFiles boolean'),
513 query('hasWebVideoFiles')
514 .optional()
515 .customSanitizer(toBooleanOrNull)
516 .custom(isBooleanValid).withMessage('Should have a valid hasWebVideoFiles boolean'),
513 query('skipCount') 517 query('skipCount')
514 .optional() 518 .optional()
515 .customSanitizer(toBooleanOrNull) 519 .customSanitizer(toBooleanOrNull)
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index c2a72b71f..cebf47dfd 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -162,7 +162,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu
162 const logIdentifier = `${videoFile.Video.uuid}-${videoFile.resolution}` 162 const logIdentifier = `${videoFile.Video.uuid}-${videoFile.resolution}`
163 logger.info('Removing duplicated video file %s.', logIdentifier) 163 logger.info('Removing duplicated video file %s.', logIdentifier)
164 164
165 videoFile.Video.removeWebTorrentFile(videoFile, true) 165 videoFile.Video.removeWebVideoFile(videoFile, true)
166 .catch(err => logger.error('Cannot delete %s files.', logIdentifier, { err })) 166 .catch(err => logger.error('Cannot delete %s files.', logIdentifier, { err }))
167 } 167 }
168 168
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index 4f6a8fce4..ff6328d48 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -786,7 +786,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
786 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' + 786 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' +
787 `WHERE "account"."userId" = ${options.whereUserId} ${andWhere}` 787 `WHERE "account"."userId" = ${options.whereUserId} ${andWhere}`
788 788
789 const webtorrentFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' + 789 const webVideoFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' +
790 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" AND "video"."isLive" IS FALSE ' + 790 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" AND "video"."isLive" IS FALSE ' +
791 videoChannelJoin 791 videoChannelJoin
792 792
@@ -797,7 +797,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
797 797
798 return 'SELECT COALESCE(SUM("size"), 0) AS "total" ' + 798 return 'SELECT COALESCE(SUM("size"), 0) AS "total" ' +
799 'FROM (' + 799 'FROM (' +
800 `SELECT MAX("t1"."size") AS "size" FROM (${webtorrentFiles} UNION ${hlsFiles}) t1 ` + 800 `SELECT MAX("t1"."size") AS "size" FROM (${webVideoFiles} UNION ${hlsFiles}) t1 ` +
801 'GROUP BY "t1"."videoId"' + 801 'GROUP BY "t1"."videoId"' +
802 ') t2' 802 ') t2'
803 } 803 }
@@ -890,8 +890,6 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
890 890
891 nsfwPolicy: this.nsfwPolicy, 891 nsfwPolicy: this.nsfwPolicy,
892 892
893 // FIXME: deprecated in 4.1
894 webTorrentEnabled: this.p2pEnabled,
895 p2pEnabled: this.p2pEnabled, 893 p2pEnabled: this.p2pEnabled,
896 894
897 videosHistoryEnabled: this.videosHistoryEnabled, 895 videosHistoryEnabled: this.videosHistoryEnabled,
diff --git a/server/models/video/sql/video/shared/abstract-video-query-builder.ts b/server/models/video/sql/video/shared/abstract-video-query-builder.ts
index cbd57ad8c..56a00aa0c 100644
--- a/server/models/video/sql/video/shared/abstract-video-query-builder.ts
+++ b/server/models/video/sql/video/shared/abstract-video-query-builder.ts
@@ -111,7 +111,7 @@ export class AbstractVideoQueryBuilder extends AbstractRunQuery {
111 } 111 }
112 } 112 }
113 113
114 protected includeWebtorrentFiles () { 114 protected includeWebVideoFiles () {
115 this.addJoin('LEFT JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"') 115 this.addJoin('LEFT JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"')
116 116
117 this.attributes = { 117 this.attributes = {
@@ -263,7 +263,7 @@ export class AbstractVideoQueryBuilder extends AbstractRunQuery {
263 } 263 }
264 } 264 }
265 265
266 protected includeWebTorrentRedundancies () { 266 protected includeWebVideoRedundancies () {
267 this.addJoin( 267 this.addJoin(
268 'LEFT OUTER JOIN "videoRedundancy" AS "VideoFiles->RedundancyVideos" ON ' + 268 'LEFT OUTER JOIN "videoRedundancy" AS "VideoFiles->RedundancyVideos" ON ' +
269 '"VideoFiles"."id" = "VideoFiles->RedundancyVideos"."videoFileId"' 269 '"VideoFiles"."id" = "VideoFiles->RedundancyVideos"."videoFileId"'
diff --git a/server/models/video/sql/video/shared/video-file-query-builder.ts b/server/models/video/sql/video/shared/video-file-query-builder.ts
index cc53a4860..196b72b43 100644
--- a/server/models/video/sql/video/shared/video-file-query-builder.ts
+++ b/server/models/video/sql/video/shared/video-file-query-builder.ts
@@ -14,7 +14,7 @@ export type FileQueryOptions = {
14 14
15/** 15/**
16 * 16 *
17 * Fetch files (webtorrent and streaming playlist) according to a video 17 * Fetch files (web videos and streaming playlist) according to a video
18 * 18 *
19 */ 19 */
20 20
@@ -25,8 +25,8 @@ export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {
25 super(sequelize, 'get') 25 super(sequelize, 'get')
26 } 26 }
27 27
28 queryWebTorrentVideos (options: FileQueryOptions) { 28 queryWebVideos (options: FileQueryOptions) {
29 this.buildWebtorrentFilesQuery(options) 29 this.buildWebVideoFilesQuery(options)
30 30
31 return this.runQuery(options) 31 return this.runQuery(options)
32 } 32 }
@@ -37,15 +37,15 @@ export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {
37 return this.runQuery(options) 37 return this.runQuery(options)
38 } 38 }
39 39
40 private buildWebtorrentFilesQuery (options: FileQueryOptions) { 40 private buildWebVideoFilesQuery (options: FileQueryOptions) {
41 this.attributes = { 41 this.attributes = {
42 '"video"."id"': '' 42 '"video"."id"': ''
43 } 43 }
44 44
45 this.includeWebtorrentFiles() 45 this.includeWebVideoFiles()
46 46
47 if (options.includeRedundancy) { 47 if (options.includeRedundancy) {
48 this.includeWebTorrentRedundancies() 48 this.includeWebVideoRedundancies()
49 } 49 }
50 50
51 this.whereId(options) 51 this.whereId(options)
diff --git a/server/models/video/sql/video/shared/video-model-builder.ts b/server/models/video/sql/video/shared/video-model-builder.ts
index 0a2beb7db..740aa842f 100644
--- a/server/models/video/sql/video/shared/video-model-builder.ts
+++ b/server/models/video/sql/video/shared/video-model-builder.ts
@@ -60,10 +60,10 @@ export class VideoModelBuilder {
60 buildVideosFromRows (options: { 60 buildVideosFromRows (options: {
61 rows: SQLRow[] 61 rows: SQLRow[]
62 include?: VideoInclude 62 include?: VideoInclude
63 rowsWebTorrentFiles?: SQLRow[] 63 rowsWebVideoFiles?: SQLRow[]
64 rowsStreamingPlaylist?: SQLRow[] 64 rowsStreamingPlaylist?: SQLRow[]
65 }) { 65 }) {
66 const { rows, rowsWebTorrentFiles, rowsStreamingPlaylist, include } = options 66 const { rows, rowsWebVideoFiles, rowsStreamingPlaylist, include } = options
67 67
68 this.reinit() 68 this.reinit()
69 69
@@ -85,8 +85,8 @@ export class VideoModelBuilder {
85 this.addActorAvatar(row, 'VideoChannel.Account.Actor', accountActor) 85 this.addActorAvatar(row, 'VideoChannel.Account.Actor', accountActor)
86 } 86 }
87 87
88 if (!rowsWebTorrentFiles) { 88 if (!rowsWebVideoFiles) {
89 this.addWebTorrentFile(row, videoModel) 89 this.addWebVideoFile(row, videoModel)
90 } 90 }
91 91
92 if (!rowsStreamingPlaylist) { 92 if (!rowsStreamingPlaylist) {
@@ -112,7 +112,7 @@ export class VideoModelBuilder {
112 } 112 }
113 } 113 }
114 114
115 this.grabSeparateWebTorrentFiles(rowsWebTorrentFiles) 115 this.grabSeparateWebVideoFiles(rowsWebVideoFiles)
116 this.grabSeparateStreamingPlaylistFiles(rowsStreamingPlaylist) 116 this.grabSeparateStreamingPlaylistFiles(rowsStreamingPlaylist)
117 117
118 return this.videos 118 return this.videos
@@ -140,15 +140,15 @@ export class VideoModelBuilder {
140 this.videos = [] 140 this.videos = []
141 } 141 }
142 142
143 private grabSeparateWebTorrentFiles (rowsWebTorrentFiles?: SQLRow[]) { 143 private grabSeparateWebVideoFiles (rowsWebVideoFiles?: SQLRow[]) {
144 if (!rowsWebTorrentFiles) return 144 if (!rowsWebVideoFiles) return
145 145
146 for (const row of rowsWebTorrentFiles) { 146 for (const row of rowsWebVideoFiles) {
147 const id = row['VideoFiles.id'] 147 const id = row['VideoFiles.id']
148 if (!id) continue 148 if (!id) continue
149 149
150 const videoModel = this.videosMemo[row.id] 150 const videoModel = this.videosMemo[row.id]
151 this.addWebTorrentFile(row, videoModel) 151 this.addWebVideoFile(row, videoModel)
152 this.addRedundancy(row, 'VideoFiles', this.videoFileMemo[id]) 152 this.addRedundancy(row, 'VideoFiles', this.videoFileMemo[id])
153 } 153 }
154 } 154 }
@@ -258,7 +258,7 @@ export class VideoModelBuilder {
258 this.thumbnailsDone.add(id) 258 this.thumbnailsDone.add(id)
259 } 259 }
260 260
261 private addWebTorrentFile (row: SQLRow, videoModel: VideoModel) { 261 private addWebVideoFile (row: SQLRow, videoModel: VideoModel) {
262 const id = row['VideoFiles.id'] 262 const id = row['VideoFiles.id']
263 if (!id || this.videoFileMemo[id]) return 263 if (!id || this.videoFileMemo[id]) return
264 264
diff --git a/server/models/video/sql/video/video-model-get-query-builder.ts b/server/models/video/sql/video/video-model-get-query-builder.ts
index 8e90ff641..3f43d4d92 100644
--- a/server/models/video/sql/video/video-model-get-query-builder.ts
+++ b/server/models/video/sql/video/video-model-get-query-builder.ts
@@ -35,7 +35,7 @@ export type BuildVideoGetQueryOptions = {
35 35
36export class VideoModelGetQueryBuilder { 36export class VideoModelGetQueryBuilder {
37 videoQueryBuilder: VideosModelGetQuerySubBuilder 37 videoQueryBuilder: VideosModelGetQuerySubBuilder
38 webtorrentFilesQueryBuilder: VideoFileQueryBuilder 38 webVideoFilesQueryBuilder: VideoFileQueryBuilder
39 streamingPlaylistFilesQueryBuilder: VideoFileQueryBuilder 39 streamingPlaylistFilesQueryBuilder: VideoFileQueryBuilder
40 40
41 private readonly videoModelBuilder: VideoModelBuilder 41 private readonly videoModelBuilder: VideoModelBuilder
@@ -44,7 +44,7 @@ export class VideoModelGetQueryBuilder {
44 44
45 constructor (protected readonly sequelize: Sequelize) { 45 constructor (protected readonly sequelize: Sequelize) {
46 this.videoQueryBuilder = new VideosModelGetQuerySubBuilder(sequelize) 46 this.videoQueryBuilder = new VideosModelGetQuerySubBuilder(sequelize)
47 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 47 this.webVideoFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
48 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 48 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
49 49
50 this.videoModelBuilder = new VideoModelBuilder('get', new VideoTableAttributes('get')) 50 this.videoModelBuilder = new VideoModelBuilder('get', new VideoTableAttributes('get'))
@@ -57,11 +57,11 @@ export class VideoModelGetQueryBuilder {
57 includeRedundancy: this.shouldIncludeRedundancies(options) 57 includeRedundancy: this.shouldIncludeRedundancies(options)
58 } 58 }
59 59
60 const [ videoRows, webtorrentFilesRows, streamingPlaylistFilesRows ] = await Promise.all([ 60 const [ videoRows, webVideoFilesRows, streamingPlaylistFilesRows ] = await Promise.all([
61 this.videoQueryBuilder.queryVideos(options), 61 this.videoQueryBuilder.queryVideos(options),
62 62
63 VideoModelGetQueryBuilder.videoFilesInclude.has(options.type) 63 VideoModelGetQueryBuilder.videoFilesInclude.has(options.type)
64 ? this.webtorrentFilesQueryBuilder.queryWebTorrentVideos(fileQueryOptions) 64 ? this.webVideoFilesQueryBuilder.queryWebVideos(fileQueryOptions)
65 : Promise.resolve(undefined), 65 : Promise.resolve(undefined),
66 66
67 VideoModelGetQueryBuilder.videoFilesInclude.has(options.type) 67 VideoModelGetQueryBuilder.videoFilesInclude.has(options.type)
@@ -71,7 +71,7 @@ export class VideoModelGetQueryBuilder {
71 71
72 const videos = this.videoModelBuilder.buildVideosFromRows({ 72 const videos = this.videoModelBuilder.buildVideosFromRows({
73 rows: videoRows, 73 rows: videoRows,
74 rowsWebTorrentFiles: webtorrentFilesRows, 74 rowsWebVideoFiles: webVideoFilesRows,
75 rowsStreamingPlaylist: streamingPlaylistFilesRows 75 rowsStreamingPlaylist: streamingPlaylistFilesRows
76 }) 76 })
77 77
@@ -92,7 +92,7 @@ export class VideoModelGetQueryBuilder {
92export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder { 92export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder {
93 protected attributes: { [key: string]: string } 93 protected attributes: { [key: string]: string }
94 94
95 protected webtorrentFilesQuery: string 95 protected webVideoFilesQuery: string
96 protected streamingPlaylistFilesQuery: string 96 protected streamingPlaylistFilesQuery: string
97 97
98 private static readonly trackersInclude = new Set<GetType>([ 'api' ]) 98 private static readonly trackersInclude = new Set<GetType>([ 'api' ])
diff --git a/server/models/video/sql/video/videos-id-list-query-builder.ts b/server/models/video/sql/video/videos-id-list-query-builder.ts
index cba77c1d1..7f2376102 100644
--- a/server/models/video/sql/video/videos-id-list-query-builder.ts
+++ b/server/models/video/sql/video/videos-id-list-query-builder.ts
@@ -48,7 +48,9 @@ export type BuildVideosListQueryOptions = {
48 48
49 hasFiles?: boolean 49 hasFiles?: boolean
50 hasHLSFiles?: boolean 50 hasHLSFiles?: boolean
51 hasWebtorrentFiles?: boolean 51
52 hasWebVideoFiles?: boolean
53 hasWebtorrentFiles?: boolean // TODO: Remove in v7
52 54
53 accountId?: number 55 accountId?: number
54 videoChannelId?: number 56 videoChannelId?: number
@@ -175,7 +177,9 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
175 } 177 }
176 178
177 if (exists(options.hasWebtorrentFiles)) { 179 if (exists(options.hasWebtorrentFiles)) {
178 this.whereWebTorrentFileExists(options.hasWebtorrentFiles) 180 this.whereWebVideoFileExists(options.hasWebtorrentFiles)
181 } else if (exists(options.hasWebVideoFiles)) {
182 this.whereWebVideoFileExists(options.hasWebVideoFiles)
179 } 183 }
180 184
181 if (exists(options.hasHLSFiles)) { 185 if (exists(options.hasHLSFiles)) {
@@ -400,18 +404,18 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
400 } 404 }
401 405
402 private whereFileExists () { 406 private whereFileExists () {
403 this.and.push(`(${this.buildWebTorrentFileExistsQuery(true)} OR ${this.buildHLSFileExistsQuery(true)})`) 407 this.and.push(`(${this.buildWebVideoFileExistsQuery(true)} OR ${this.buildHLSFileExistsQuery(true)})`)
404 } 408 }
405 409
406 private whereWebTorrentFileExists (exists: boolean) { 410 private whereWebVideoFileExists (exists: boolean) {
407 this.and.push(this.buildWebTorrentFileExistsQuery(exists)) 411 this.and.push(this.buildWebVideoFileExistsQuery(exists))
408 } 412 }
409 413
410 private whereHLSFileExists (exists: boolean) { 414 private whereHLSFileExists (exists: boolean) {
411 this.and.push(this.buildHLSFileExistsQuery(exists)) 415 this.and.push(this.buildHLSFileExistsQuery(exists))
412 } 416 }
413 417
414 private buildWebTorrentFileExistsQuery (exists: boolean) { 418 private buildWebVideoFileExistsQuery (exists: boolean) {
415 const prefix = exists ? '' : 'NOT ' 419 const prefix = exists ? '' : 'NOT '
416 420
417 return prefix + 'EXISTS (SELECT 1 FROM "videoFile" WHERE "videoFile"."videoId" = "video"."id")' 421 return prefix + 'EXISTS (SELECT 1 FROM "videoFile" WHERE "videoFile"."videoId" = "video"."id")'
diff --git a/server/models/video/sql/video/videos-model-list-query-builder.ts b/server/models/video/sql/video/videos-model-list-query-builder.ts
index 3fdac4ed3..b73dc28cd 100644
--- a/server/models/video/sql/video/videos-model-list-query-builder.ts
+++ b/server/models/video/sql/video/videos-model-list-query-builder.ts
@@ -18,7 +18,7 @@ export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {
18 private innerQuery: string 18 private innerQuery: string
19 private innerSort: string 19 private innerSort: string
20 20
21 webtorrentFilesQueryBuilder: VideoFileQueryBuilder 21 webVideoFilesQueryBuilder: VideoFileQueryBuilder
22 streamingPlaylistFilesQueryBuilder: VideoFileQueryBuilder 22 streamingPlaylistFilesQueryBuilder: VideoFileQueryBuilder
23 23
24 private readonly videoModelBuilder: VideoModelBuilder 24 private readonly videoModelBuilder: VideoModelBuilder
@@ -27,7 +27,7 @@ export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {
27 super(sequelize, 'list') 27 super(sequelize, 'list')
28 28
29 this.videoModelBuilder = new VideoModelBuilder(this.mode, this.tables) 29 this.videoModelBuilder = new VideoModelBuilder(this.mode, this.tables)
30 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 30 this.webVideoFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
31 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 31 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
32 } 32 }
33 33
@@ -48,12 +48,12 @@ export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {
48 includeRedundancy: false 48 includeRedundancy: false
49 } 49 }
50 50
51 const [ rowsWebTorrentFiles, rowsStreamingPlaylist ] = await Promise.all([ 51 const [ rowsWebVideoFiles, rowsStreamingPlaylist ] = await Promise.all([
52 this.webtorrentFilesQueryBuilder.queryWebTorrentVideos(fileQueryOptions), 52 this.webVideoFilesQueryBuilder.queryWebVideos(fileQueryOptions),
53 this.streamingPlaylistFilesQueryBuilder.queryStreamingPlaylistVideos(fileQueryOptions) 53 this.streamingPlaylistFilesQueryBuilder.queryStreamingPlaylistVideos(fileQueryOptions)
54 ]) 54 ])
55 55
56 return this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include, rowsStreamingPlaylist, rowsWebTorrentFiles }) 56 return this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include, rowsStreamingPlaylist, rowsWebVideoFiles })
57 } 57 }
58 } 58 }
59 59
diff --git a/server/models/video/video-change-ownership.ts b/server/models/video/video-change-ownership.ts
index 2db4b523a..26f072f4f 100644
--- a/server/models/video/video-change-ownership.ts
+++ b/server/models/video/video-change-ownership.ts
@@ -45,7 +45,7 @@ enum ScopeNames {
45 { 45 {
46 model: VideoModel.scope([ 46 model: VideoModel.scope([
47 VideoScopeNames.WITH_THUMBNAILS, 47 VideoScopeNames.WITH_THUMBNAILS,
48 VideoScopeNames.WITH_WEBTORRENT_FILES, 48 VideoScopeNames.WITH_WEB_VIDEO_FILES,
49 VideoScopeNames.WITH_STREAMING_PLAYLISTS, 49 VideoScopeNames.WITH_STREAMING_PLAYLISTS,
50 VideoScopeNames.WITH_ACCOUNT_DETAILS 50 VideoScopeNames.WITH_ACCOUNT_DETAILS
51 ]), 51 ]),
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 07bc13de1..5e476f3c7 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -26,8 +26,8 @@ import { buildRemoteVideoBaseUrl } from '@server/lib/activitypub/url'
26import { 26import {
27 getHLSPrivateFileUrl, 27 getHLSPrivateFileUrl,
28 getHLSPublicFileUrl, 28 getHLSPublicFileUrl,
29 getWebTorrentPrivateFileUrl, 29 getWebVideoPrivateFileUrl,
30 getWebTorrentPublicFileUrl 30 getWebVideoPublicFileUrl
31} from '@server/lib/object-storage' 31} from '@server/lib/object-storage'
32import { getFSTorrentFilePath } from '@server/lib/paths' 32import { getFSTorrentFilePath } from '@server/lib/paths'
33import { isVideoInPrivateDirectory } from '@server/lib/video-privacy' 33import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'
@@ -276,15 +276,15 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
276 276
277 static async doesOwnedTorrentFileExist (filename: string) { 277 static async doesOwnedTorrentFileExist (filename: string) {
278 const query = 'SELECT 1 FROM "videoFile" ' + 278 const query = 'SELECT 1 FROM "videoFile" ' +
279 'LEFT JOIN "video" "webtorrent" ON "webtorrent"."id" = "videoFile"."videoId" AND "webtorrent"."remote" IS FALSE ' + 279 'LEFT JOIN "video" "webvideo" ON "webvideo"."id" = "videoFile"."videoId" AND "webvideo"."remote" IS FALSE ' +
280 'LEFT JOIN "videoStreamingPlaylist" ON "videoStreamingPlaylist"."id" = "videoFile"."videoStreamingPlaylistId" ' + 280 'LEFT JOIN "videoStreamingPlaylist" ON "videoStreamingPlaylist"."id" = "videoFile"."videoStreamingPlaylistId" ' +
281 'LEFT JOIN "video" "hlsVideo" ON "hlsVideo"."id" = "videoStreamingPlaylist"."videoId" AND "hlsVideo"."remote" IS FALSE ' + 281 'LEFT JOIN "video" "hlsVideo" ON "hlsVideo"."id" = "videoStreamingPlaylist"."videoId" AND "hlsVideo"."remote" IS FALSE ' +
282 'WHERE "torrentFilename" = $filename AND ("hlsVideo"."id" IS NOT NULL OR "webtorrent"."id" IS NOT NULL) LIMIT 1' 282 'WHERE "torrentFilename" = $filename AND ("hlsVideo"."id" IS NOT NULL OR "webvideo"."id" IS NOT NULL) LIMIT 1'
283 283
284 return doesExist(this.sequelize, query, { filename }) 284 return doesExist(this.sequelize, query, { filename })
285 } 285 }
286 286
287 static async doesOwnedWebTorrentVideoFileExist (filename: string) { 287 static async doesOwnedWebVideoFileExist (filename: string) {
288 const query = 'SELECT 1 FROM "videoFile" INNER JOIN "video" ON "video"."id" = "videoFile"."videoId" AND "video"."remote" IS FALSE ' + 288 const query = 'SELECT 1 FROM "videoFile" INNER JOIN "video" ON "video"."id" = "videoFile"."videoId" AND "video"."remote" IS FALSE ' +
289 `WHERE "filename" = $filename AND "storage" = ${VideoStorage.FILE_SYSTEM} LIMIT 1` 289 `WHERE "filename" = $filename AND "storage" = ${VideoStorage.FILE_SYSTEM} LIMIT 1`
290 290
@@ -378,7 +378,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
378 } 378 }
379 379
380 static getStats () { 380 static getStats () {
381 const webtorrentFilesQuery: FindOptions = { 381 const webVideoFilesQuery: FindOptions = {
382 include: [ 382 include: [
383 { 383 {
384 attributes: [], 384 attributes: [],
@@ -412,10 +412,10 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
412 } 412 }
413 413
414 return Promise.all([ 414 return Promise.all([
415 VideoFileModel.aggregate('size', 'SUM', webtorrentFilesQuery), 415 VideoFileModel.aggregate('size', 'SUM', webVideoFilesQuery),
416 VideoFileModel.aggregate('size', 'SUM', hlsFilesQuery) 416 VideoFileModel.aggregate('size', 'SUM', hlsFilesQuery)
417 ]).then(([ webtorrentResult, hlsResult ]) => ({ 417 ]).then(([ webVideoResult, hlsResult ]) => ({
418 totalLocalVideoFilesSize: parseAggregateResult(webtorrentResult) + parseAggregateResult(hlsResult) 418 totalLocalVideoFilesSize: parseAggregateResult(webVideoResult) + parseAggregateResult(hlsResult)
419 })) 419 }))
420 } 420 }
421 421
@@ -433,7 +433,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
433 433
434 const element = mode === 'streaming-playlist' 434 const element = mode === 'streaming-playlist'
435 ? await VideoFileModel.loadHLSFile({ ...baseFind, playlistId: videoFile.videoStreamingPlaylistId }) 435 ? await VideoFileModel.loadHLSFile({ ...baseFind, playlistId: videoFile.videoStreamingPlaylistId })
436 : await VideoFileModel.loadWebTorrentFile({ ...baseFind, videoId: videoFile.videoId }) 436 : await VideoFileModel.loadWebVideoFile({ ...baseFind, videoId: videoFile.videoId })
437 437
438 if (!element) return videoFile.save({ transaction }) 438 if (!element) return videoFile.save({ transaction })
439 439
@@ -444,7 +444,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
444 return element.save({ transaction }) 444 return element.save({ transaction })
445 } 445 }
446 446
447 static async loadWebTorrentFile (options: { 447 static async loadWebVideoFile (options: {
448 videoId: number 448 videoId: number
449 fps: number 449 fps: number
450 resolution: number 450 resolution: number
@@ -523,7 +523,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
523 return getHLSPrivateFileUrl(video, this.filename) 523 return getHLSPrivateFileUrl(video, this.filename)
524 } 524 }
525 525
526 return getWebTorrentPrivateFileUrl(this.filename) 526 return getWebVideoPrivateFileUrl(this.filename)
527 } 527 }
528 528
529 private getPublicObjectStorageUrl () { 529 private getPublicObjectStorageUrl () {
@@ -531,7 +531,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
531 return getHLSPublicFileUrl(this.fileUrl) 531 return getHLSPublicFileUrl(this.fileUrl)
532 } 532 }
533 533
534 return getWebTorrentPublicFileUrl(this.fileUrl) 534 return getWebVideoPublicFileUrl(this.fileUrl)
535 } 535 }
536 536
537 // --------------------------------------------------------------------------- 537 // ---------------------------------------------------------------------------
@@ -553,10 +553,10 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>
553 getFileStaticPath (video: MVideo) { 553 getFileStaticPath (video: MVideo) {
554 if (this.isHLS()) return this.getHLSFileStaticPath(video) 554 if (this.isHLS()) return this.getHLSFileStaticPath(video)
555 555
556 return this.getWebTorrentFileStaticPath(video) 556 return this.getWebVideoFileStaticPath(video)
557 } 557 }
558 558
559 private getWebTorrentFileStaticPath (video: MVideo) { 559 private getWebVideoFileStaticPath (video: MVideo) {
560 if (isVideoInPrivateDirectory(video.privacy)) { 560 if (isVideoInPrivateDirectory(video.privacy)) {
561 return join(STATIC_PATHS.PRIVATE_WEBSEED, this.filename) 561 return join(STATIC_PATHS.PRIVATE_WEBSEED, this.filename)
562 } 562 }
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 3a0d95b62..4c6297243 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -29,7 +29,7 @@ import {
29import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' 29import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video'
30import { InternalEventEmitter } from '@server/lib/internal-event-emitter' 30import { InternalEventEmitter } from '@server/lib/internal-event-emitter'
31import { LiveManager } from '@server/lib/live/live-manager' 31import { LiveManager } from '@server/lib/live/live-manager'
32import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' 32import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebVideoObjectStorage } from '@server/lib/object-storage'
33import { tracer } from '@server/lib/opentelemetry/tracing' 33import { tracer } from '@server/lib/opentelemetry/tracing'
34import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' 34import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'
35import { Hooks } from '@server/lib/plugins/hooks' 35import { Hooks } from '@server/lib/plugins/hooks'
@@ -151,7 +151,7 @@ export enum ScopeNames {
151 FOR_API = 'FOR_API', 151 FOR_API = 'FOR_API',
152 WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS', 152 WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS',
153 WITH_TAGS = 'WITH_TAGS', 153 WITH_TAGS = 'WITH_TAGS',
154 WITH_WEBTORRENT_FILES = 'WITH_WEBTORRENT_FILES', 154 WITH_WEB_VIDEO_FILES = 'WITH_WEB_VIDEO_FILES',
155 WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE', 155 WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE',
156 WITH_BLACKLISTED = 'WITH_BLACKLISTED', 156 WITH_BLACKLISTED = 'WITH_BLACKLISTED',
157 WITH_STREAMING_PLAYLISTS = 'WITH_STREAMING_PLAYLISTS', 157 WITH_STREAMING_PLAYLISTS = 'WITH_STREAMING_PLAYLISTS',
@@ -290,7 +290,7 @@ export type ForAPIOptions = {
290 } 290 }
291 ] 291 ]
292 }, 292 },
293 [ScopeNames.WITH_WEBTORRENT_FILES]: (withRedundancies = false) => { 293 [ScopeNames.WITH_WEB_VIDEO_FILES]: (withRedundancies = false) => {
294 let subInclude: any[] = [] 294 let subInclude: any[] = []
295 295
296 if (withRedundancies === true) { 296 if (withRedundancies === true) {
@@ -813,7 +813,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
813 813
814 // Remove physical files and torrents 814 // Remove physical files and torrents
815 instance.VideoFiles.forEach(file => { 815 instance.VideoFiles.forEach(file => {
816 tasks.push(instance.removeWebTorrentFile(file)) 816 tasks.push(instance.removeWebVideoFile(file))
817 }) 817 })
818 818
819 // Remove playlists file 819 // Remove playlists file
@@ -1107,7 +1107,10 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1107 include?: VideoInclude 1107 include?: VideoInclude
1108 1108
1109 hasFiles?: boolean // default false 1109 hasFiles?: boolean // default false
1110 hasWebtorrentFiles?: boolean 1110
1111 hasWebtorrentFiles?: boolean // TODO: remove in v7
1112 hasWebVideoFiles?: boolean
1113
1111 hasHLSFiles?: boolean 1114 hasHLSFiles?: boolean
1112 1115
1113 categoryOneOf?: number[] 1116 categoryOneOf?: number[]
@@ -1172,6 +1175,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1172 'historyOfUser', 1175 'historyOfUser',
1173 'hasHLSFiles', 1176 'hasHLSFiles',
1174 'hasWebtorrentFiles', 1177 'hasWebtorrentFiles',
1178 'hasWebVideoFiles',
1175 'search', 1179 'search',
1176 'excludeAlreadyWatched' 1180 'excludeAlreadyWatched'
1177 ]), 1181 ]),
@@ -1205,7 +1209,9 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1205 1209
1206 user?: MUserAccountId 1210 user?: MUserAccountId
1207 1211
1208 hasWebtorrentFiles?: boolean 1212 hasWebtorrentFiles?: boolean // TODO: remove in v7
1213 hasWebVideoFiles?: boolean
1214
1209 hasHLSFiles?: boolean 1215 hasHLSFiles?: boolean
1210 1216
1211 search?: string 1217 search?: string
@@ -1252,6 +1258,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1252 'durationMax', 1258 'durationMax',
1253 'hasHLSFiles', 1259 'hasHLSFiles',
1254 'hasWebtorrentFiles', 1260 'hasWebtorrentFiles',
1261 'hasWebVideoFiles',
1255 'uuids', 1262 'uuids',
1256 'search', 1263 'search',
1257 'displayOnlyForFollower', 1264 'displayOnlyForFollower',
@@ -1676,7 +1683,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1676 return this.getQualityFileBy(minBy) 1683 return this.getQualityFileBy(minBy)
1677 } 1684 }
1678 1685
1679 getWebTorrentFile<T extends MVideoWithFile> (this: T, resolution: number): MVideoFileVideo { 1686 getWebVideoFile<T extends MVideoWithFile> (this: T, resolution: number): MVideoFileVideo {
1680 if (Array.isArray(this.VideoFiles) === false) return undefined 1687 if (Array.isArray(this.VideoFiles) === false) return undefined
1681 1688
1682 const file = this.VideoFiles.find(f => f.resolution === resolution) 1689 const file = this.VideoFiles.find(f => f.resolution === resolution)
@@ -1685,7 +1692,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1685 return Object.assign(file, { Video: this }) 1692 return Object.assign(file, { Video: this })
1686 } 1693 }
1687 1694
1688 hasWebTorrentFiles () { 1695 hasWebVideoFiles () {
1689 return Array.isArray(this.VideoFiles) === true && this.VideoFiles.length !== 0 1696 return Array.isArray(this.VideoFiles) === true && this.VideoFiles.length !== 0
1690 } 1697 }
1691 1698
@@ -1884,7 +1891,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1884 .concat(toAdd) 1891 .concat(toAdd)
1885 } 1892 }
1886 1893
1887 removeWebTorrentFile (videoFile: MVideoFile, isRedundancy = false) { 1894 removeWebVideoFile (videoFile: MVideoFile, isRedundancy = false) {
1888 const filePath = isRedundancy 1895 const filePath = isRedundancy
1889 ? VideoPathManager.Instance.getFSRedundancyVideoFilePath(this, videoFile) 1896 ? VideoPathManager.Instance.getFSRedundancyVideoFilePath(this, videoFile)
1890 : VideoPathManager.Instance.getFSVideoFileOutputPath(this, videoFile) 1897 : VideoPathManager.Instance.getFSVideoFileOutputPath(this, videoFile)
@@ -1893,7 +1900,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1893 if (!isRedundancy) promises.push(videoFile.removeTorrent()) 1900 if (!isRedundancy) promises.push(videoFile.removeTorrent())
1894 1901
1895 if (videoFile.storage === VideoStorage.OBJECT_STORAGE) { 1902 if (videoFile.storage === VideoStorage.OBJECT_STORAGE) {
1896 promises.push(removeWebTorrentObjectStorage(videoFile)) 1903 promises.push(removeWebVideoObjectStorage(videoFile))
1897 } 1904 }
1898 1905
1899 return Promise.all(promises) 1906 return Promise.all(promises)
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 3c752cc3e..7f825f79e 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -345,7 +345,7 @@ describe('Test config API validators', function () {
345 }) 345 })
346 }) 346 })
347 347
348 it('Should fail with a disabled webtorrent & hls transcoding', async function () { 348 it('Should fail with a disabled web videos & hls transcoding', async function () {
349 const newUpdateParams = { 349 const newUpdateParams = {
350 ...updateParams, 350 ...updateParams,
351 351
diff --git a/server/tests/api/check-params/transcoding.ts b/server/tests/api/check-params/transcoding.ts
index 9846ac182..4bebcb528 100644
--- a/server/tests/api/check-params/transcoding.ts
+++ b/server/tests/api/check-params/transcoding.ts
@@ -49,21 +49,21 @@ describe('Test transcoding API validators', function () {
49 49
50 it('Should not run transcoding of a unknown video', async function () { 50 it('Should not run transcoding of a unknown video', async function () {
51 await servers[0].videos.runTranscoding({ videoId: 404, transcodingType: 'hls', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 51 await servers[0].videos.runTranscoding({ videoId: 404, transcodingType: 'hls', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
52 await servers[0].videos.runTranscoding({ videoId: 404, transcodingType: 'webtorrent', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 52 await servers[0].videos.runTranscoding({ videoId: 404, transcodingType: 'web-video', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
53 }) 53 })
54 54
55 it('Should not run transcoding of a remote video', async function () { 55 it('Should not run transcoding of a remote video', async function () {
56 const expectedStatus = HttpStatusCode.BAD_REQUEST_400 56 const expectedStatus = HttpStatusCode.BAD_REQUEST_400
57 57
58 await servers[0].videos.runTranscoding({ videoId: remoteId, transcodingType: 'hls', expectedStatus }) 58 await servers[0].videos.runTranscoding({ videoId: remoteId, transcodingType: 'hls', expectedStatus })
59 await servers[0].videos.runTranscoding({ videoId: remoteId, transcodingType: 'webtorrent', expectedStatus }) 59 await servers[0].videos.runTranscoding({ videoId: remoteId, transcodingType: 'web-video', expectedStatus })
60 }) 60 })
61 61
62 it('Should not run transcoding by a non admin user', async function () { 62 it('Should not run transcoding by a non admin user', async function () {
63 const expectedStatus = HttpStatusCode.FORBIDDEN_403 63 const expectedStatus = HttpStatusCode.FORBIDDEN_403
64 64
65 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls', token: userToken, expectedStatus }) 65 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls', token: userToken, expectedStatus })
66 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'webtorrent', token: moderatorToken, expectedStatus }) 66 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'web-video', token: moderatorToken, expectedStatus })
67 }) 67 })
68 68
69 it('Should not run transcoding without transcoding type', async function () { 69 it('Should not run transcoding without transcoding type', async function () {
@@ -82,7 +82,7 @@ describe('Test transcoding API validators', function () {
82 await servers[0].config.disableTranscoding() 82 await servers[0].config.disableTranscoding()
83 83
84 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls', expectedStatus }) 84 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls', expectedStatus })
85 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'webtorrent', expectedStatus }) 85 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'web-video', expectedStatus })
86 }) 86 })
87 87
88 it('Should run transcoding', async function () { 88 it('Should run transcoding', async function () {
@@ -93,15 +93,15 @@ describe('Test transcoding API validators', function () {
93 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls' }) 93 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'hls' })
94 await waitJobs(servers) 94 await waitJobs(servers)
95 95
96 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'webtorrent' }) 96 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'web-video' })
97 await waitJobs(servers) 97 await waitJobs(servers)
98 }) 98 })
99 99
100 it('Should not run transcoding on a video that is already being transcoded', async function () { 100 it('Should not run transcoding on a video that is already being transcoded', async function () {
101 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'webtorrent' }) 101 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'web-video' })
102 102
103 const expectedStatus = HttpStatusCode.CONFLICT_409 103 const expectedStatus = HttpStatusCode.CONFLICT_409
104 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'webtorrent', expectedStatus }) 104 await servers[0].videos.runTranscoding({ videoId: validId, transcodingType: 'web-video', expectedStatus })
105 }) 105 })
106 106
107 after(async function () { 107 after(async function () {
diff --git a/server/tests/api/check-params/video-files.ts b/server/tests/api/check-params/video-files.ts
index 9dc59a1b5..4d43ab6f8 100644
--- a/server/tests/api/check-params/video-files.ts
+++ b/server/tests/api/check-params/video-files.ts
@@ -60,7 +60,7 @@ describe('Test videos files', function () {
60 }) 60 })
61 61
62 describe('Deleting files', function () { 62 describe('Deleting files', function () {
63 let webtorrentId: string 63 let webVideoId: string
64 let hlsId: string 64 let hlsId: string
65 let remoteId: string 65 let remoteId: string
66 66
@@ -68,10 +68,10 @@ describe('Test videos files', function () {
68 let validId2: string 68 let validId2: string
69 69
70 let hlsFileId: number 70 let hlsFileId: number
71 let webtorrentFileId: number 71 let webVideoFileId: number
72 72
73 let remoteHLSFileId: number 73 let remoteHLSFileId: number
74 let remoteWebtorrentFileId: number 74 let remoteWebVideoFileId: number
75 75
76 before(async function () { 76 before(async function () {
77 this.timeout(300_000) 77 this.timeout(300_000)
@@ -83,7 +83,7 @@ describe('Test videos files', function () {
83 const video = await servers[1].videos.get({ id: uuid }) 83 const video = await servers[1].videos.get({ id: uuid })
84 remoteId = video.uuid 84 remoteId = video.uuid
85 remoteHLSFileId = video.streamingPlaylists[0].files[0].id 85 remoteHLSFileId = video.streamingPlaylists[0].files[0].id
86 remoteWebtorrentFileId = video.files[0].id 86 remoteWebVideoFileId = video.files[0].id
87 } 87 }
88 88
89 { 89 {
@@ -96,7 +96,7 @@ describe('Test videos files', function () {
96 const video = await servers[0].videos.get({ id: uuid }) 96 const video = await servers[0].videos.get({ id: uuid })
97 validId1 = video.uuid 97 validId1 = video.uuid
98 hlsFileId = video.streamingPlaylists[0].files[0].id 98 hlsFileId = video.streamingPlaylists[0].files[0].id
99 webtorrentFileId = video.files[0].id 99 webVideoFileId = video.files[0].id
100 } 100 }
101 101
102 { 102 {
@@ -117,8 +117,8 @@ describe('Test videos files', function () {
117 117
118 { 118 {
119 await servers[0].config.enableTranscoding(false, true) 119 await servers[0].config.enableTranscoding(false, true)
120 const { uuid } = await servers[0].videos.quickUpload({ name: 'webtorrent' }) 120 const { uuid } = await servers[0].videos.quickUpload({ name: 'web-video' })
121 webtorrentId = uuid 121 webVideoId = uuid
122 } 122 }
123 123
124 await waitJobs(servers) 124 await waitJobs(servers)
@@ -128,27 +128,27 @@ describe('Test videos files', function () {
128 const expectedStatus = HttpStatusCode.NOT_FOUND_404 128 const expectedStatus = HttpStatusCode.NOT_FOUND_404
129 129
130 await servers[0].videos.removeHLSPlaylist({ videoId: 404, expectedStatus }) 130 await servers[0].videos.removeHLSPlaylist({ videoId: 404, expectedStatus })
131 await servers[0].videos.removeAllWebTorrentFiles({ videoId: 404, expectedStatus }) 131 await servers[0].videos.removeAllWebVideoFiles({ videoId: 404, expectedStatus })
132 132
133 await servers[0].videos.removeHLSFile({ videoId: 404, fileId: hlsFileId, expectedStatus }) 133 await servers[0].videos.removeHLSFile({ videoId: 404, fileId: hlsFileId, expectedStatus })
134 await servers[0].videos.removeWebTorrentFile({ videoId: 404, fileId: webtorrentFileId, expectedStatus }) 134 await servers[0].videos.removeWebVideoFile({ videoId: 404, fileId: webVideoFileId, expectedStatus })
135 }) 135 })
136 136
137 it('Should not delete unknown files', async function () { 137 it('Should not delete unknown files', async function () {
138 const expectedStatus = HttpStatusCode.NOT_FOUND_404 138 const expectedStatus = HttpStatusCode.NOT_FOUND_404
139 139
140 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: webtorrentFileId, expectedStatus }) 140 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: webVideoFileId, expectedStatus })
141 await servers[0].videos.removeWebTorrentFile({ videoId: validId1, fileId: hlsFileId, expectedStatus }) 141 await servers[0].videos.removeWebVideoFile({ videoId: validId1, fileId: hlsFileId, expectedStatus })
142 }) 142 })
143 143
144 it('Should not delete files of a remote video', async function () { 144 it('Should not delete files of a remote video', async function () {
145 const expectedStatus = HttpStatusCode.BAD_REQUEST_400 145 const expectedStatus = HttpStatusCode.BAD_REQUEST_400
146 146
147 await servers[0].videos.removeHLSPlaylist({ videoId: remoteId, expectedStatus }) 147 await servers[0].videos.removeHLSPlaylist({ videoId: remoteId, expectedStatus })
148 await servers[0].videos.removeAllWebTorrentFiles({ videoId: remoteId, expectedStatus }) 148 await servers[0].videos.removeAllWebVideoFiles({ videoId: remoteId, expectedStatus })
149 149
150 await servers[0].videos.removeHLSFile({ videoId: remoteId, fileId: remoteHLSFileId, expectedStatus }) 150 await servers[0].videos.removeHLSFile({ videoId: remoteId, fileId: remoteHLSFileId, expectedStatus })
151 await servers[0].videos.removeWebTorrentFile({ videoId: remoteId, fileId: remoteWebtorrentFileId, expectedStatus }) 151 await servers[0].videos.removeWebVideoFile({ videoId: remoteId, fileId: remoteWebVideoFileId, expectedStatus })
152 }) 152 })
153 153
154 it('Should not delete files by a non admin user', async function () { 154 it('Should not delete files by a non admin user', async function () {
@@ -157,35 +157,35 @@ describe('Test videos files', function () {
157 await servers[0].videos.removeHLSPlaylist({ videoId: validId1, token: userToken, expectedStatus }) 157 await servers[0].videos.removeHLSPlaylist({ videoId: validId1, token: userToken, expectedStatus })
158 await servers[0].videos.removeHLSPlaylist({ videoId: validId1, token: moderatorToken, expectedStatus }) 158 await servers[0].videos.removeHLSPlaylist({ videoId: validId1, token: moderatorToken, expectedStatus })
159 159
160 await servers[0].videos.removeAllWebTorrentFiles({ videoId: validId1, token: userToken, expectedStatus }) 160 await servers[0].videos.removeAllWebVideoFiles({ videoId: validId1, token: userToken, expectedStatus })
161 await servers[0].videos.removeAllWebTorrentFiles({ videoId: validId1, token: moderatorToken, expectedStatus }) 161 await servers[0].videos.removeAllWebVideoFiles({ videoId: validId1, token: moderatorToken, expectedStatus })
162 162
163 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId, token: userToken, expectedStatus }) 163 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId, token: userToken, expectedStatus })
164 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId, token: moderatorToken, expectedStatus }) 164 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId, token: moderatorToken, expectedStatus })
165 165
166 await servers[0].videos.removeWebTorrentFile({ videoId: validId1, fileId: webtorrentFileId, token: userToken, expectedStatus }) 166 await servers[0].videos.removeWebVideoFile({ videoId: validId1, fileId: webVideoFileId, token: userToken, expectedStatus })
167 await servers[0].videos.removeWebTorrentFile({ videoId: validId1, fileId: webtorrentFileId, token: moderatorToken, expectedStatus }) 167 await servers[0].videos.removeWebVideoFile({ videoId: validId1, fileId: webVideoFileId, token: moderatorToken, expectedStatus })
168 }) 168 })
169 169
170 it('Should not delete files if the files are not available', async function () { 170 it('Should not delete files if the files are not available', async function () {
171 await servers[0].videos.removeHLSPlaylist({ videoId: hlsId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 171 await servers[0].videos.removeHLSPlaylist({ videoId: hlsId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
172 await servers[0].videos.removeAllWebTorrentFiles({ videoId: webtorrentId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 172 await servers[0].videos.removeAllWebVideoFiles({ videoId: webVideoId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
173 173
174 await servers[0].videos.removeHLSFile({ videoId: hlsId, fileId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 174 await servers[0].videos.removeHLSFile({ videoId: hlsId, fileId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
175 await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentId, fileId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 175 await servers[0].videos.removeWebVideoFile({ videoId: webVideoId, fileId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
176 }) 176 })
177 177
178 it('Should not delete files if no both versions are available', async function () { 178 it('Should not delete files if no both versions are available', async function () {
179 await servers[0].videos.removeHLSPlaylist({ videoId: hlsId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 179 await servers[0].videos.removeHLSPlaylist({ videoId: hlsId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
180 await servers[0].videos.removeAllWebTorrentFiles({ videoId: webtorrentId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 180 await servers[0].videos.removeAllWebVideoFiles({ videoId: webVideoId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
181 }) 181 })
182 182
183 it('Should delete files if both versions are available', async function () { 183 it('Should delete files if both versions are available', async function () {
184 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId }) 184 await servers[0].videos.removeHLSFile({ videoId: validId1, fileId: hlsFileId })
185 await servers[0].videos.removeWebTorrentFile({ videoId: validId1, fileId: webtorrentFileId }) 185 await servers[0].videos.removeWebVideoFile({ videoId: validId1, fileId: webVideoFileId })
186 186
187 await servers[0].videos.removeHLSPlaylist({ videoId: validId1 }) 187 await servers[0].videos.removeHLSPlaylist({ videoId: validId1 })
188 await servers[0].videos.removeAllWebTorrentFiles({ videoId: validId2 }) 188 await servers[0].videos.removeAllWebVideoFiles({ videoId: validId2 })
189 }) 189 })
190 }) 190 })
191 191
diff --git a/server/tests/api/object-storage/video-static-file-privacy.ts b/server/tests/api/object-storage/video-static-file-privacy.ts
index 2a7c3381d..18d30a2f5 100644
--- a/server/tests/api/object-storage/video-static-file-privacy.ts
+++ b/server/tests/api/object-storage/video-static-file-privacy.ts
@@ -120,7 +120,7 @@ describe('Object storage for video static file privacy', function () {
120 const video = await server.videos.getWithToken({ id: videoId }) 120 const video = await server.videos.getWithToken({ id: videoId })
121 121
122 return { 122 return {
123 webTorrentFile: video.files[0].fileUrl, 123 webVideoFile: video.files[0].fileUrl,
124 hlsFile: getHLS(video).files[0].fileUrl 124 hlsFile: getHLS(video).files[0].fileUrl
125 } 125 }
126 } 126 }
@@ -175,10 +175,10 @@ describe('Object storage for video static file privacy', function () {
175 it('Should not get files without appropriate OAuth token', async function () { 175 it('Should not get files without appropriate OAuth token', async function () {
176 this.timeout(60000) 176 this.timeout(60000)
177 177
178 const { webTorrentFile, hlsFile } = await getSampleFileUrls(privateVideoUUID) 178 const { webVideoFile, hlsFile } = await getSampleFileUrls(privateVideoUUID)
179 179
180 await makeRawRequest({ url: webTorrentFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 180 await makeRawRequest({ url: webVideoFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
181 await makeRawRequest({ url: webTorrentFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) 181 await makeRawRequest({ url: webVideoFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
182 182
183 await makeRawRequest({ url: hlsFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 183 await makeRawRequest({ url: hlsFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
184 await makeRawRequest({ url: hlsFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) 184 await makeRawRequest({ url: hlsFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
@@ -187,18 +187,18 @@ describe('Object storage for video static file privacy', function () {
187 it('Should not get files without appropriate password or appropriate OAuth token', async function () { 187 it('Should not get files without appropriate password or appropriate OAuth token', async function () {
188 this.timeout(60000) 188 this.timeout(60000)
189 189
190 const { webTorrentFile, hlsFile } = await getSampleFileUrls(passwordProtectedVideoUUID) 190 const { webVideoFile, hlsFile } = await getSampleFileUrls(passwordProtectedVideoUUID)
191 191
192 await makeRawRequest({ url: webTorrentFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 192 await makeRawRequest({ url: webVideoFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
193 await makeRawRequest({ 193 await makeRawRequest({
194 url: webTorrentFile, 194 url: webVideoFile,
195 token: null, 195 token: null,
196 headers: incorrectPasswordHeader, 196 headers: incorrectPasswordHeader,
197 expectedStatus: HttpStatusCode.FORBIDDEN_403 197 expectedStatus: HttpStatusCode.FORBIDDEN_403
198 }) 198 })
199 await makeRawRequest({ url: webTorrentFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) 199 await makeRawRequest({ url: webVideoFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
200 await makeRawRequest({ 200 await makeRawRequest({
201 url: webTorrentFile, 201 url: webVideoFile,
202 token: null, 202 token: null,
203 headers: correctPasswordHeader, 203 headers: correctPasswordHeader,
204 expectedStatus: HttpStatusCode.OK_200 204 expectedStatus: HttpStatusCode.OK_200
@@ -239,9 +239,9 @@ describe('Object storage for video static file privacy', function () {
239 const badVideoFileToken = await server.videoToken.getVideoFileToken({ token: userToken, videoId: userPrivateVideoUUID }) 239 const badVideoFileToken = await server.videoToken.getVideoFileToken({ token: userToken, videoId: userPrivateVideoUUID })
240 const goodVideoFileToken = await server.videoToken.getVideoFileToken({ videoId: privateVideoUUID }) 240 const goodVideoFileToken = await server.videoToken.getVideoFileToken({ videoId: privateVideoUUID })
241 241
242 const { webTorrentFile, hlsFile } = await getSampleFileUrls(privateVideoUUID) 242 const { webVideoFile, hlsFile } = await getSampleFileUrls(privateVideoUUID)
243 243
244 for (const url of [ webTorrentFile, hlsFile ]) { 244 for (const url of [ webVideoFile, hlsFile ]) {
245 await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 245 await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
246 await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 246 await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
247 await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) 247 await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
@@ -261,9 +261,9 @@ describe('Object storage for video static file privacy', function () {
261 videoPassword: correctPassword 261 videoPassword: correctPassword
262 }) 262 })
263 263
264 const { webTorrentFile, hlsFile } = await getSampleFileUrls(passwordProtectedVideoUUID) 264 const { webVideoFile, hlsFile } = await getSampleFileUrls(passwordProtectedVideoUUID)
265 265
266 for (const url of [ hlsFile, webTorrentFile ]) { 266 for (const url of [ hlsFile, webVideoFile ]) {
267 await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 267 await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
268 await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 268 await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
269 await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) 269 await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
@@ -534,11 +534,11 @@ describe('Object storage for video static file privacy', function () {
534 534
535 it('Should not be able to access object storage proxy', async function () { 535 it('Should not be able to access object storage proxy', async function () {
536 const privateVideo = await server.videos.getWithToken({ id: videoUUID }) 536 const privateVideo = await server.videos.getWithToken({ id: videoUUID })
537 const webtorrentFilename = extractFilenameFromUrl(privateVideo.files[0].fileUrl) 537 const webVideoFilename = extractFilenameFromUrl(privateVideo.files[0].fileUrl)
538 const hlsFilename = extractFilenameFromUrl(getHLS(privateVideo).files[0].fileUrl) 538 const hlsFilename = extractFilenameFromUrl(getHLS(privateVideo).files[0].fileUrl)
539 539
540 await makeRawRequest({ 540 await makeRawRequest({
541 url: server.url + '/object-storage-proxy/webseed/private/' + webtorrentFilename, 541 url: server.url + '/object-storage-proxy/webseed/private/' + webVideoFilename,
542 token: server.accessToken, 542 token: server.accessToken,
543 expectedStatus: HttpStatusCode.BAD_REQUEST_400 543 expectedStatus: HttpStatusCode.BAD_REQUEST_400
544 }) 544 })
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts
index f837d9966..c4f72bbe4 100644
--- a/server/tests/api/object-storage/videos.ts
+++ b/server/tests/api/object-storage/videos.ts
@@ -41,8 +41,8 @@ async function checkFiles (options: {
41 playlistBucket: string 41 playlistBucket: string
42 playlistPrefix?: string 42 playlistPrefix?: string
43 43
44 webtorrentBucket: string 44 webVideoBucket: string
45 webtorrentPrefix?: string 45 webVideoPrefix?: string
46}) { 46}) {
47 const { 47 const {
48 server, 48 server,
@@ -50,20 +50,20 @@ async function checkFiles (options: {
50 originSQLCommand, 50 originSQLCommand,
51 video, 51 video,
52 playlistBucket, 52 playlistBucket,
53 webtorrentBucket, 53 webVideoBucket,
54 baseMockUrl, 54 baseMockUrl,
55 playlistPrefix, 55 playlistPrefix,
56 webtorrentPrefix 56 webVideoPrefix
57 } = options 57 } = options
58 58
59 let allFiles = video.files 59 let allFiles = video.files
60 60
61 for (const file of video.files) { 61 for (const file of video.files) {
62 const baseUrl = baseMockUrl 62 const baseUrl = baseMockUrl
63 ? `${baseMockUrl}/${webtorrentBucket}/` 63 ? `${baseMockUrl}/${webVideoBucket}/`
64 : `http://${webtorrentBucket}.${ObjectStorageCommand.getMockEndpointHost()}/` 64 : `http://${webVideoBucket}.${ObjectStorageCommand.getMockEndpointHost()}/`
65 65
66 const prefix = webtorrentPrefix || '' 66 const prefix = webVideoPrefix || ''
67 const start = baseUrl + prefix 67 const start = baseUrl + prefix
68 68
69 expectStartWith(file.fileUrl, start) 69 expectStartWith(file.fileUrl, start)
@@ -134,8 +134,8 @@ function runTestSuite (options: {
134 playlistBucket: string 134 playlistBucket: string
135 playlistPrefix?: string 135 playlistPrefix?: string
136 136
137 webtorrentBucket: string 137 webVideoBucket: string
138 webtorrentPrefix?: string 138 webVideoPrefix?: string
139 139
140 useMockBaseUrl?: boolean 140 useMockBaseUrl?: boolean
141}) { 141}) {
@@ -161,7 +161,7 @@ function runTestSuite (options: {
161 : undefined 161 : undefined
162 162
163 await objectStorage.createMockBucket(options.playlistBucket) 163 await objectStorage.createMockBucket(options.playlistBucket)
164 await objectStorage.createMockBucket(options.webtorrentBucket) 164 await objectStorage.createMockBucket(options.webVideoBucket)
165 165
166 const config = { 166 const config = {
167 object_storage: { 167 object_storage: {
@@ -182,10 +182,10 @@ function runTestSuite (options: {
182 }, 182 },
183 183
184 videos: { 184 videos: {
185 bucket_name: options.webtorrentBucket, 185 bucket_name: options.webVideoBucket,
186 prefix: options.webtorrentPrefix, 186 prefix: options.webVideoPrefix,
187 base_url: baseMockUrl 187 base_url: baseMockUrl
188 ? `${baseMockUrl}/${options.webtorrentBucket}` 188 ? `${baseMockUrl}/${options.webVideoBucket}`
189 : undefined 189 : undefined
190 } 190 }
191 } 191 }
@@ -386,27 +386,27 @@ describe('Object storage for videos', function () {
386 describe('Test simple object storage', function () { 386 describe('Test simple object storage', function () {
387 runTestSuite({ 387 runTestSuite({
388 playlistBucket: objectStorage.getMockBucketName('streaming-playlists'), 388 playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
389 webtorrentBucket: objectStorage.getMockBucketName('videos') 389 webVideoBucket: objectStorage.getMockBucketName('videos')
390 }) 390 })
391 }) 391 })
392 392
393 describe('Test object storage with prefix', function () { 393 describe('Test object storage with prefix', function () {
394 runTestSuite({ 394 runTestSuite({
395 playlistBucket: objectStorage.getMockBucketName('mybucket'), 395 playlistBucket: objectStorage.getMockBucketName('mybucket'),
396 webtorrentBucket: objectStorage.getMockBucketName('mybucket'), 396 webVideoBucket: objectStorage.getMockBucketName('mybucket'),
397 397
398 playlistPrefix: 'streaming-playlists_', 398 playlistPrefix: 'streaming-playlists_',
399 webtorrentPrefix: 'webtorrent_' 399 webVideoPrefix: 'webvideo_'
400 }) 400 })
401 }) 401 })
402 402
403 describe('Test object storage with prefix and base URL', function () { 403 describe('Test object storage with prefix and base URL', function () {
404 runTestSuite({ 404 runTestSuite({
405 playlistBucket: objectStorage.getMockBucketName('mybucket'), 405 playlistBucket: objectStorage.getMockBucketName('mybucket'),
406 webtorrentBucket: objectStorage.getMockBucketName('mybucket'), 406 webVideoBucket: objectStorage.getMockBucketName('mybucket'),
407 407
408 playlistPrefix: 'streaming-playlists/', 408 playlistPrefix: 'streaming-playlists/',
409 webtorrentPrefix: 'webtorrent/', 409 webVideoPrefix: 'webvideo/',
410 410
411 useMockBaseUrl: true 411 useMockBaseUrl: true
412 }) 412 })
@@ -431,7 +431,7 @@ describe('Object storage for videos', function () {
431 runTestSuite({ 431 runTestSuite({
432 maxUploadPart, 432 maxUploadPart,
433 playlistBucket: objectStorage.getMockBucketName('streaming-playlists'), 433 playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
434 webtorrentBucket: objectStorage.getMockBucketName('videos'), 434 webVideoBucket: objectStorage.getMockBucketName('videos'),
435 fixture 435 fixture
436 }) 436 })
437 }) 437 })
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 5262c503f..b35059c29 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -43,7 +43,7 @@ async function checkMagnetWebseeds (file: VideoFile, baseWebseeds: string[], ser
43 } 43 }
44} 44}
45 45
46async function createServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) { 46async function createServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebVideo = true) {
47 const strategies: any[] = [] 47 const strategies: any[] = []
48 48
49 if (strategy !== null) { 49 if (strategy !== null) {
@@ -61,7 +61,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
61 const config = { 61 const config = {
62 transcoding: { 62 transcoding: {
63 webtorrent: { 63 webtorrent: {
64 enabled: withWebtorrent 64 enabled: withWebVideo
65 }, 65 },
66 hls: { 66 hls: {
67 enabled: true 67 enabled: true
@@ -100,7 +100,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
100} 100}
101 101
102async function ensureSameFilenames (videoUUID: string) { 102async function ensureSameFilenames (videoUUID: string) {
103 let webtorrentFilenames: string[] 103 let webVideoFilenames: string[]
104 let hlsFilenames: string[] 104 let hlsFilenames: string[]
105 105
106 for (const server of servers) { 106 for (const server of servers) {
@@ -108,17 +108,17 @@ async function ensureSameFilenames (videoUUID: string) {
108 108
109 // Ensure we use the same filenames that the origin 109 // Ensure we use the same filenames that the origin
110 110
111 const localWebtorrentFilenames = video.files.map(f => basename(f.fileUrl)).sort() 111 const localWebVideoFilenames = video.files.map(f => basename(f.fileUrl)).sort()
112 const localHLSFilenames = video.streamingPlaylists[0].files.map(f => basename(f.fileUrl)).sort() 112 const localHLSFilenames = video.streamingPlaylists[0].files.map(f => basename(f.fileUrl)).sort()
113 113
114 if (webtorrentFilenames) expect(webtorrentFilenames).to.deep.equal(localWebtorrentFilenames) 114 if (webVideoFilenames) expect(webVideoFilenames).to.deep.equal(localWebVideoFilenames)
115 else webtorrentFilenames = localWebtorrentFilenames 115 else webVideoFilenames = localWebVideoFilenames
116 116
117 if (hlsFilenames) expect(hlsFilenames).to.deep.equal(localHLSFilenames) 117 if (hlsFilenames) expect(hlsFilenames).to.deep.equal(localHLSFilenames)
118 else hlsFilenames = localHLSFilenames 118 else hlsFilenames = localHLSFilenames
119 } 119 }
120 120
121 return { webtorrentFilenames, hlsFilenames } 121 return { webVideoFilenames, hlsFilenames }
122} 122}
123 123
124async function check1WebSeed (videoUUID?: string) { 124async function check1WebSeed (videoUUID?: string) {
@@ -156,7 +156,7 @@ async function check2Webseeds (videoUUID?: string) {
156 } 156 }
157 } 157 }
158 158
159 const { webtorrentFilenames } = await ensureSameFilenames(videoUUID) 159 const { webVideoFilenames } = await ensureSameFilenames(videoUUID)
160 160
161 const directories = [ 161 const directories = [
162 servers[0].getDirectoryPath('redundancy'), 162 servers[0].getDirectoryPath('redundancy'),
@@ -168,7 +168,7 @@ async function check2Webseeds (videoUUID?: string) {
168 expect(files).to.have.length.at.least(4) 168 expect(files).to.have.length.at.least(4)
169 169
170 // Ensure we files exist on disk 170 // Ensure we files exist on disk
171 expect(files.find(f => webtorrentFilenames.includes(f))).to.exist 171 expect(files.find(f => webVideoFilenames.includes(f))).to.exist
172 } 172 }
173} 173}
174 174
diff --git a/server/tests/api/transcoding/audio-only.ts b/server/tests/api/transcoding/audio-only.ts
index 1e31418e7..aa1113fc1 100644
--- a/server/tests/api/transcoding/audio-only.ts
+++ b/server/tests/api/transcoding/audio-only.ts
@@ -14,7 +14,7 @@ import {
14describe('Test audio only video transcoding', function () { 14describe('Test audio only video transcoding', function () {
15 let servers: PeerTubeServer[] = [] 15 let servers: PeerTubeServer[] = []
16 let videoUUID: string 16 let videoUUID: string
17 let webtorrentAudioFileUrl: string 17 let webVideoAudioFileUrl: string
18 let fragmentedAudioFileUrl: string 18 let fragmentedAudioFileUrl: string
19 19
20 before(async function () { 20 before(async function () {
@@ -71,7 +71,7 @@ describe('Test audio only video transcoding', function () {
71 } 71 }
72 72
73 if (server.serverNumber === 1) { 73 if (server.serverNumber === 1) {
74 webtorrentAudioFileUrl = video.files[2].fileUrl 74 webVideoAudioFileUrl = video.files[2].fileUrl
75 fragmentedAudioFileUrl = video.streamingPlaylists[0].files[2].fileUrl 75 fragmentedAudioFileUrl = video.streamingPlaylists[0].files[2].fileUrl
76 } 76 }
77 } 77 }
@@ -79,7 +79,7 @@ describe('Test audio only video transcoding', function () {
79 79
80 it('0p transcoded video should not have video', async function () { 80 it('0p transcoded video should not have video', async function () {
81 const paths = [ 81 const paths = [
82 servers[0].servers.buildWebTorrentFilePath(webtorrentAudioFileUrl), 82 servers[0].servers.buildWebVideoFilePath(webVideoAudioFileUrl),
83 servers[0].servers.buildFragmentedFilePath(videoUUID, fragmentedAudioFileUrl) 83 servers[0].servers.buildFragmentedFilePath(videoUUID, fragmentedAudioFileUrl)
84 ] 84 ]
85 85
diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts
index d6f5b01dc..21a63f547 100644
--- a/server/tests/api/transcoding/create-transcoding.ts
+++ b/server/tests/api/transcoding/create-transcoding.ts
@@ -96,12 +96,12 @@ function runTests (enableObjectStorage: boolean) {
96 } 96 }
97 }) 97 })
98 98
99 it('Should generate WebTorrent', async function () { 99 it('Should generate Web Video', async function () {
100 this.timeout(60000) 100 this.timeout(60000)
101 101
102 await servers[0].videos.runTranscoding({ 102 await servers[0].videos.runTranscoding({
103 videoId: videoUUID, 103 videoId: videoUUID,
104 transcodingType: 'webtorrent' 104 transcodingType: 'web-video'
105 }) 105 })
106 106
107 await waitJobs(servers) 107 await waitJobs(servers)
@@ -117,13 +117,13 @@ function runTests (enableObjectStorage: boolean) {
117 } 117 }
118 }) 118 })
119 119
120 it('Should generate WebTorrent from HLS only video', async function () { 120 it('Should generate Web Video from HLS only video', async function () {
121 this.timeout(60000) 121 this.timeout(60000)
122 122
123 await servers[0].videos.removeAllWebTorrentFiles({ videoId: videoUUID }) 123 await servers[0].videos.removeAllWebVideoFiles({ videoId: videoUUID })
124 await waitJobs(servers) 124 await waitJobs(servers)
125 125
126 await servers[0].videos.runTranscoding({ videoId: videoUUID, transcodingType: 'webtorrent' }) 126 await servers[0].videos.runTranscoding({ videoId: videoUUID, transcodingType: 'web-video' })
127 await waitJobs(servers) 127 await waitJobs(servers)
128 128
129 for (const server of servers) { 129 for (const server of servers) {
@@ -137,13 +137,13 @@ function runTests (enableObjectStorage: boolean) {
137 } 137 }
138 }) 138 })
139 139
140 it('Should only generate WebTorrent', async function () { 140 it('Should only generate Web Video', async function () {
141 this.timeout(60000) 141 this.timeout(60000)
142 142
143 await servers[0].videos.removeHLSPlaylist({ videoId: videoUUID }) 143 await servers[0].videos.removeHLSPlaylist({ videoId: videoUUID })
144 await waitJobs(servers) 144 await waitJobs(servers)
145 145
146 await servers[0].videos.runTranscoding({ videoId: videoUUID, transcodingType: 'webtorrent' }) 146 await servers[0].videos.runTranscoding({ videoId: videoUUID, transcodingType: 'web-video' })
147 await waitJobs(servers) 147 await waitJobs(servers)
148 148
149 for (const server of servers) { 149 for (const server of servers) {
diff --git a/server/tests/api/transcoding/hls.ts b/server/tests/api/transcoding/hls.ts
index c668d7e0b..ba889e718 100644
--- a/server/tests/api/transcoding/hls.ts
+++ b/server/tests/api/transcoding/hls.ts
@@ -111,7 +111,7 @@ describe('Test HLS videos', function () {
111 await doubleFollow(servers[0], servers[1]) 111 await doubleFollow(servers[0], servers[1])
112 }) 112 })
113 113
114 describe('With WebTorrent & HLS enabled', function () { 114 describe('With Web Video & HLS enabled', function () {
115 runTestSuite(false) 115 runTestSuite(false)
116 }) 116 })
117 117
diff --git a/server/tests/api/transcoding/transcoder.ts b/server/tests/api/transcoding/transcoder.ts
index 3cd247a24..36e1d90f4 100644
--- a/server/tests/api/transcoding/transcoder.ts
+++ b/server/tests/api/transcoding/transcoder.ts
@@ -251,7 +251,7 @@ describe('Test video transcoding', function () {
251 expect(videoDetails.files).to.have.lengthOf(5) 251 expect(videoDetails.files).to.have.lengthOf(5)
252 252
253 const file = videoDetails.files.find(f => f.resolution.id === 240) 253 const file = videoDetails.files.find(f => f.resolution.id === 240)
254 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 254 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
255 const probe = await getAudioStream(path) 255 const probe = await getAudioStream(path)
256 256
257 if (probe.audioStream) { 257 if (probe.audioStream) {
@@ -281,7 +281,7 @@ describe('Test video transcoding', function () {
281 const videoDetails = await server.videos.get({ id: video.id }) 281 const videoDetails = await server.videos.get({ id: video.id })
282 282
283 const file = videoDetails.files.find(f => f.resolution.id === 240) 283 const file = videoDetails.files.find(f => f.resolution.id === 240)
284 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 284 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
285 285
286 expect(await hasAudioStream(path)).to.be.false 286 expect(await hasAudioStream(path)).to.be.false
287 } 287 }
@@ -310,7 +310,7 @@ describe('Test video transcoding', function () {
310 const fixtureVideoProbe = await getAudioStream(fixturePath) 310 const fixtureVideoProbe = await getAudioStream(fixturePath)
311 311
312 const file = videoDetails.files.find(f => f.resolution.id === 240) 312 const file = videoDetails.files.find(f => f.resolution.id === 240)
313 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 313 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
314 314
315 const videoProbe = await getAudioStream(path) 315 const videoProbe = await getAudioStream(path)
316 316
@@ -472,14 +472,14 @@ describe('Test video transcoding', function () {
472 472
473 for (const resolution of [ 144, 240, 360, 480 ]) { 473 for (const resolution of [ 144, 240, 360, 480 ]) {
474 const file = videoDetails.files.find(f => f.resolution.id === resolution) 474 const file = videoDetails.files.find(f => f.resolution.id === resolution)
475 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 475 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
476 const fps = await getVideoStreamFPS(path) 476 const fps = await getVideoStreamFPS(path)
477 477
478 expect(fps).to.be.below(31) 478 expect(fps).to.be.below(31)
479 } 479 }
480 480
481 const file = videoDetails.files.find(f => f.resolution.id === 720) 481 const file = videoDetails.files.find(f => f.resolution.id === 720)
482 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 482 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
483 const fps = await getVideoStreamFPS(path) 483 const fps = await getVideoStreamFPS(path)
484 484
485 expect(fps).to.be.above(58).and.below(62) 485 expect(fps).to.be.above(58).and.below(62)
@@ -516,14 +516,14 @@ describe('Test video transcoding', function () {
516 516
517 { 517 {
518 const file = video.files.find(f => f.resolution.id === 240) 518 const file = video.files.find(f => f.resolution.id === 240)
519 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 519 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
520 const fps = await getVideoStreamFPS(path) 520 const fps = await getVideoStreamFPS(path)
521 expect(fps).to.be.equal(25) 521 expect(fps).to.be.equal(25)
522 } 522 }
523 523
524 { 524 {
525 const file = video.files.find(f => f.resolution.id === 720) 525 const file = video.files.find(f => f.resolution.id === 720)
526 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 526 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
527 const fps = await getVideoStreamFPS(path) 527 const fps = await getVideoStreamFPS(path)
528 expect(fps).to.be.equal(59) 528 expect(fps).to.be.equal(59)
529 } 529 }
@@ -556,7 +556,7 @@ describe('Test video transcoding', function () {
556 556
557 for (const resolution of [ 240, 360, 480, 720, 1080 ]) { 557 for (const resolution of [ 240, 360, 480, 720, 1080 ]) {
558 const file = video.files.find(f => f.resolution.id === resolution) 558 const file = video.files.find(f => f.resolution.id === resolution)
559 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 559 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
560 560
561 const bitrate = await getVideoStreamBitrate(path) 561 const bitrate = await getVideoStreamBitrate(path)
562 const fps = await getVideoStreamFPS(path) 562 const fps = await getVideoStreamFPS(path)
@@ -607,7 +607,7 @@ describe('Test video transcoding', function () {
607 for (const r of resolutions) { 607 for (const r of resolutions) {
608 const file = video.files.find(f => f.resolution.id === r) 608 const file = video.files.find(f => f.resolution.id === r)
609 609
610 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 610 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
611 const bitrate = await getVideoStreamBitrate(path) 611 const bitrate = await getVideoStreamBitrate(path)
612 612
613 const inputBitrate = 60_000 613 const inputBitrate = 60_000
@@ -631,7 +631,7 @@ describe('Test video transcoding', function () {
631 { 631 {
632 const video = await servers[1].videos.get({ id: videoUUID }) 632 const video = await servers[1].videos.get({ id: videoUUID })
633 const file = video.files.find(f => f.resolution.id === 240) 633 const file = video.files.find(f => f.resolution.id === 240)
634 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 634 const path = servers[1].servers.buildWebVideoFilePath(file.fileUrl)
635 635
636 const probe = await ffprobePromise(path) 636 const probe = await ffprobePromise(path)
637 const metadata = new VideoFileMetadata(probe) 637 const metadata = new VideoFileMetadata(probe)
@@ -704,14 +704,14 @@ describe('Test video transcoding', function () {
704 expect(transcodingJobs).to.have.lengthOf(16) 704 expect(transcodingJobs).to.have.lengthOf(16)
705 705
706 const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls') 706 const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls')
707 const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent') 707 const webVideoJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-web-video')
708 const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent') 708 const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-web-video')
709 709
710 expect(hlsJobs).to.have.lengthOf(8) 710 expect(hlsJobs).to.have.lengthOf(8)
711 expect(webtorrentJobs).to.have.lengthOf(7) 711 expect(webVideoJobs).to.have.lengthOf(7)
712 expect(optimizeJobs).to.have.lengthOf(1) 712 expect(optimizeJobs).to.have.lengthOf(1)
713 713
714 for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) { 714 for (const j of optimizeJobs.concat(hlsJobs.concat(webVideoJobs))) {
715 expect(j.priority).to.be.greaterThan(100) 715 expect(j.priority).to.be.greaterThan(100)
716 expect(j.priority).to.be.lessThan(150) 716 expect(j.priority).to.be.lessThan(150)
717 } 717 }
diff --git a/server/tests/api/transcoding/update-while-transcoding.ts b/server/tests/api/transcoding/update-while-transcoding.ts
index 61655f102..2e0edc770 100644
--- a/server/tests/api/transcoding/update-while-transcoding.ts
+++ b/server/tests/api/transcoding/update-while-transcoding.ts
@@ -96,7 +96,7 @@ describe('Test update video privacy while transcoding', function () {
96 await doubleFollow(servers[0], servers[1]) 96 await doubleFollow(servers[0], servers[1])
97 }) 97 })
98 98
99 describe('With WebTorrent & HLS enabled', function () { 99 describe('With Web Video & HLS enabled', function () {
100 runTestSuite(false) 100 runTestSuite(false)
101 }) 101 })
102 102
diff --git a/server/tests/api/transcoding/video-studio.ts b/server/tests/api/transcoding/video-studio.ts
index e97f2b689..2595d3cdb 100644
--- a/server/tests/api/transcoding/video-studio.ts
+++ b/server/tests/api/transcoding/video-studio.ts
@@ -273,7 +273,7 @@ describe('Test video studio', function () {
273 describe('HLS only studio edition', function () { 273 describe('HLS only studio edition', function () {
274 274
275 before(async function () { 275 before(async function () {
276 // Disable webtorrent 276 // Disable Web Videos
277 await servers[0].config.updateExistingSubConfig({ 277 await servers[0].config.updateExistingSubConfig({
278 newConfig: { 278 newConfig: {
279 transcoding: { 279 transcoding: {
@@ -354,8 +354,8 @@ describe('Test video studio', function () {
354 expect(oldFileUrls).to.not.include(f.fileUrl) 354 expect(oldFileUrls).to.not.include(f.fileUrl)
355 } 355 }
356 356
357 for (const webtorrentFile of video.files) { 357 for (const webVideoFile of video.files) {
358 expectStartWith(webtorrentFile.fileUrl, objectStorage.getMockWebVideosBaseUrl()) 358 expectStartWith(webVideoFile.fileUrl, objectStorage.getMockWebVideosBaseUrl())
359 } 359 }
360 360
361 for (const hlsFile of video.streamingPlaylists[0].files) { 361 for (const hlsFile of video.streamingPlaylists[0].files) {
diff --git a/server/tests/api/users/user-videos.ts b/server/tests/api/users/user-videos.ts
index 696949504..70f22e2eb 100644
--- a/server/tests/api/users/user-videos.ts
+++ b/server/tests/api/users/user-videos.ts
@@ -184,7 +184,7 @@ describe('Test user videos', function () {
184 } 184 }
185 }) 185 })
186 186
187 it('Should disable webtorrent, enable HLS, and update my quota', async function () { 187 it('Should disable web videos, enable HLS, and update my quota', async function () {
188 this.timeout(160000) 188 this.timeout(160000)
189 189
190 { 190 {
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 1c00f9a93..67ade1d0d 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -229,25 +229,13 @@ describe('Test users', function () {
229 }) 229 })
230 230
231 it('Should be able to change the p2p attribute', async function () { 231 it('Should be able to change the p2p attribute', async function () {
232 { 232 await server.users.updateMe({
233 await server.users.updateMe({ 233 token: userToken,
234 token: userToken, 234 p2pEnabled: true
235 webTorrentEnabled: false 235 })
236 })
237
238 const user = await server.users.getMyInfo({ token: userToken })
239 expect(user.p2pEnabled).to.be.false
240 }
241
242 {
243 await server.users.updateMe({
244 token: userToken,
245 p2pEnabled: true
246 })
247 236
248 const user = await server.users.getMyInfo({ token: userToken }) 237 const user = await server.users.getMyInfo({ token: userToken })
249 expect(user.p2pEnabled).to.be.true 238 expect(user.p2pEnabled).to.be.true
250 }
251 }) 239 })
252 240
253 it('Should be able to change the email attribute', async function () { 241 it('Should be able to change the email attribute', async function () {
diff --git a/server/tests/api/videos/video-files.ts b/server/tests/api/videos/video-files.ts
index 8c913bf31..0a183c44d 100644
--- a/server/tests/api/videos/video-files.ts
+++ b/server/tests/api/videos/video-files.ts
@@ -48,10 +48,10 @@ describe('Test videos files', function () {
48 await waitJobs(servers) 48 await waitJobs(servers)
49 }) 49 })
50 50
51 it('Should delete webtorrent files', async function () { 51 it('Should delete web video files', async function () {
52 this.timeout(30_000) 52 this.timeout(30_000)
53 53
54 await servers[0].videos.removeAllWebTorrentFiles({ videoId: validId1 }) 54 await servers[0].videos.removeAllWebVideoFiles({ videoId: validId1 })
55 55
56 await waitJobs(servers) 56 await waitJobs(servers)
57 57
@@ -80,15 +80,15 @@ describe('Test videos files', function () {
80 }) 80 })
81 81
82 describe('When deleting a specific file', function () { 82 describe('When deleting a specific file', function () {
83 let webtorrentId: string 83 let webVideoId: string
84 let hlsId: string 84 let hlsId: string
85 85
86 before(async function () { 86 before(async function () {
87 this.timeout(120_000) 87 this.timeout(120_000)
88 88
89 { 89 {
90 const { uuid } = await servers[0].videos.quickUpload({ name: 'webtorrent' }) 90 const { uuid } = await servers[0].videos.quickUpload({ name: 'web-video' })
91 webtorrentId = uuid 91 webVideoId = uuid
92 } 92 }
93 93
94 { 94 {
@@ -99,38 +99,38 @@ describe('Test videos files', function () {
99 await waitJobs(servers) 99 await waitJobs(servers)
100 }) 100 })
101 101
102 it('Shoulde delete a webtorrent file', async function () { 102 it('Shoulde delete a web video file', async function () {
103 this.timeout(30_000) 103 this.timeout(30_000)
104 104
105 const video = await servers[0].videos.get({ id: webtorrentId }) 105 const video = await servers[0].videos.get({ id: webVideoId })
106 const files = video.files 106 const files = video.files
107 107
108 await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentId, fileId: files[0].id }) 108 await servers[0].videos.removeWebVideoFile({ videoId: webVideoId, fileId: files[0].id })
109 109
110 await waitJobs(servers) 110 await waitJobs(servers)
111 111
112 for (const server of servers) { 112 for (const server of servers) {
113 const video = await server.videos.get({ id: webtorrentId }) 113 const video = await server.videos.get({ id: webVideoId })
114 114
115 expect(video.files).to.have.lengthOf(files.length - 1) 115 expect(video.files).to.have.lengthOf(files.length - 1)
116 expect(video.files.find(f => f.id === files[0].id)).to.not.exist 116 expect(video.files.find(f => f.id === files[0].id)).to.not.exist
117 } 117 }
118 }) 118 })
119 119
120 it('Should delete all webtorrent files', async function () { 120 it('Should delete all web video files', async function () {
121 this.timeout(30_000) 121 this.timeout(30_000)
122 122
123 const video = await servers[0].videos.get({ id: webtorrentId }) 123 const video = await servers[0].videos.get({ id: webVideoId })
124 const files = video.files 124 const files = video.files
125 125
126 for (const file of files) { 126 for (const file of files) {
127 await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentId, fileId: file.id }) 127 await servers[0].videos.removeWebVideoFile({ videoId: webVideoId, fileId: file.id })
128 } 128 }
129 129
130 await waitJobs(servers) 130 await waitJobs(servers)
131 131
132 for (const server of servers) { 132 for (const server of servers) {
133 const video = await server.videos.get({ id: webtorrentId }) 133 const video = await server.videos.get({ id: webVideoId })
134 134
135 expect(video.files).to.have.lengthOf(0) 135 expect(video.files).to.have.lengthOf(0)
136 } 136 }
@@ -182,16 +182,16 @@ describe('Test videos files', function () {
182 it('Should not delete last file of a video', async function () { 182 it('Should not delete last file of a video', async function () {
183 this.timeout(60_000) 183 this.timeout(60_000)
184 184
185 const webtorrentOnly = await servers[0].videos.get({ id: hlsId }) 185 const webVideoOnly = await servers[0].videos.get({ id: hlsId })
186 const hlsOnly = await servers[0].videos.get({ id: webtorrentId }) 186 const hlsOnly = await servers[0].videos.get({ id: webVideoId })
187 187
188 for (let i = 0; i < 4; i++) { 188 for (let i = 0; i < 4; i++) {
189 await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentOnly.id, fileId: webtorrentOnly.files[i].id }) 189 await servers[0].videos.removeWebVideoFile({ videoId: webVideoOnly.id, fileId: webVideoOnly.files[i].id })
190 await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[i].id }) 190 await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[i].id })
191 } 191 }
192 192
193 const expectedStatus = HttpStatusCode.BAD_REQUEST_400 193 const expectedStatus = HttpStatusCode.BAD_REQUEST_400
194 await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentOnly.id, fileId: webtorrentOnly.files[4].id, expectedStatus }) 194 await servers[0].videos.removeWebVideoFile({ videoId: webVideoOnly.id, fileId: webVideoOnly.files[4].id, expectedStatus })
195 await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[4].id, expectedStatus }) 195 await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[4].id, expectedStatus })
196 }) 196 })
197 }) 197 })
diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts
index 30251706b..73c066bfb 100644
--- a/server/tests/api/videos/videos-common-filters.ts
+++ b/server/tests/api/videos/videos-common-filters.ts
@@ -154,7 +154,7 @@ describe('Test videos filter', function () {
154 server: PeerTubeServer 154 server: PeerTubeServer
155 path: string 155 path: string
156 isLocal?: boolean 156 isLocal?: boolean
157 hasWebtorrentFiles?: boolean 157 hasWebVideoFiles?: boolean
158 hasHLSFiles?: boolean 158 hasHLSFiles?: boolean
159 include?: VideoInclude 159 include?: VideoInclude
160 privacyOneOf?: VideoPrivacy[] 160 privacyOneOf?: VideoPrivacy[]
@@ -174,7 +174,7 @@ describe('Test videos filter', function () {
174 'include', 174 'include',
175 'category', 175 'category',
176 'tagsAllOf', 176 'tagsAllOf',
177 'hasWebtorrentFiles', 177 'hasWebVideoFiles',
178 'hasHLSFiles', 178 'hasHLSFiles',
179 'privacyOneOf', 179 'privacyOneOf',
180 'excludeAlreadyWatched' 180 'excludeAlreadyWatched'
@@ -463,14 +463,14 @@ describe('Test videos filter', function () {
463 } 463 }
464 }) 464 })
465 465
466 it('Should filter by HLS or WebTorrent files', async function () { 466 it('Should filter by HLS or Web Video files', async function () {
467 this.timeout(360000) 467 this.timeout(360000)
468 468
469 const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name) 469 const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name)
470 470
471 await servers[0].config.enableTranscoding(true, false) 471 await servers[0].config.enableTranscoding(true, false)
472 await servers[0].videos.upload({ attributes: { name: 'webtorrent video' } }) 472 await servers[0].videos.upload({ attributes: { name: 'web video video' } })
473 const hasWebtorrent = finderFactory('webtorrent video') 473 const hasWebVideo = finderFactory('web video video')
474 474
475 await waitJobs(servers) 475 await waitJobs(servers)
476 476
@@ -481,24 +481,24 @@ describe('Test videos filter', function () {
481 await waitJobs(servers) 481 await waitJobs(servers)
482 482
483 await servers[0].config.enableTranscoding(true, true) 483 await servers[0].config.enableTranscoding(true, true)
484 await servers[0].videos.upload({ attributes: { name: 'hls and webtorrent video' } }) 484 await servers[0].videos.upload({ attributes: { name: 'hls and web video video' } })
485 const hasBoth = finderFactory('hls and webtorrent video') 485 const hasBoth = finderFactory('hls and web video video')
486 486
487 await waitJobs(servers) 487 await waitJobs(servers)
488 488
489 for (const path of paths) { 489 for (const path of paths) {
490 { 490 {
491 const videos = await listVideos({ server: servers[0], path, hasWebtorrentFiles: true }) 491 const videos = await listVideos({ server: servers[0], path, hasWebVideoFiles: true })
492 492
493 expect(hasWebtorrent(videos)).to.be.true 493 expect(hasWebVideo(videos)).to.be.true
494 expect(hasHLS(videos)).to.be.false 494 expect(hasHLS(videos)).to.be.false
495 expect(hasBoth(videos)).to.be.true 495 expect(hasBoth(videos)).to.be.true
496 } 496 }
497 497
498 { 498 {
499 const videos = await listVideos({ server: servers[0], path, hasWebtorrentFiles: false }) 499 const videos = await listVideos({ server: servers[0], path, hasWebVideoFiles: false })
500 500
501 expect(hasWebtorrent(videos)).to.be.false 501 expect(hasWebVideo(videos)).to.be.false
502 expect(hasHLS(videos)).to.be.true 502 expect(hasHLS(videos)).to.be.true
503 expect(hasBoth(videos)).to.be.false 503 expect(hasBoth(videos)).to.be.false
504 } 504 }
@@ -506,7 +506,7 @@ describe('Test videos filter', function () {
506 { 506 {
507 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true }) 507 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true })
508 508
509 expect(hasWebtorrent(videos)).to.be.false 509 expect(hasWebVideo(videos)).to.be.false
510 expect(hasHLS(videos)).to.be.true 510 expect(hasHLS(videos)).to.be.true
511 expect(hasBoth(videos)).to.be.true 511 expect(hasBoth(videos)).to.be.true
512 } 512 }
@@ -514,23 +514,23 @@ describe('Test videos filter', function () {
514 { 514 {
515 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false }) 515 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false })
516 516
517 expect(hasWebtorrent(videos)).to.be.true 517 expect(hasWebVideo(videos)).to.be.true
518 expect(hasHLS(videos)).to.be.false 518 expect(hasHLS(videos)).to.be.false
519 expect(hasBoth(videos)).to.be.false 519 expect(hasBoth(videos)).to.be.false
520 } 520 }
521 521
522 { 522 {
523 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false, hasWebtorrentFiles: false }) 523 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false, hasWebVideoFiles: false })
524 524
525 expect(hasWebtorrent(videos)).to.be.false 525 expect(hasWebVideo(videos)).to.be.false
526 expect(hasHLS(videos)).to.be.false 526 expect(hasHLS(videos)).to.be.false
527 expect(hasBoth(videos)).to.be.false 527 expect(hasBoth(videos)).to.be.false
528 } 528 }
529 529
530 { 530 {
531 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true, hasWebtorrentFiles: true }) 531 const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true, hasWebVideoFiles: true })
532 532
533 expect(hasWebtorrent(videos)).to.be.false 533 expect(hasWebVideo(videos)).to.be.false
534 expect(hasHLS(videos)).to.be.false 534 expect(hasHLS(videos)).to.be.false
535 expect(hasBoth(videos)).to.be.true 535 expect(hasBoth(videos)).to.be.true
536 } 536 }
diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/server/tests/peertube-runner/studio-transcoding.ts
index 988201947..c265d7934 100644
--- a/server/tests/peertube-runner/studio-transcoding.ts
+++ b/server/tests/peertube-runner/studio-transcoding.ts
@@ -44,8 +44,8 @@ describe('Test studio transcoding in peertube-runner program', function () {
44 } 44 }
45 45
46 if (objectStorage) { 46 if (objectStorage) {
47 for (const webtorrentFile of video.files) { 47 for (const webVideoFile of video.files) {
48 expectStartWith(webtorrentFile.fileUrl, objectStorage.getMockWebVideosBaseUrl()) 48 expectStartWith(webVideoFile.fileUrl, objectStorage.getMockWebVideosBaseUrl())
49 } 49 }
50 50
51 for (const hlsFile of video.streamingPlaylists[0].files) { 51 for (const hlsFile of video.streamingPlaylists[0].files) {
diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts
index c3f41c097..eef6faf4e 100644
--- a/server/tests/peertube-runner/vod-transcoding.ts
+++ b/server/tests/peertube-runner/vod-transcoding.ts
@@ -24,13 +24,13 @@ describe('Test VOD transcoding in peertube-runner program', function () {
24 let peertubeRunner: PeerTubeRunnerProcess 24 let peertubeRunner: PeerTubeRunnerProcess
25 25
26 function runSuite (options: { 26 function runSuite (options: {
27 webtorrentEnabled: boolean 27 webVideoEnabled: boolean
28 hlsEnabled: boolean 28 hlsEnabled: boolean
29 objectStorage?: ObjectStorageCommand 29 objectStorage?: ObjectStorageCommand
30 }) { 30 }) {
31 const { webtorrentEnabled, hlsEnabled, objectStorage } = options 31 const { webVideoEnabled, hlsEnabled, objectStorage } = options
32 32
33 const objectStorageBaseUrlWebTorrent = objectStorage 33 const objectStorageBaseUrlWebVideo = objectStorage
34 ? objectStorage.getMockWebVideosBaseUrl() 34 ? objectStorage.getMockWebVideosBaseUrl()
35 : undefined 35 : undefined
36 36
@@ -46,13 +46,13 @@ describe('Test VOD transcoding in peertube-runner program', function () {
46 await waitJobs(servers, { runnerJobs: true }) 46 await waitJobs(servers, { runnerJobs: true })
47 47
48 for (const server of servers) { 48 for (const server of servers) {
49 if (webtorrentEnabled) { 49 if (webVideoEnabled) {
50 await completeWebVideoFilesCheck({ 50 await completeWebVideoFilesCheck({
51 server, 51 server,
52 originServer: servers[0], 52 originServer: servers[0],
53 fixture: 'video_short.mp4', 53 fixture: 'video_short.mp4',
54 videoUUID: uuid, 54 videoUUID: uuid,
55 objectStorageBaseUrl: objectStorageBaseUrlWebTorrent, 55 objectStorageBaseUrl: objectStorageBaseUrlWebVideo,
56 files: [ 56 files: [
57 { resolution: 0 }, 57 { resolution: 0 },
58 { resolution: 144 }, 58 { resolution: 144 },
@@ -66,7 +66,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
66 66
67 if (hlsEnabled) { 67 if (hlsEnabled) {
68 await completeCheckHlsPlaylist({ 68 await completeCheckHlsPlaylist({
69 hlsOnly: !webtorrentEnabled, 69 hlsOnly: !webVideoEnabled,
70 servers, 70 servers,
71 videoUUID: uuid, 71 videoUUID: uuid,
72 objectStorageBaseUrl: objectStorageBaseUrlHLS, 72 objectStorageBaseUrl: objectStorageBaseUrlHLS,
@@ -84,13 +84,13 @@ describe('Test VOD transcoding in peertube-runner program', function () {
84 await waitJobs(servers, { runnerJobs: true }) 84 await waitJobs(servers, { runnerJobs: true })
85 85
86 for (const server of servers) { 86 for (const server of servers) {
87 if (webtorrentEnabled) { 87 if (webVideoEnabled) {
88 await completeWebVideoFilesCheck({ 88 await completeWebVideoFilesCheck({
89 server, 89 server,
90 originServer: servers[0], 90 originServer: servers[0],
91 fixture: 'video_short.webm', 91 fixture: 'video_short.webm',
92 videoUUID: uuid, 92 videoUUID: uuid,
93 objectStorageBaseUrl: objectStorageBaseUrlWebTorrent, 93 objectStorageBaseUrl: objectStorageBaseUrlWebVideo,
94 files: [ 94 files: [
95 { resolution: 0 }, 95 { resolution: 0 },
96 { resolution: 144 }, 96 { resolution: 144 },
@@ -104,7 +104,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
104 104
105 if (hlsEnabled) { 105 if (hlsEnabled) {
106 await completeCheckHlsPlaylist({ 106 await completeCheckHlsPlaylist({
107 hlsOnly: !webtorrentEnabled, 107 hlsOnly: !webVideoEnabled,
108 servers, 108 servers,
109 videoUUID: uuid, 109 videoUUID: uuid,
110 objectStorageBaseUrl: objectStorageBaseUrlHLS, 110 objectStorageBaseUrl: objectStorageBaseUrlHLS,
@@ -123,13 +123,13 @@ describe('Test VOD transcoding in peertube-runner program', function () {
123 await waitJobs(servers, { runnerJobs: true }) 123 await waitJobs(servers, { runnerJobs: true })
124 124
125 for (const server of servers) { 125 for (const server of servers) {
126 if (webtorrentEnabled) { 126 if (webVideoEnabled) {
127 await completeWebVideoFilesCheck({ 127 await completeWebVideoFilesCheck({
128 server, 128 server,
129 originServer: servers[0], 129 originServer: servers[0],
130 fixture: 'sample.ogg', 130 fixture: 'sample.ogg',
131 videoUUID: uuid, 131 videoUUID: uuid,
132 objectStorageBaseUrl: objectStorageBaseUrlWebTorrent, 132 objectStorageBaseUrl: objectStorageBaseUrlWebVideo,
133 files: [ 133 files: [
134 { resolution: 0 }, 134 { resolution: 0 },
135 { resolution: 144 }, 135 { resolution: 144 },
@@ -142,7 +142,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
142 142
143 if (hlsEnabled) { 143 if (hlsEnabled) {
144 await completeCheckHlsPlaylist({ 144 await completeCheckHlsPlaylist({
145 hlsOnly: !webtorrentEnabled, 145 hlsOnly: !webVideoEnabled,
146 servers, 146 servers,
147 videoUUID: uuid, 147 videoUUID: uuid,
148 objectStorageBaseUrl: objectStorageBaseUrlHLS, 148 objectStorageBaseUrl: objectStorageBaseUrlHLS,
@@ -159,13 +159,13 @@ describe('Test VOD transcoding in peertube-runner program', function () {
159 159
160 await waitJobs(servers, { runnerJobs: true }) 160 await waitJobs(servers, { runnerJobs: true })
161 161
162 if (webtorrentEnabled) { 162 if (webVideoEnabled) {
163 await completeWebVideoFilesCheck({ 163 await completeWebVideoFilesCheck({
164 server: servers[0], 164 server: servers[0],
165 originServer: servers[0], 165 originServer: servers[0],
166 fixture: 'video_short.mp4', 166 fixture: 'video_short.mp4',
167 videoUUID: uuid, 167 videoUUID: uuid,
168 objectStorageBaseUrl: objectStorageBaseUrlWebTorrent, 168 objectStorageBaseUrl: objectStorageBaseUrlWebVideo,
169 files: [ 169 files: [
170 { resolution: 0 }, 170 { resolution: 0 },
171 { resolution: 144 }, 171 { resolution: 144 },
@@ -179,7 +179,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
179 179
180 if (hlsEnabled) { 180 if (hlsEnabled) {
181 await completeCheckHlsPlaylist({ 181 await completeCheckHlsPlaylist({
182 hlsOnly: !webtorrentEnabled, 182 hlsOnly: !webVideoEnabled,
183 servers: [ servers[0] ], 183 servers: [ servers[0] ],
184 videoUUID: uuid, 184 videoUUID: uuid,
185 objectStorageBaseUrl: objectStorageBaseUrlHLS, 185 objectStorageBaseUrl: objectStorageBaseUrlHLS,
@@ -203,7 +203,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
203 203
204 await servers[0].config.enableTranscoding(true, true, true) 204 await servers[0].config.enableTranscoding(true, true, true)
205 205
206 await servers[0].videos.runTranscoding({ transcodingType: 'webtorrent', videoId: uuid }) 206 await servers[0].videos.runTranscoding({ transcodingType: 'web-video', videoId: uuid })
207 await waitJobs(servers, { runnerJobs: true }) 207 await waitJobs(servers, { runnerJobs: true })
208 208
209 await completeWebVideoFilesCheck({ 209 await completeWebVideoFilesCheck({
@@ -211,7 +211,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
211 originServer: servers[0], 211 originServer: servers[0],
212 fixture: 'video_short.mp4', 212 fixture: 'video_short.mp4',
213 videoUUID: uuid, 213 videoUUID: uuid,
214 objectStorageBaseUrl: objectStorageBaseUrlWebTorrent, 214 objectStorageBaseUrl: objectStorageBaseUrlWebVideo,
215 files: [ 215 files: [
216 { resolution: 0 }, 216 { resolution: 0 },
217 { resolution: 144 }, 217 { resolution: 144 },
@@ -262,7 +262,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
262 await servers[0].config.enableTranscoding(true, false, true) 262 await servers[0].config.enableTranscoding(true, false, true)
263 }) 263 })
264 264
265 runSuite({ webtorrentEnabled: true, hlsEnabled: false }) 265 runSuite({ webVideoEnabled: true, hlsEnabled: false })
266 }) 266 })
267 267
268 describe('HLS videos only enabled', function () { 268 describe('HLS videos only enabled', function () {
@@ -271,7 +271,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
271 await servers[0].config.enableTranscoding(false, true, true) 271 await servers[0].config.enableTranscoding(false, true, true)
272 }) 272 })
273 273
274 runSuite({ webtorrentEnabled: false, hlsEnabled: true }) 274 runSuite({ webVideoEnabled: false, hlsEnabled: true })
275 }) 275 })
276 276
277 describe('Web video & HLS enabled', function () { 277 describe('Web video & HLS enabled', function () {
@@ -280,7 +280,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
280 await servers[0].config.enableTranscoding(true, true, true) 280 await servers[0].config.enableTranscoding(true, true, true)
281 }) 281 })
282 282
283 runSuite({ webtorrentEnabled: true, hlsEnabled: true }) 283 runSuite({ webVideoEnabled: true, hlsEnabled: true })
284 }) 284 })
285 }) 285 })
286 286
@@ -306,7 +306,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
306 await servers[0].config.enableTranscoding(true, false, true) 306 await servers[0].config.enableTranscoding(true, false, true)
307 }) 307 })
308 308
309 runSuite({ webtorrentEnabled: true, hlsEnabled: false, objectStorage }) 309 runSuite({ webVideoEnabled: true, hlsEnabled: false, objectStorage })
310 }) 310 })
311 311
312 describe('HLS videos only enabled', function () { 312 describe('HLS videos only enabled', function () {
@@ -315,7 +315,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
315 await servers[0].config.enableTranscoding(false, true, true) 315 await servers[0].config.enableTranscoding(false, true, true)
316 }) 316 })
317 317
318 runSuite({ webtorrentEnabled: false, hlsEnabled: true, objectStorage }) 318 runSuite({ webVideoEnabled: false, hlsEnabled: true, objectStorage })
319 }) 319 })
320 320
321 describe('Web video & HLS enabled', function () { 321 describe('Web video & HLS enabled', function () {
@@ -324,7 +324,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
324 await servers[0].config.enableTranscoding(true, true, true) 324 await servers[0].config.enableTranscoding(true, true, true)
325 }) 325 })
326 326
327 runSuite({ webtorrentEnabled: true, hlsEnabled: true, objectStorage }) 327 runSuite({ webVideoEnabled: true, hlsEnabled: true, objectStorage })
328 }) 328 })
329 329
330 after(async function () { 330 after(async function () {
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index e951a1299..f5a0cbe85 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -302,11 +302,11 @@ describe('Test plugin helpers', function () {
302 302
303 // Video files check 303 // Video files check
304 { 304 {
305 expect(body.webtorrent.videoFiles).to.be.an('array') 305 expect(body.webVideo.videoFiles).to.be.an('array')
306 expect(body.hls.videoFiles).to.be.an('array') 306 expect(body.hls.videoFiles).to.be.an('array')
307 307
308 for (const resolution of [ 144, 240, 360, 480, 720 ]) { 308 for (const resolution of [ 144, 240, 360, 480, 720 ]) {
309 for (const files of [ body.webtorrent.videoFiles, body.hls.videoFiles ]) { 309 for (const files of [ body.webVideo.videoFiles, body.hls.videoFiles ]) {
310 const file = files.find(f => f.resolution === resolution) 310 const file = files.find(f => f.resolution === resolution)
311 expect(file).to.exist 311 expect(file).to.exist
312 312
@@ -318,7 +318,7 @@ describe('Test plugin helpers', function () {
318 } 318 }
319 } 319 }
320 320
321 videoPath = body.webtorrent.videoFiles[0].path 321 videoPath = body.webVideo.videoFiles[0].path
322 } 322 }
323 323
324 // Thumbnails check 324 // Thumbnails check
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index 689eec5ac..f3d929426 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -247,7 +247,7 @@ describe('Test transcoding plugins', function () {
247 247
248 const video = await server.videos.get({ id: videoUUID }) 248 const video = await server.videos.get({ id: videoUUID })
249 249
250 const path = server.servers.buildWebTorrentFilePath(video.files[0].fileUrl) 250 const path = server.servers.buildWebVideoFilePath(video.files[0].fileUrl)
251 const audioProbe = await getAudioStream(path) 251 const audioProbe = await getAudioStream(path)
252 expect(audioProbe.audioStream.codec_name).to.equal('opus') 252 expect(audioProbe.audioStream.codec_name).to.equal('opus')
253 253
diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts
index 0bd161820..6cba5b14c 100644
--- a/server/tests/shared/videos.ts
+++ b/server/tests/shared/videos.ts
@@ -215,22 +215,22 @@ async function checkVideoFilesWereRemoved (options: {
215}) { 215}) {
216 const { video, server, captions = [], onlyVideoFiles = false } = options 216 const { video, server, captions = [], onlyVideoFiles = false } = options
217 217
218 const webtorrentFiles = video.files || [] 218 const webVideoFiles = video.files || []
219 const hlsFiles = video.streamingPlaylists[0]?.files || [] 219 const hlsFiles = video.streamingPlaylists[0]?.files || []
220 220
221 const thumbnailName = basename(video.thumbnailPath) 221 const thumbnailName = basename(video.thumbnailPath)
222 const previewName = basename(video.previewPath) 222 const previewName = basename(video.previewPath)
223 223
224 const torrentNames = webtorrentFiles.concat(hlsFiles).map(f => basename(f.torrentUrl)) 224 const torrentNames = webVideoFiles.concat(hlsFiles).map(f => basename(f.torrentUrl))
225 225
226 const captionNames = captions.map(c => basename(c.captionPath)) 226 const captionNames = captions.map(c => basename(c.captionPath))
227 227
228 const webtorrentFilenames = webtorrentFiles.map(f => basename(f.fileUrl)) 228 const webVideoFilenames = webVideoFiles.map(f => basename(f.fileUrl))
229 const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl)) 229 const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl))
230 230
231 let directories: { [ directory: string ]: string[] } = { 231 let directories: { [ directory: string ]: string[] } = {
232 videos: webtorrentFilenames, 232 videos: webVideoFilenames,
233 redundancy: webtorrentFilenames, 233 redundancy: webVideoFilenames,
234 [join('playlists', 'hls')]: hlsFilenames, 234 [join('playlists', 'hls')]: hlsFilenames,
235 [join('redundancy', 'hls')]: hlsFilenames 235 [join('redundancy', 'hls')]: hlsFilenames
236 } 236 }
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts
index fd6c760b2..c24eb5233 100644
--- a/server/tools/peertube-redundancy.ts
+++ b/server/tools/peertube-redundancy.ts
@@ -65,19 +65,19 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) {
65 }) as any 65 }) as any
66 66
67 for (const redundancy of data) { 67 for (const redundancy of data) {
68 const webtorrentFiles = redundancy.redundancies.files 68 const webVideoFiles = redundancy.redundancies.files
69 const streamingPlaylists = redundancy.redundancies.streamingPlaylists 69 const streamingPlaylists = redundancy.redundancies.streamingPlaylists
70 70
71 let totalSize = '' 71 let totalSize = ''
72 if (target === 'remote-videos') { 72 if (target === 'remote-videos') {
73 const tmp = webtorrentFiles.concat(streamingPlaylists) 73 const tmp = webVideoFiles.concat(streamingPlaylists)
74 .reduce((a, b) => a + b.size, 0) 74 .reduce((a, b) => a + b.size, 0)
75 75
76 totalSize = bytes(tmp) 76 totalSize = bytes(tmp)
77 } 77 }
78 78
79 const instances = uniqify( 79 const instances = uniqify(
80 webtorrentFiles.concat(streamingPlaylists) 80 webVideoFiles.concat(streamingPlaylists)
81 .map(r => r.fileUrl) 81 .map(r => r.fileUrl)
82 .map(u => new URL(u).host) 82 .map(u => new URL(u).host)
83 ) 83 )
@@ -86,7 +86,7 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) {
86 redundancy.id.toString(), 86 redundancy.id.toString(),
87 redundancy.name, 87 redundancy.name,
88 redundancy.url, 88 redundancy.url,
89 webtorrentFiles.length, 89 webVideoFiles.length,
90 streamingPlaylists.length, 90 streamingPlaylists.length,
91 instances.join('\n'), 91 instances.join('\n'),
92 totalSize 92 totalSize
diff --git a/server/types/models/video/video-file.ts b/server/types/models/video/video-file.ts
index 55603e59c..68106788d 100644
--- a/server/types/models/video/video-file.ts
+++ b/server/types/models/video/video-file.ts
@@ -38,6 +38,6 @@ export function isStreamingPlaylistFile (file: any): file is MVideoFileStreaming
38 return !!file.videoStreamingPlaylistId 38 return !!file.videoStreamingPlaylistId
39} 39}
40 40
41export function isWebtorrentFile (file: any): file is MVideoFileVideo { 41export function isWebVideoFile (file: any): file is MVideoFileVideo {
42 return !!file.videoId 42 return !!file.videoId
43} 43}
diff --git a/server/types/plugins/register-server-option.model.ts b/server/types/plugins/register-server-option.model.ts
index df419fff4..103ef234b 100644
--- a/server/types/plugins/register-server-option.model.ts
+++ b/server/types/plugins/register-server-option.model.ts
@@ -41,7 +41,17 @@ export type PeerTubeHelpers = {
41 ffprobe: (path: string) => Promise<any> 41 ffprobe: (path: string) => Promise<any>
42 42
43 getFiles: (id: number | string) => Promise<{ 43 getFiles: (id: number | string) => Promise<{
44 webtorrent: { 44 webtorrent: { // TODO: remove in v7
45 videoFiles: {
46 path: string // Could be null if using remote storage
47 url: string
48 resolution: number
49 size: number
50 fps: number
51 }[]
52 }
53
54 webVideo: {
45 videoFiles: { 55 videoFiles: {
46 path: string // Could be null if using remote storage 56 path: string // Could be null if using remote storage
47 url: string 57 url: string
diff --git a/shared/models/search/videos-common-query.model.ts b/shared/models/search/videos-common-query.model.ts
index da479c928..2c52ca8cf 100644
--- a/shared/models/search/videos-common-query.model.ts
+++ b/shared/models/search/videos-common-query.model.ts
@@ -30,7 +30,9 @@ export interface VideosCommonQuery {
30 tagsAllOf?: string[] 30 tagsAllOf?: string[]
31 31
32 hasHLSFiles?: boolean 32 hasHLSFiles?: boolean
33 hasWebtorrentFiles?: boolean 33
34 hasWebtorrentFiles?: boolean // TODO: remove in v7
35 hasWebVideoFiles?: boolean
34 36
35 skipCount?: boolean 37 skipCount?: boolean
36 38
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index 9c40079fb..c14806dab 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -148,17 +148,17 @@ export interface HLSTranscodingPayload extends BaseTranscodingPayload {
148 fps: number 148 fps: number
149 copyCodecs: boolean 149 copyCodecs: boolean
150 150
151 deleteWebTorrentFiles: boolean 151 deleteWebVideoFiles: boolean
152} 152}
153 153
154export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload { 154export interface NewWebVideoResolutionTranscodingPayload extends BaseTranscodingPayload {
155 type: 'new-resolution-to-webtorrent' 155 type: 'new-resolution-to-web-video'
156 resolution: VideoResolution 156 resolution: VideoResolution
157 fps: number 157 fps: number
158} 158}
159 159
160export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { 160export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
161 type: 'merge-audio-to-webtorrent' 161 type: 'merge-audio-to-web-video'
162 162
163 resolution: VideoResolution 163 resolution: VideoResolution
164 fps: number 164 fps: number
@@ -167,7 +167,7 @@ export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
167} 167}
168 168
169export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { 169export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
170 type: 'optimize-to-webtorrent' 170 type: 'optimize-to-web-video'
171 171
172 quickTranscode: boolean 172 quickTranscode: boolean
173 173
@@ -176,7 +176,7 @@ export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
176 176
177export type VideoTranscodingPayload = 177export type VideoTranscodingPayload =
178 HLSTranscodingPayload 178 HLSTranscodingPayload
179 | NewWebTorrentResolutionTranscodingPayload 179 | NewWebVideoResolutionTranscodingPayload
180 | OptimizeTranscodingPayload 180 | OptimizeTranscodingPayload
181 | MergeAudioTranscodingPayload 181 | MergeAudioTranscodingPayload
182 182
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts
index f3cceb5f2..c1d5ffba4 100644
--- a/shared/models/users/user-update-me.model.ts
+++ b/shared/models/users/user-update-me.model.ts
@@ -5,8 +5,6 @@ export interface UserUpdateMe {
5 description?: string 5 description?: string
6 nsfwPolicy?: NSFWPolicyType 6 nsfwPolicy?: NSFWPolicyType
7 7
8 // FIXME: deprecated in favour of p2pEnabled in 4.1
9 webTorrentEnabled?: boolean
10 p2pEnabled?: boolean 8 p2pEnabled?: boolean
11 9
12 autoPlayVideo?: boolean 10 autoPlayVideo?: boolean
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index 0761c1e32..9de4118b4 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -22,8 +22,6 @@ export interface User {
22 autoPlayNextVideo: boolean 22 autoPlayNextVideo: boolean
23 autoPlayNextVideoPlaylist: boolean 23 autoPlayNextVideoPlaylist: boolean
24 24
25 // @deprecated in favour of p2pEnabled
26 webTorrentEnabled: boolean
27 p2pEnabled: boolean 25 p2pEnabled: boolean
28 26
29 videosHistoryEnabled: boolean 27 videosHistoryEnabled: boolean
diff --git a/shared/models/videos/transcoding/video-transcoding-create.model.ts b/shared/models/videos/transcoding/video-transcoding-create.model.ts
index aeb393e57..c6e756a0a 100644
--- a/shared/models/videos/transcoding/video-transcoding-create.model.ts
+++ b/shared/models/videos/transcoding/video-transcoding-create.model.ts
@@ -1,3 +1,3 @@
1export interface VideoTranscodingCreate { 1export interface VideoTranscodingCreate {
2 transcodingType: 'hls' | 'webtorrent' 2 transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
3} 3}
diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts
index 114db8091..00dc8e11c 100644
--- a/shared/server-commands/server/config-command.ts
+++ b/shared/server-commands/server/config-command.ts
@@ -131,7 +131,7 @@ export class ConfigCommand extends AbstractCommand {
131 } 131 }
132 132
133 // TODO: convert args to object 133 // TODO: convert args to object
134 enableTranscoding (webtorrent = true, hls = true, with0p = false) { 134 enableTranscoding (webVideo = true, hls = true, with0p = false) {
135 return this.updateExistingSubConfig({ 135 return this.updateExistingSubConfig({
136 newConfig: { 136 newConfig: {
137 transcoding: { 137 transcoding: {
@@ -143,7 +143,7 @@ export class ConfigCommand extends AbstractCommand {
143 resolutions: ConfigCommand.getCustomConfigResolutions(true, with0p), 143 resolutions: ConfigCommand.getCustomConfigResolutions(true, with0p),
144 144
145 webtorrent: { 145 webtorrent: {
146 enabled: webtorrent 146 enabled: webVideo
147 }, 147 },
148 hls: { 148 hls: {
149 enabled: hls 149 enabled: hls
@@ -154,7 +154,7 @@ export class ConfigCommand extends AbstractCommand {
154 } 154 }
155 155
156 // TODO: convert args to object 156 // TODO: convert args to object
157 enableMinimumTranscoding (webtorrent = true, hls = true) { 157 enableMinimumTranscoding (webVideo = true, hls = true) {
158 return this.updateExistingSubConfig({ 158 return this.updateExistingSubConfig({
159 newConfig: { 159 newConfig: {
160 transcoding: { 160 transcoding: {
@@ -170,7 +170,7 @@ export class ConfigCommand extends AbstractCommand {
170 }, 170 },
171 171
172 webtorrent: { 172 webtorrent: {
173 enabled: webtorrent 173 enabled: webVideo
174 }, 174 },
175 hls: { 175 hls: {
176 enabled: hls 176 enabled: hls
diff --git a/shared/server-commands/server/servers-command.ts b/shared/server-commands/server/servers-command.ts
index 19645cb93..4e66a900c 100644
--- a/shared/server-commands/server/servers-command.ts
+++ b/shared/server-commands/server/servers-command.ts
@@ -77,7 +77,7 @@ export class ServersCommand extends AbstractCommand {
77 return join(root(), 'test' + this.server.internalServerNumber, directory) 77 return join(root(), 'test' + this.server.internalServerNumber, directory)
78 } 78 }
79 79
80 buildWebTorrentFilePath (fileUrl: string) { 80 buildWebVideoFilePath (fileUrl: string) {
81 return this.buildDirectory(join('videos', basename(fileUrl))) 81 return this.buildDirectory(join('videos', basename(fileUrl)))
82 } 82 }
83 83
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts
index 93ca623e1..9602fa7da 100644
--- a/shared/server-commands/videos/videos-command.ts
+++ b/shared/server-commands/videos/videos-command.ts
@@ -686,10 +686,10 @@ export class VideosCommand extends AbstractCommand {
686 }) 686 })
687 } 687 }
688 688
689 removeAllWebTorrentFiles (options: OverrideCommandOptions & { 689 removeAllWebVideoFiles (options: OverrideCommandOptions & {
690 videoId: number | string 690 videoId: number | string
691 }) { 691 }) {
692 const path = '/api/v1/videos/' + options.videoId + '/webtorrent' 692 const path = '/api/v1/videos/' + options.videoId + '/web-videos'
693 693
694 return this.deleteRequest({ 694 return this.deleteRequest({
695 ...options, 695 ...options,
@@ -700,11 +700,11 @@ export class VideosCommand extends AbstractCommand {
700 }) 700 })
701 } 701 }
702 702
703 removeWebTorrentFile (options: OverrideCommandOptions & { 703 removeWebVideoFile (options: OverrideCommandOptions & {
704 videoId: number | string 704 videoId: number | string
705 fileId: number 705 fileId: number
706 }) { 706 }) {
707 const path = '/api/v1/videos/' + options.videoId + '/webtorrent/' + options.fileId 707 const path = '/api/v1/videos/' + options.videoId + '/web-videos/' + options.fileId
708 708
709 return this.deleteRequest({ 709 return this.deleteRequest({
710 ...options, 710 ...options,
@@ -717,7 +717,7 @@ export class VideosCommand extends AbstractCommand {
717 717
718 runTranscoding (options: OverrideCommandOptions & { 718 runTranscoding (options: OverrideCommandOptions & {
719 videoId: number | string 719 videoId: number | string
720 transcodingType: 'hls' | 'webtorrent' 720 transcodingType: 'hls' | 'webtorrent' | 'web-video'
721 }) { 721 }) {
722 const path = '/api/v1/videos/' + options.videoId + '/transcoding' 722 const path = '/api/v1/videos/' + options.videoId + '/transcoding'
723 723
diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md
index 493268c6e..fd5507e38 100644
--- a/support/doc/api/embeds.md
+++ b/support/doc/api/embeds.md
@@ -146,7 +146,7 @@ Value must be a valid color (`red` or `rgba(100, 100, 100, 0.5)`).
146 146
147Force a specific player engine. 147Force a specific player engine.
148 148
149Value must be a valid mode (`webtorrent` or `p2p-media-loader`). 149Value must be a valid mode (`web-video` or `p2p-media-loader`).
150 150
151### api 151### api
152 152
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index edf9990e3..e1a21fb5c 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -370,7 +370,7 @@ paths:
370 get: 370 get:
371 tags: 371 tags:
372 - Static Video Files 372 - Static Video Files
373 summary: Get public WebTorrent video file 373 summary: Get public Web Video file
374 parameters: 374 parameters:
375 - $ref: '#/components/parameters/staticFilename' 375 - $ref: '#/components/parameters/staticFilename'
376 responses: 376 responses:
@@ -382,7 +382,7 @@ paths:
382 get: 382 get:
383 tags: 383 tags:
384 - Static Video Files 384 - Static Video Files
385 summary: Get private WebTorrent video file 385 summary: Get private Web Video video file
386 parameters: 386 parameters:
387 - $ref: '#/components/parameters/staticFilename' 387 - $ref: '#/components/parameters/staticFilename'
388 - $ref: '#/components/parameters/videoFileToken' 388 - $ref: '#/components/parameters/videoFileToken'
@@ -574,7 +574,7 @@ paths:
574 - $ref: '#/components/parameters/include' 574 - $ref: '#/components/parameters/include'
575 - $ref: '#/components/parameters/privacyOneOf' 575 - $ref: '#/components/parameters/privacyOneOf'
576 - $ref: '#/components/parameters/hasHLSFiles' 576 - $ref: '#/components/parameters/hasHLSFiles'
577 - $ref: '#/components/parameters/hasWebtorrentFiles' 577 - $ref: '#/components/parameters/hasWebVideoFiles'
578 responses: 578 responses:
579 '200': 579 '200':
580 description: successful operation 580 description: successful operation
@@ -658,7 +658,7 @@ paths:
658 - $ref: '#/components/parameters/include' 658 - $ref: '#/components/parameters/include'
659 - $ref: '#/components/parameters/privacyOneOf' 659 - $ref: '#/components/parameters/privacyOneOf'
660 - $ref: '#/components/parameters/hasHLSFiles' 660 - $ref: '#/components/parameters/hasHLSFiles'
661 - $ref: '#/components/parameters/hasWebtorrentFiles' 661 - $ref: '#/components/parameters/hasWebVideoFiles'
662 responses: 662 responses:
663 '200': 663 '200':
664 description: successful operation 664 description: successful operation
@@ -748,7 +748,7 @@ paths:
748 - $ref: '#/components/parameters/include' 748 - $ref: '#/components/parameters/include'
749 - $ref: '#/components/parameters/privacyOneOf' 749 - $ref: '#/components/parameters/privacyOneOf'
750 - $ref: '#/components/parameters/hasHLSFiles' 750 - $ref: '#/components/parameters/hasHLSFiles'
751 - $ref: '#/components/parameters/hasWebtorrentFiles' 751 - $ref: '#/components/parameters/hasWebVideoFiles'
752 - $ref: '#/components/parameters/skipCount' 752 - $ref: '#/components/parameters/skipCount'
753 - $ref: '#/components/parameters/start' 753 - $ref: '#/components/parameters/start'
754 - $ref: '#/components/parameters/count' 754 - $ref: '#/components/parameters/count'
@@ -918,7 +918,7 @@ paths:
918 description: > 918 description: >
919 Arises when: 919 Arises when:
920 - the emailer is disabled and the instance is open to registrations 920 - the emailer is disabled and the instance is open to registrations
921 - webtorrent and hls are disabled with transcoding enabled - you need at least one enabled 921 - web videos and hls are disabled with transcoding enabled - you need at least one enabled
922 delete: 922 delete:
923 summary: Delete instance runtime configuration 923 summary: Delete instance runtime configuration
924 operationId: delCustomConfig 924 operationId: delCustomConfig
@@ -1873,7 +1873,7 @@ paths:
1873 - $ref: '#/components/parameters/include' 1873 - $ref: '#/components/parameters/include'
1874 - $ref: '#/components/parameters/privacyOneOf' 1874 - $ref: '#/components/parameters/privacyOneOf'
1875 - $ref: '#/components/parameters/hasHLSFiles' 1875 - $ref: '#/components/parameters/hasHLSFiles'
1876 - $ref: '#/components/parameters/hasWebtorrentFiles' 1876 - $ref: '#/components/parameters/hasWebVideoFiles'
1877 - $ref: '#/components/parameters/skipCount' 1877 - $ref: '#/components/parameters/skipCount'
1878 - $ref: '#/components/parameters/start' 1878 - $ref: '#/components/parameters/start'
1879 - $ref: '#/components/parameters/count' 1879 - $ref: '#/components/parameters/count'
@@ -2418,7 +2418,7 @@ paths:
2418 - $ref: '#/components/parameters/include' 2418 - $ref: '#/components/parameters/include'
2419 - $ref: '#/components/parameters/privacyOneOf' 2419 - $ref: '#/components/parameters/privacyOneOf'
2420 - $ref: '#/components/parameters/hasHLSFiles' 2420 - $ref: '#/components/parameters/hasHLSFiles'
2421 - $ref: '#/components/parameters/hasWebtorrentFiles' 2421 - $ref: '#/components/parameters/hasWebVideoFiles'
2422 - $ref: '#/components/parameters/skipCount' 2422 - $ref: '#/components/parameters/skipCount'
2423 - $ref: '#/components/parameters/start' 2423 - $ref: '#/components/parameters/start'
2424 - $ref: '#/components/parameters/count' 2424 - $ref: '#/components/parameters/count'
@@ -3799,7 +3799,7 @@ paths:
3799 type: object 3799 type: object
3800 properties: 3800 properties:
3801 passwords: 3801 passwords:
3802 $ref: '#/components/schemas/AddVideoPasswords' 3802 $ref: '#/components/schemas/AddVideoPasswords'
3803 responses: 3803 responses:
3804 '204': 3804 '204':
3805 description: successful operation 3805 description: successful operation
@@ -3933,7 +3933,7 @@ paths:
3933 - $ref: '#/components/parameters/include' 3933 - $ref: '#/components/parameters/include'
3934 - $ref: '#/components/parameters/privacyOneOf' 3934 - $ref: '#/components/parameters/privacyOneOf'
3935 - $ref: '#/components/parameters/hasHLSFiles' 3935 - $ref: '#/components/parameters/hasHLSFiles'
3936 - $ref: '#/components/parameters/hasWebtorrentFiles' 3936 - $ref: '#/components/parameters/hasWebVideoFiles'
3937 - $ref: '#/components/parameters/skipCount' 3937 - $ref: '#/components/parameters/skipCount'
3938 - $ref: '#/components/parameters/start' 3938 - $ref: '#/components/parameters/start'
3939 - $ref: '#/components/parameters/count' 3939 - $ref: '#/components/parameters/count'
@@ -4804,15 +4804,15 @@ paths:
4804 description: successful operation 4804 description: successful operation
4805 '404': 4805 '404':
4806 description: video does not exist 4806 description: video does not exist
4807 '/api/v1/videos/{id}/webtorrent': 4807 '/api/v1/videos/{id}/web-videos':
4808 delete: 4808 delete:
4809 summary: Delete video WebTorrent files 4809 summary: Delete video Web Video files
4810 security: 4810 security:
4811 - OAuth2: 4811 - OAuth2:
4812 - admin 4812 - admin
4813 tags: 4813 tags:
4814 - Video Files 4814 - Video Files
4815 operationId: delVideoWebTorrent 4815 operationId: delVideoWebVideos
4816 parameters: 4816 parameters:
4817 - $ref: '#/components/parameters/idOrUUID' 4817 - $ref: '#/components/parameters/idOrUUID'
4818 responses: 4818 responses:
@@ -4842,7 +4842,7 @@ paths:
4842 type: string 4842 type: string
4843 enum: 4843 enum:
4844 - hls 4844 - hls
4845 - webtorrent 4845 - web-video
4846 required: 4846 required:
4847 - transcodingType 4847 - transcodingType
4848 responses: 4848 responses:
@@ -4880,7 +4880,7 @@ paths:
4880 - $ref: '#/components/parameters/privacyOneOf' 4880 - $ref: '#/components/parameters/privacyOneOf'
4881 - $ref: '#/components/parameters/uuids' 4881 - $ref: '#/components/parameters/uuids'
4882 - $ref: '#/components/parameters/hasHLSFiles' 4882 - $ref: '#/components/parameters/hasHLSFiles'
4883 - $ref: '#/components/parameters/hasWebtorrentFiles' 4883 - $ref: '#/components/parameters/hasWebVideoFiles'
4884 - $ref: '#/components/parameters/skipCount' 4884 - $ref: '#/components/parameters/skipCount'
4885 - $ref: '#/components/parameters/start' 4885 - $ref: '#/components/parameters/start'
4886 - $ref: '#/components/parameters/count' 4886 - $ref: '#/components/parameters/count'
@@ -6471,13 +6471,13 @@ components:
6471 schema: 6471 schema:
6472 type: boolean 6472 type: boolean
6473 description: '**PeerTube >= 4.0** Display only videos that have HLS files' 6473 description: '**PeerTube >= 4.0** Display only videos that have HLS files'
6474 hasWebtorrentFiles: 6474 hasWebVideoFiles:
6475 name: hasWebtorrentFiles 6475 name: hasWebVideoFiles
6476 in: query 6476 in: query
6477 required: false 6477 required: false
6478 schema: 6478 schema:
6479 type: boolean 6479 type: boolean
6480 description: '**PeerTube >= 4.0** Display only videos that have WebTorrent files' 6480 description: '**PeerTube >= 4.0** Display only videos that have Web Video files'
6481 privacyOneOf: 6481 privacyOneOf:
6482 name: privacyOneOf 6482 name: privacyOneOf
6483 in: query 6483 in: query
@@ -7222,7 +7222,7 @@ components:
7222 items: 7222 items:
7223 $ref: '#/components/schemas/VideoFile' 7223 $ref: '#/components/schemas/VideoFile'
7224 description: | 7224 description: |
7225 WebTorrent/raw video files. If WebTorrent is disabled on the server: 7225 Web compatible video files. If Web Video is disabled on the server:
7226 7226
7227 - field will be empty 7227 - field will be empty
7228 - video files will be found in `streamingPlaylists[].files` field 7228 - video files will be found in `streamingPlaylists[].files` field
@@ -8136,13 +8136,13 @@ components:
8136 type: boolean 8136 type: boolean
8137 webtorrent: 8137 webtorrent:
8138 type: object 8138 type: object
8139 description: WebTorrent-specific settings 8139 description: Web Video specific settings
8140 properties: 8140 properties:
8141 enabled: 8141 enabled:
8142 type: boolean 8142 type: boolean
8143 hls: 8143 hls:
8144 type: object 8144 type: object
8145 description: HLS-specific settings 8145 description: HLS specific settings
8146 properties: 8146 properties:
8147 enabled: 8147 enabled:
8148 type: boolean 8148 type: boolean
@@ -9521,7 +9521,7 @@ components:
9521 type: string 9521 type: string
9522 enum: 9522 enum:
9523 - 'p2p-media-loader' 9523 - 'p2p-media-loader'
9524 - 'webtorrent' 9524 - 'web-video'
9525 resolution: 9525 resolution:
9526 type: number 9526 type: number
9527 description: Current player video resolution 9527 description: Current player video resolution
@@ -9753,7 +9753,7 @@ components:
9753 password: 9753 password:
9754 type: string 9754 type: string
9755 minLength: 2 9755 minLength: 2
9756 videoId: 9756 videoId:
9757 $ref: '#/components/schemas/id' 9757 $ref: '#/components/schemas/id'
9758 VideoPasswordList: 9758 VideoPasswordList:
9759 properties: 9759 properties:
diff --git a/support/doc/tools.md b/support/doc/tools.md
index 0c08cd200..d30ff56b3 100644
--- a/support/doc/tools.md
+++ b/support/doc/tools.md
@@ -227,7 +227,7 @@ docker-compose exec -u peertube peertube npm run regenerate-thumbnails
227 227
228### create-import-video-file-job.js 228### create-import-video-file-job.js
229 229
230You can use this script to import a video file to replace an already uploaded file or to add a new webtorrent resolution to a video. PeerTube needs to be running. 230You can use this script to import a video file to replace an already uploaded file or to add a new web compatible resolution to a video. PeerTube needs to be running.
231You can then create a transcoding job using the web interface if you need to optimize your file or create an HLS version of it. 231You can then create a transcoding job using the web interface if you need to optimize your file or create an HLS version of it.
232 232
233```bash 233```bash