From ff0bce13592da002a836caedf8daebcdd035260c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 May 2019 09:36:46 +0200 Subject: [PATCH 1/5] Fix crash in files cache --- server/lib/files-cache/abstract-video-static-file-cache.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/files-cache/abstract-video-static-file-cache.ts b/server/lib/files-cache/abstract-video-static-file-cache.ts index 1908cfb06..c06355446 100644 --- a/server/lib/files-cache/abstract-video-static-file-cache.ts +++ b/server/lib/files-cache/abstract-video-static-file-cache.ts @@ -18,8 +18,8 @@ export abstract class AbstractVideoStaticFileCache { maxAge, max, promise: true, - dispose: (result: GetFilePathResult) => { - if (result.isOwned !== true) { + dispose: (result?: GetFilePathResult) => { + if (result && result.isOwned !== true) { remove(result.path) .then(() => logger.debug('%s removed from %s', result.path, this.constructor.name)) .catch(err => logger.error('Cannot remove %s from cache %s.', result.path, this.constructor.name, { err })) From 964298de4e112df0e126aad755c6b077442a2821 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 May 2019 09:50:27 +0200 Subject: [PATCH 2/5] Fix playlist get for classic users --- .../validators/videos/video-playlists.ts | 3 ++- server/tests/api/videos/video-playlists.ts | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 2c3f7e542..f68eeeeb3 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts @@ -140,9 +140,10 @@ const videoPlaylistsGetValidator = [ await authenticatePromiseIfNeeded(req, res) const user = res.locals.oauth ? res.locals.oauth.token.User : null + if ( !user || - (videoPlaylist.OwnerAccount.userId !== user.id && !user.hasRight(UserRight.UPDATE_ANY_VIDEO_PLAYLIST)) + (videoPlaylist.OwnerAccount.id !== user.Account.id && !user.hasRight(UserRight.UPDATE_ANY_VIDEO_PLAYLIST)) ) { return res.status(403) .json({ error: 'Cannot get this private video playlist.' }) diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index e4d817ff8..fd5e4c4be 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -36,7 +36,8 @@ import { uploadVideo, uploadVideoAndGetId, userLogin, - waitJobs + waitJobs, + generateUserAccessToken } from '../../../../shared/extra-utils' import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model' @@ -138,6 +139,18 @@ describe('Test video playlists', function () { } }) + it('Should get private playlist for a classic user', async function () { + const token = await generateUserAccessToken(servers[0], 'toto') + + const res = await getAccountPlaylistsListWithToken(servers[0].url, token, 'toto', 0, 5) + + expect(res.body.total).to.equal(1) + expect(res.body.data).to.have.lengthOf(1) + + const playlistId = res.body.data[0].id + await getPlaylistVideos(servers[0].url, token, playlistId, 0, 5) + }) + it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () { this.timeout(30000) From c56b774d0594bb33917a9f1080deb2b8814079d7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 May 2019 10:04:07 +0200 Subject: [PATCH 3/5] Fix search with bad webfinger handles --- server/controllers/api/search.ts | 14 ++++++++++++-- server/helpers/webfinger.ts | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 534305ba6..9a1e30b83 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -59,10 +59,12 @@ function searchVideoChannels (req: express.Request, res: express.Response) { // Handle strings like @toto@example.com if (parts.length === 3 && parts[0].length === 0) parts.shift() - const isWebfingerSearch = parts.length === 2 && parts.every(p => p.indexOf(' ') === -1) + const isWebfingerSearch = parts.length === 2 && parts.every(p => p && p.indexOf(' ') === -1) if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res) + // @username -> username to search in DB + if (query.search.startsWith('@')) query.search = query.search.replace(/^@/, '') return searchVideoChannelsDB(query, res) } @@ -85,7 +87,15 @@ async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean let videoChannel: VideoChannelModel let uri = search - if (isWebfingerSearch) uri = await loadActorUrlOrGetFromWebfinger(search) + if (isWebfingerSearch) { + try { + uri = await loadActorUrlOrGetFromWebfinger(search) + } catch (err) { + logger.warn('Cannot load actor URL or get from webfinger.', { search, err }) + + return res.json({ total: 0, data: [] }) + } + } if (isUserAbleToSearchRemoteURI(res)) { try { diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index 049808846..d1229e28f 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts @@ -19,7 +19,7 @@ async function loadActorUrlOrGetFromWebfinger (uriArg: string) { const [ name, host ] = uri.split('@') let actor: ActorModel - if (host === WEBSERVER.HOST) { + if (!host || host === WEBSERVER.HOST) { actor = await ActorModel.loadLocalByName(name) } else { actor = await ActorModel.loadByNameAndHost(name, host) From 41dad651a4be830e415f40e642555532076c0d4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 Jun 2019 08:42:51 +0200 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b1b057a..363fae00d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,114 @@ # Changelog +## v1.3.0 + +**Since v1.2.0** + +### IMPORTANT NOTES + + * **nginx** Remove `text/html` from `gzip_types`: https://github.com/Chocobozzz/PeerTube/commit/7eeb6a0ba4028d0e20847b846332dd0b7747c7f8 [@bnjbvr](https://github.com/bnjbvr) + * Add `streaming_playlists` directory in configuration file. **You should configure it in your production.yaml** + * CSP configuration changed: it's now in a [dedicated section](https://github.com/Chocobozzz/PeerTube/blob/develop/config/production.yaml.example#L110) + +## Maintenance + + * Add GitPod support ([@jankeromnes](https://github.com/jankeromnes)) that could help people to contribute on PeerTube: https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#online-development + * Add reminder to restart PeerTube in upgrade script ([@ldidry](https://github.com/ldidry)) + * Add argument to dockerfile to pass options to npm run build ([@NaPs](https://github.com/NaPs)) + * Add `NOCLIENT` env support to only install server dependencies. Example: `NOCLIENT=true yarn install --pure-lockfile` ([@rigelk](https://github.com/rigelk)) + +### Docker + + * **Important**: Add host network mode to the reverse proxy section (without this, it could break videos views and P2P: https://github.com/Chocobozzz/PeerTube/issues/1643#issuecomment-464789666) + * **Important**: Add a network section to [docker-compose.yml template](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml) +and update your [.env](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/.env#L8) to fix IP forwarding issue ([@Nutomic](https://github.com/nutomic)) + * Fix SMTP default configuration ([@Nutomic](https://github.com/nutomic)) + +### Features + + * Add video playlist support + * A user has a default `Watch-later` playlist + * A user can create private, unlisted or public playlists + * An element in this playlist can start or stop at specific timestamps (you can create some kind of zapping for example) + * The difference with a channel is that you cannot subscribe to a playlist, but you can add videos from any other user in your playlist. + It's useful to organize your videos, or create a playlist of videos you like and share the link on the web etc + * Add quarantine videos (auto blacklist videos on upload) feature :tada: ([@joshmorel](https://github.com/joshmorel)) + * Add Japanese & Nederlands & Português (Portugal) support + * Add experimental HLS support + * Better playback + * Better bandwidth management (for both client & server) + * Needs to store another video file per resolution, so enabling this option multiplies the videos storage by 2 (only new uploaded videos, this is not retroactive) + * Requires ffmpeg >= 4 + * Better instance's followers management: + * Add ability to remove an instance's follower + * Add ability to forbid all new instance's followers + * Add ability to manually approve new instance's followers + * Add notification on new instance's follower + * Improve UI: + * Increase player default height + * Reduce big play button border width + * Increase thumbnail sizes + * Add hover effect on video miniature + * Add "my library" section in menu + * Add missing icons in some buttons/dropdown + * 2 rows per overview section + * Increase video thumbnail blur ([@Zig-03](https://github.com/Zig-03)) + * Improve video miniatures list on mobile + * Add animation when opening user notifications + * Add ability for admins to disable the tracker (and so the P2P aspect of PeerTube, in order to improve users privacy for example) + * Add original publication date attribute to videos, and add ability to filter on it (Andrés Maldonado) + * Add video miniature dropdown + * Add ability for admins to declare their instance as dedicated to NSFW content + * Improve SEO (there is still work to be done) + * Login is now case insensitive (if using official web client) + * Add NSFW policy & users signup policy & auto blacklist strategy in features table in about page + * Improve comment deletion warning + * Restore videos list component on history back + * Add ability to consult server logs in admin + * Allow administrators to change/reset a user's password ([@rigelk](https://github.com/rigelk)) + * Add a debug page to help admins to fix IP configuration issues + * Add ability for admins to limit users videos history size + * Add ability for admins to delete old remote videos views (reduce database size) + * Optimize video update page load + * Less refresh jobs + * Cleanup invalid AP rates/comments/shares + * Better videos redundancy config error handling + * Check emails are enabled if the admin requires email verification ([@joshmorel](https://github.com/joshmorel)) + * Add `Add /accounts/:username/ratings endpoint` ([@yohanboniface](https://github.com/yohanboniface)) + * Allow to control API rates limit from configuration ([@yohanboniface](https://github.com/yohanboniface)) + +### Bug fixes + + * Don't notify prior to scheduled update ([@joshmorel](https://github.com/joshmorel)) + * Fix account description database error + * Fix Pleroma follow + * Fix greek label + * Fix email notification for some users + * Fix translation of "Copy magnet URI" + * Fix negative seconds by displaying 0 instead [@zacharystenger](https://github.com/zacharystenger) + * Fix URL in video import notification + * Don't close help popover when clicking on it + * Fix `tmp` directory cleanup + * Fix custom CSS help + * Fix JSONLD context + * Fix privacy label display in upload form + * Fix my account settings responsiveness + * Fix keyboard icon transparency ([@gbip](https://github.com/gbip)) + * Fix contact admin button overflow + * Wait config to be loaded before loading login/signup + * Privacy is optional in upload API endpoint + * Fix hotkeys help popup overflow + +***Since v1.3.0-rc.2*** + +### Bug fixes + + * Fix duplicates in playlist add component + * Fix crash in files cache + * Fix playlist view/update 403 + * Fix search with bad webfinger handles + + ## v1.3.0-rc.2 ### Docker From 88ebb4331092c04f09c453fddafffc80ba0dd7e0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 Jun 2019 08:47:25 +0200 Subject: [PATCH 5/5] Bumped to version v1.3.0 --- 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 739b2fa63..4fca33c84 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "peertube-client", - "version": "1.3.0-rc.2", + "version": "1.3.0", "private": true, "licence": "GPLv3", "author": { diff --git a/package.json b/package.json index 25c27c447..bea949796 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": "1.3.0-rc.2", + "version": "1.3.0", "private": true, "licence": "AGPLv3", "engines": { diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 9963e1d26..de610893c 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: 1.3.0-rc.2 + version: 1.3.0 contact: name: PeerTube Community url: 'https://joinpeertube.org'