From 8bb6e70be3c7199a0503aca302b4b32317520db3 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 18 May 2021 20:21:03 +0200 Subject: Fix 4106: default boolean plugin setting for frontend --- server/models/server/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server') diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.ts index 82387af6a..80c8a6be5 100644 --- a/server/models/server/plugin.ts +++ b/server/models/server/plugin.ts @@ -284,7 +284,7 @@ export class PluginModel extends Model { for (const r of registeredSettings) { if (r.private !== false) continue - result[r.name] = settings[r.name] || r.default || null + result[r.name] = settings[r.name] ?? r.default ?? null } return result -- cgit v1.2.3 From 008af5c9bb26b6a28db604d10356b4272d9c0432 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 10:08:29 +0200 Subject: Fix broadcast message log level --- server/initializers/checker-after-init.ts | 2 +- server/tests/api/server/plugins.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts index 5fd1af82f..a93c8b7fd 100644 --- a/server/initializers/checker-after-init.ts +++ b/server/initializers/checker-after-init.ts @@ -132,7 +132,7 @@ function checkConfig () { // Broadcast message if (CONFIG.BROADCAST_MESSAGE.ENABLED) { const currentLevel = CONFIG.BROADCAST_MESSAGE.LEVEL - const available = [ 'info', 'warn', 'error' ] + const available = [ 'info', 'warning', 'error' ] if (available.includes(currentLevel) === false) { return 'Broadcast message level should be ' + available.join(' or ') + ' instead of ' + currentLevel diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index 1c6eabe6d..f4190c352 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts @@ -290,7 +290,7 @@ describe('Test plugins', function () { }) it('Should update the plugin and the theme', async function () { - this.timeout(30000) + this.timeout(90000) // Wait the scheduler that get the latest plugins versions await wait(6000) -- cgit v1.2.3 From e318e0ebe11ea6299a861f99a5c1357c93b426b3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 10:21:36 +0200 Subject: Fix duplicate ffmpeg preset option for live --- server/helpers/ffmpeg-utils.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'server') diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 25d9d4951..e328c49ac 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts @@ -236,7 +236,6 @@ async function getLiveTranscodingCommand (options: { } ] - command.outputOption('-preset superfast') command.outputOption('-sc_threshold 0') addDefaultEncoderGlobalParams({ command }) -- cgit v1.2.3 From be89e66895948bb52b3f10186bcea1a8b92ef912 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 11:30:00 +0200 Subject: Avoid error when file has no torrent file --- server/models/video/video-file.ts | 4 ++++ server/models/video/video-format-utils.ts | 30 ++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'server') diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 1ad796104..0b5946149 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -401,6 +401,10 @@ export class VideoFileModel extends Model { return VideoFileModel.destroy(options) } + hasTorrent () { + return this.infoHash && this.torrentFilename + } + getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { if (this.videoId) return (this as MVideoFileVideo).Video diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index bcba90093..551cb2842 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -205,7 +205,7 @@ function videoFilesModelToFormattedJSON ( label: videoFile.resolution + 'p' }, - magnetUri: includeMagnet && videoFile.torrentFilename + magnetUri: includeMagnet && videoFile.hasTorrent() ? generateMagnetUri(video, videoFile, trackerUrls) : undefined, @@ -253,19 +253,21 @@ function addVideoFilesInAPAcc ( fps: file.fps }) - acc.push({ - type: 'Link', - mediaType: 'application/x-bittorrent' as 'application/x-bittorrent', - href: file.getTorrentUrl(), - height: file.resolution - }) - - acc.push({ - type: 'Link', - mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet', - href: generateMagnetUri(video, file, trackerUrls), - height: file.resolution - }) + if (file.hasTorrent()) { + acc.push({ + type: 'Link', + mediaType: 'application/x-bittorrent' as 'application/x-bittorrent', + href: file.getTorrentUrl(), + height: file.resolution + }) + + acc.push({ + type: 'Link', + mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet', + href: generateMagnetUri(video, file, trackerUrls), + height: file.resolution + }) + } } } -- cgit v1.2.3 From fc8f15d202e715667c5b726b4f3e7d252381c6d0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 13:14:05 +0200 Subject: Increase plugin transcoding tests timeout --- server/tests/plugins/plugin-transcoding.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'server') diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index c834b6985..eefb2294d 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts @@ -125,7 +125,7 @@ describe('Test transcoding plugins', function () { }) it('Should not use the plugin profile if not chosen by the admin', async function () { - this.timeout(120000) + this.timeout(240000) const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid await waitJobs([ server ]) @@ -134,7 +134,7 @@ describe('Test transcoding plugins', function () { }) it('Should use the vod profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'low-vod', 'default') @@ -145,7 +145,7 @@ describe('Test transcoding plugins', function () { }) it('Should apply input options in vod profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'input-options-vod', 'default') @@ -156,7 +156,7 @@ describe('Test transcoding plugins', function () { }) it('Should apply the scale filter in vod profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'bad-scale-vod', 'default') @@ -172,7 +172,7 @@ describe('Test transcoding plugins', function () { }) it('Should not use the plugin profile if not chosen by the admin', async function () { - this.timeout(120000) + this.timeout(240000) const liveVideoId = await createLiveWrapper(server) @@ -184,7 +184,7 @@ describe('Test transcoding plugins', function () { }) it('Should use the live profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'low-vod', 'low-live') @@ -198,7 +198,7 @@ describe('Test transcoding plugins', function () { }) it('Should apply the input options on live profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'low-vod', 'input-options-live') @@ -212,7 +212,7 @@ describe('Test transcoding plugins', function () { }) it('Should apply the scale filter name on live profile', async function () { - this.timeout(120000) + this.timeout(240000) await updateConf(server, 'low-vod', 'bad-scale-live') @@ -223,7 +223,7 @@ describe('Test transcoding plugins', function () { }) it('Should default to the default profile if the specified profile does not exist', async function () { - this.timeout(120000) + this.timeout(240000) await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-transcoding-one' }) @@ -268,7 +268,7 @@ describe('Test transcoding plugins', function () { }) it('Should use the new live encoders', async function () { - this.timeout(120000) + this.timeout(240000) const liveVideoId = await createLiveWrapper(server) -- cgit v1.2.3