From a6f2e1275c25caac77a51ecb06e0be6c12123988 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 10:28:42 +0100 Subject: Fix youtube-dl python --- support/docker/production/Dockerfile.buster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/docker/production/Dockerfile.buster b/support/docker/production/Dockerfile.buster index 515aeb5f1..dde643782 100644 --- a/support/docker/production/Dockerfile.buster +++ b/support/docker/production/Dockerfile.buster @@ -7,7 +7,7 @@ ARG NPM_RUN_BUILD_OPTS # Install dependencies RUN apt update \ - && apt install -y --no-install-recommends openssl ffmpeg gnupg gosu \ + && apt install -y --no-install-recommends openssl ffmpeg python gnupg gosu \ && gosu nobody true \ && rm /var/lib/apt/lists/* -fR -- cgit v1.2.3 From 55bc5f481318ea9cb06d88c5fee5b2408c89c7f3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 10:33:36 +0100 Subject: Add missing ca-certificates in docker image --- support/docker/production/Dockerfile.buster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/docker/production/Dockerfile.buster b/support/docker/production/Dockerfile.buster index dde643782..414bf9aac 100644 --- a/support/docker/production/Dockerfile.buster +++ b/support/docker/production/Dockerfile.buster @@ -7,7 +7,7 @@ ARG NPM_RUN_BUILD_OPTS # Install dependencies RUN apt update \ - && apt install -y --no-install-recommends openssl ffmpeg python gnupg gosu \ + && apt install -y --no-install-recommends openssl ffmpeg python ca-certificates gnupg gosu \ && gosu nobody true \ && rm /var/lib/apt/lists/* -fR -- cgit v1.2.3 From ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 11:47:47 +0100 Subject: Fix playlist cache error --- client/src/app/shared/video-playlist/video-playlist.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index bae6f9e04..38d915c6b 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts @@ -141,6 +141,8 @@ export class VideoPlaylistService { return this.authHttp.post<{ videoPlaylist: { id: number } }>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL, data) .pipe( tap(res => { + if (!this.myAccountPlaylistCache) return + this.myAccountPlaylistCache.total++ this.myAccountPlaylistCache.data.push({ @@ -161,6 +163,8 @@ export class VideoPlaylistService { .pipe( map(this.restExtractor.extractDataBool), tap(() => { + if (!this.myAccountPlaylistCache) return + const playlist = this.myAccountPlaylistCache.data.find(p => p.id === videoPlaylist.id) playlist.displayName = body.displayName @@ -175,6 +179,8 @@ export class VideoPlaylistService { .pipe( map(this.restExtractor.extractDataBool), tap(() => { + if (!this.myAccountPlaylistCache) return + this.myAccountPlaylistCache.total-- this.myAccountPlaylistCache.data = this.myAccountPlaylistCache.data .filter(p => p.id !== videoPlaylist.id) -- cgit v1.2.3 From 017fbe1855a9b3aea601595b10e62c681fbcdb17 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 11:56:28 +0100 Subject: Fix instance get config --- client/src/app/core/server/server.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index cdcbcb528..3997ce6db 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -159,8 +159,11 @@ export class ServerService { if (!this.configObservable) { this.configObservable = this.http.get(ServerService.BASE_CONFIG_URL) .pipe( - tap(this.saveConfigLocally), - tap(() => this.configLoaded = true), + tap(config => this.saveConfigLocally(config)), + tap(config => { + this.config = config + this.configLoaded = true + }), tap(() => { if (this.configReset) { this.configReloaded.next() -- cgit v1.2.3 From 7d233f1dd9c5be8d7beba7ec5b92029888e0c91c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 14:27:29 +0100 Subject: Manual approves followers only for the instance And not for accounts or channels of the instance --- server/lib/activitypub/process/process-follow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index 85f22d654..0b98d4af2 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts @@ -59,7 +59,7 @@ async function processFollow (byActor: MActorSignature, targetActorURL: string) transaction: t }) - if (actorFollow.state !== 'accepted' && CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false) { + if (actorFollow.state !== 'accepted' && isFollowingInstance && CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false) { actorFollow.state = 'accepted' await actorFollow.save({ transaction: t }) } -- cgit v1.2.3 From 1c5fbed2093c0462e40a092d49d761a043c50e98 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 15:33:42 +0100 Subject: Fix avatar update --- server/lib/activitypub/actor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index f802658cf..0b21de0ca 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -176,8 +176,8 @@ async function updateActorAvatarInstance (actor: MActorDefault, info: AvatarInfo if (!info.name) return actor if (actor.Avatar) { - // Don't update the avatar if the filename did not change - if (actor.Avatar.fileUrl === info.fileUrl) return actor + // Don't update the avatar if the file URL did not change + if (info.fileUrl && actor.Avatar.fileUrl === info.fileUrl) return actor try { await actor.Avatar.destroy({ transaction: t }) -- cgit v1.2.3 From 2db48acc46307f8f61a39ba073c3ef1ee31f2940 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 15:44:06 +0100 Subject: Correctly fix auto follows --- server/lib/activitypub/process/process-follow.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index 0b98d4af2..db7fb8568 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts @@ -59,7 +59,9 @@ async function processFollow (byActor: MActorSignature, targetActorURL: string) transaction: t }) - if (actorFollow.state !== 'accepted' && isFollowingInstance && CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false) { + // Set the follow as accepted if the remote actor follows a channel or account + // Or if the instance automatically accepts followers + if (actorFollow.state !== 'accepted' && (isFollowingInstance === false || CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false)) { actorFollow.state = 'accepted' await actorFollow.save({ transaction: t }) } -- cgit v1.2.3 From dfab4fa9c6d5b6f12ac844b191a51282b002d3f5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Feb 2020 10:04:36 +0100 Subject: Fix CSP for embeds --- server/controllers/client.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/controllers/client.ts b/server/controllers/client.ts index dc3ff18fc..56685f102 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -2,10 +2,11 @@ import * as express from 'express' import { join } from 'path' import { root } from '../helpers/core-utils' import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants' -import { asyncMiddleware } from '../middlewares' +import { asyncMiddleware, embedCSP } from '../middlewares' import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' import { ClientHtml } from '../lib/client-html' import { logger } from '../helpers/logger' +import { CONFIG } from '@server/initializers/config' const clientsRouter = express.Router() @@ -19,8 +20,13 @@ clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) +const embedCSPMiddleware = CONFIG.CSP.ENABLED + ? embedCSP + : (req: express.Request, res: express.Response, next: express.NextFunction) => next() + clientsRouter.use( '/videos/embed', + embedCSPMiddleware, (req: express.Request, res: express.Response) => { res.removeHeader('X-Frame-Options') res.sendFile(embedPath) -- cgit v1.2.3 From c06be129506de9ac8d9910fed473c86724ca0e4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Feb 2020 10:42:57 +0100 Subject: Fix scroll menu on touch devices --- client/src/app/menu/menu.component.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index 2963d4d19..112fdc1ce 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss @@ -260,3 +260,11 @@ menu { width: 100% !important; } } + +@media (hover: none) and (pointer: coarse) { + .menu-wrapper { + menu { + overflow-y: auto; + } + } +} -- cgit v1.2.3 From 49be0fd3255db54cf9b038bed792eb0de0faf591 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 21 Feb 2020 14:11:11 +0100 Subject: Fix CPU usage on PostgreSQL --- server/models/video/video.ts | 52 +++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/server/models/video/video.ts b/server/models/video/video.ts index eacffe186..a91a7663d 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -136,8 +136,7 @@ import { MVideoThumbnailBlacklist, MVideoWithAllFiles, MVideoWithFile, - MVideoWithRights, - MStreamingPlaylistFiles + MVideoWithRights } from '../../typings/models' import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../typings/models/video/video-file' import { MThumbnail } from '../../typings/models/video/thumbnail' @@ -437,42 +436,31 @@ export type AvailableForListIDsOptions = { } if (options.followerActorId) { - let localVideosReq: WhereOptions = {} + let localVideosReq = '' if (options.includeLocalVideos === true) { - localVideosReq = { remote: false } + localVideosReq = ' UNION ALL SELECT "video"."id" FROM "video" WHERE remote IS FALSE' } // Force actorId to be a number to avoid SQL injections const actorIdNumber = parseInt(options.followerActorId.toString(), 10) whereAnd.push({ - [Op.or]: [ - { - id: { - [ Op.in ]: Sequelize.literal( - '(' + - 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' + - 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + - 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + - ')' - ) - } - }, - { - id: { - [ Op.in ]: Sequelize.literal( - '(' + - 'SELECT "video"."id" AS "id" FROM "video" ' + - 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + - 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' + - 'INNER JOIN "actor" ON "account"."actorId" = "actor"."id" ' + - 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "actor"."id" ' + - 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + - ')' - ) - } - }, - localVideosReq - ] + id: { + [Op.in]: Sequelize.literal( + '(' + + 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' + + 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + + 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + + ' UNION ALL ' + + 'SELECT "video"."id" AS "id" FROM "video" ' + + 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + + 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' + + 'INNER JOIN "actor" ON "account"."actorId" = "actor"."id" ' + + 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "actor"."id" ' + + 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + + localVideosReq + + ')' + ) + } }) } -- cgit v1.2.3 From 133d9c112a19720eccc20def0c01aa0ec009c27a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Feb 2020 15:01:22 +0100 Subject: Fix IOS embed player --- client/src/standalone/videos/embed.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index c91ae08b9..5213443fc 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -262,6 +262,9 @@ export class PeerTubeEmbed { private async buildDock (videoInfo: VideoDetails, configResponse: Response) { if (this.controls) { + // On webtorrent fallback, player may have been disposed + if (!this.player.player_) return + const title = this.title ? videoInfo.name : undefined const config: ServerConfig = await configResponse.json() -- cgit v1.2.3 From c002261381a4dd0b07dd6706942d446b237fd8f4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Feb 2020 15:25:00 +0100 Subject: Correctly fix menu overflow on mobile --- client/src/app/menu/menu.component.scss | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index 112fdc1ce..b05173751 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss @@ -254,17 +254,13 @@ menu { @media screen and (max-width: $mobile-view) { .menu-wrapper { width: 100% !important; - } - - .top-menu, .footer { - width: 100% !important; - } -} -@media (hover: none) and (pointer: coarse) { - .menu-wrapper { menu { overflow-y: auto; } } + + .top-menu, .footer { + width: 100% !important; + } } -- cgit v1.2.3 From 59df8adfa2f646c30b882a8efd3ee7acb7c89739 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 27 Feb 2020 08:16:15 +0100 Subject: Update changelog --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3149476bb..4887614a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## v2.1.1 + +### Bug fixes + + * Fix youtube-dl in docker image + * Fix playlist creation/update + * Fix fetch of instance config in client + * Manual approves followers only for the instance (and not accounts/channels) + * Fix avatar update + * Fix CSP for embeds + * Fix scroll of the menu on mobile + * Fix CPU usage of PostgreSQL + * Fix embed for iOS + + ## v2.1.0 **Since v2.0.0** -- cgit v1.2.3 From 195ba6cdf38f4515a514cf8432930576539b0a04 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 27 Feb 2020 08:16:56 +0100 Subject: Bumped to version v2.1.1 --- client/package.json | 2 +- package.json | 2 +- support/doc/api/openapi.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/package.json b/client/package.json index b9ddf7042..024e0b1d9 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "peertube-client", - "version": "2.1.0", + "version": "2.1.1", "private": true, "license": "AGPL-3.0", "author": { diff --git a/package.json b/package.json index dee9840c7..49d9faf97 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "peertube", "description": "Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.", - "version": "2.1.0", + "version": "2.1.1", "private": true, "licence": "AGPL-3.0", "engines": { diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index f1cfb81a4..85f1102b4 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: PeerTube - version: 2.1.0 + version: 2.1.1 contact: name: PeerTube Community url: 'https://joinpeertube.org' -- cgit v1.2.3