From 7e47e2aa5e13594dedde8abbb03fca914d64953d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 14 May 2021 14:25:30 +0200 Subject: [PATCH 1/8] Fix broadcast message level --- .../edit-custom-config/edit-basic-configuration.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index b7fac176d..84a793ae4 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html @@ -100,7 +100,7 @@
From d35c81fa1cb3946d887f223383a1cae58fe32b09 Mon Sep 17 00:00:00 2001 From: Stakovicz <83301974+stakovicz@users.noreply.github.com> Date: Tue, 25 May 2021 11:34:10 +0200 Subject: [PATCH 2/8] Allow SSL database parameter (#4114) * Allow SSL database parameter Allow SSL database parameter via environment variable * Allow SSL database parameter Allow SSL database parameter via environment variable * Update support/docker/production/config/custom-environment-variables.yaml Co-authored-by: Chocobozzz Co-authored-by: Chocobozzz --- support/docker/production/.env | 1 + .../docker/production/config/custom-environment-variables.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/support/docker/production/.env b/support/docker/production/.env index 3e19c3817..70743e0ec 100644 --- a/support/docker/production/.env +++ b/support/docker/production/.env @@ -8,6 +8,7 @@ POSTGRES_DB=peertube #PEERTUBE_DB_SUFFIX=_prod PEERTUBE_DB_USERNAME= PEERTUBE_DB_PASSWORD= +PEERTUBE_DB_SSL=false # Default to Postgres service name "postgres" in docker-compose.yml PEERTUBE_DB_HOSTNAME=postgres diff --git a/support/docker/production/config/custom-environment-variables.yaml b/support/docker/production/config/custom-environment-variables.yaml index 8226715e0..0ed060bbf 100644 --- a/support/docker/production/config/custom-environment-variables.yaml +++ b/support/docker/production/config/custom-environment-variables.yaml @@ -19,6 +19,9 @@ database: suffix: "PEERTUBE_DB_SUFFIX" username: "PEERTUBE_DB_USERNAME" password: "PEERTUBE_DB_PASSWORD" + ssl: + __name: "PEERTUBE_DB_SSL" + __format: "json" redis: hostname: "PEERTUBE_REDIS_HOSTNAME" From 8bb6e70be3c7199a0503aca302b4b32317520db3 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 18 May 2021 20:21:03 +0200 Subject: [PATCH 3/8] Fix 4106: default boolean plugin setting for frontend --- server/models/server/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 008af5c9bb26b6a28db604d10356b4272d9c0432 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 10:08:29 +0200 Subject: [PATCH 4/8] Fix broadcast message log level --- config/default.yaml | 4 ++-- config/production.yaml.example | 2 +- server/initializers/checker-after-init.ts | 2 +- server/tests/api/server/plugins.ts | 2 +- support/docker/production/config/production.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/default.yaml b/config/default.yaml index 370a77925..9b90bacfc 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -96,7 +96,7 @@ storage: client_overrides: 'storage/client-overrides/' log: - level: 'info' # debug/info/warning/error + level: 'info' # 'debug' | 'info' | 'warn' | 'error' rotation: enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate maxFileSize: 12MB @@ -474,7 +474,7 @@ theme: broadcast_message: enabled: false message: '' # Support markdown - level: 'info' # 'info' | 'warn' | 'error' + level: 'info' # 'info' | 'warning' | 'error' dismissable: false search: diff --git a/config/production.yaml.example b/config/production.yaml.example index fed6b45ca..47ef47279 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -94,7 +94,7 @@ storage: client_overrides: '/var/www/peertube/storage/client-overrides/' log: - level: 'info' # debug/info/warning/error + level: 'info' # 'debug' | 'info' | 'warn' | 'error' rotation: enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate maxFileSize: 12MB 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) diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml index 688f88edd..5cb39e268 100644 --- a/support/docker/production/config/production.yaml +++ b/support/docker/production/config/production.yaml @@ -62,7 +62,7 @@ storage: client_overrides: '../data/client-overrides/' log: - level: 'info' # debug/info/warn/error + level: 'info' # 'debug' | 'info' | 'warn' | 'error' tracker: enabled: true From e318e0ebe11ea6299a861f99a5c1357c93b426b3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 10:21:36 +0200 Subject: [PATCH 5/8] Fix duplicate ffmpeg preset option for live --- server/helpers/ffmpeg-utils.ts | 1 - 1 file changed, 1 deletion(-) 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 }) From 6a3391bcede8e7a2bec83963221c112e6752b1a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 11:15:18 +0200 Subject: [PATCH 6/8] cd /var/www/peertube in prod guide Avoid running db creation in /root directory --- support/doc/production.md | 1 + 1 file changed, 1 insertion(+) diff --git a/support/doc/production.md b/support/doc/production.md index 8f3a17f12..81748ae16 100644 --- a/support/doc/production.md +++ b/support/doc/production.md @@ -38,6 +38,7 @@ or use `adduser` to create it interactively. Create the production database and a peertube user inside PostgreSQL: ``` +$ cd /var/www/peertube $ sudo -u postgres createuser -P peertube ``` From be89e66895948bb52b3f10186bcea1a8b92ef912 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 11:30:00 +0200 Subject: [PATCH 7/8] Avoid error when file has no torrent file --- server/models/video/video-file.ts | 4 ++++ server/models/video/video-format-utils.ts | 28 ++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) 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 - }) + 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 - }) + 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 + }) + } } } From fc8f15d202e715667c5b726b4f3e7d252381c6d0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 May 2021 13:14:05 +0200 Subject: [PATCH 8/8] Increase plugin transcoding tests timeout --- server/tests/plugins/plugin-transcoding.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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)