From 3842a527f6c0cfd1bdc93b4088d9218efcb98a7f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Nov 2024 10:16:31 +0100 Subject: [PATCH] Remove deprecated server code --- .../shared-main/video/video-details.model.ts | 2 - .../metrics/playback-metric-create.model.ts | 2 +- .../src/search/videos-common-query.model.ts | 1 - .../server/peertube-problem-document.model.ts | 2 - .../video-transcoding-create.model.ts | 2 +- packages/models/src/videos/video.model.ts | 3 -- .../src/videos/videos-command.ts | 12 ------ .../src/api/check-params/video-passwords.ts | 1 - packages/tests/src/api/check-params/videos.ts | 4 -- .../tests/src/api/live/live-fast-restream.ts | 3 -- .../src/api/server/follow-constraints.ts | 1 - packages/tests/src/api/users/oauth.ts | 8 ++-- .../tests/src/api/videos/video-description.ts | 12 ------ packages/tests/src/plugins/filter-hooks.ts | 2 +- server/core/controllers/api/videos/files.ts | 12 +++--- server/core/controllers/api/videos/index.ts | 38 ++----------------- server/core/controllers/static.ts | 20 +++------- server/core/helpers/activity-pub-utils.ts | 5 +-- .../activitypub/cache-file.ts | 2 +- .../custom-validators/activitypub/playlist.ts | 2 +- .../custom-validators/activitypub/videos.ts | 2 +- .../activitypub/watch-action.ts | 4 +- .../core/helpers/custom-validators/metrics.ts | 11 +----- .../custom-validators/video-transcoding.ts | 11 +----- server/core/helpers/peertube-jsonld.ts | 2 +- server/core/helpers/query.ts | 1 - server/core/initializers/constants.ts | 3 -- server/core/lib/activitypub/cache-file.ts | 2 +- .../lib/activitypub/process/process-view.ts | 2 +- .../lib/plugins/plugin-helpers-builder.ts | 4 -- .../lib/transcoding/create-transcoding-job.ts | 2 +- .../job-builders/abstract-job-builder.ts | 4 +- server/core/middlewares/activitypub.ts | 2 +- server/core/middlewares/error.ts | 5 +-- .../middlewares/validators/videos/videos.ts | 4 -- .../video/formatter/video-api-format.ts | 1 - .../sql/video/videos-id-list-query-builder.ts | 5 +-- server/core/models/video/video.ts | 4 -- .../plugins/register-server-option.model.ts | 10 ----- 39 files changed, 40 insertions(+), 173 deletions(-) diff --git a/client/src/app/shared/shared-main/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.ts index 31936edb2..38ecfe483 100644 --- a/client/src/app/shared/shared-main/video/video-details.model.ts +++ b/client/src/app/shared/shared-main/video/video-details.model.ts @@ -15,7 +15,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { declare channel: VideoChannel declare account: Account - descriptionPath: string support: string tags: string[] downloadEnabled: boolean @@ -39,7 +38,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { constructor (hash: VideoDetailsServerModel, translations = {}) { super(hash, translations) - this.descriptionPath = hash.descriptionPath this.channel = new VideoChannel(hash.channel) this.account = new Account(hash.account) this.tags = hash.tags diff --git a/packages/models/src/metrics/playback-metric-create.model.ts b/packages/models/src/metrics/playback-metric-create.model.ts index f00fa75cf..2fbf5788f 100644 --- a/packages/models/src/metrics/playback-metric-create.model.ts +++ b/packages/models/src/metrics/playback-metric-create.model.ts @@ -1,7 +1,7 @@ import { VideoResolutionType } from '../videos/index.js' export interface PlaybackMetricCreate { - playerMode: 'p2p-media-loader' | 'webtorrent' | 'web-video' // FIXME: remove webtorrent player mode not used anymore in PeerTube v6 + playerMode: 'p2p-media-loader' | 'web-video' resolution?: VideoResolutionType fps?: number diff --git a/packages/models/src/search/videos-common-query.model.ts b/packages/models/src/search/videos-common-query.model.ts index e8f327c94..c69f598fc 100644 --- a/packages/models/src/search/videos-common-query.model.ts +++ b/packages/models/src/search/videos-common-query.model.ts @@ -26,7 +26,6 @@ export interface VideosCommonQuery { hasHLSFiles?: boolean - hasWebtorrentFiles?: boolean // TODO: remove in v7 hasWebVideoFiles?: boolean skipCount?: boolean diff --git a/packages/models/src/server/peertube-problem-document.model.ts b/packages/models/src/server/peertube-problem-document.model.ts index c717fc152..9b2ca67ce 100644 --- a/packages/models/src/server/peertube-problem-document.model.ts +++ b/packages/models/src/server/peertube-problem-document.model.ts @@ -22,8 +22,6 @@ export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData { title: string detail: string - // FIXME: Compat PeerTube <= 3.2 - error: string status: HttpStatusCodeType diff --git a/packages/models/src/videos/transcoding/video-transcoding-create.model.ts b/packages/models/src/videos/transcoding/video-transcoding-create.model.ts index 6c2dbefa6..54f6fcc3a 100644 --- a/packages/models/src/videos/transcoding/video-transcoding-create.model.ts +++ b/packages/models/src/videos/transcoding/video-transcoding-create.model.ts @@ -1,5 +1,5 @@ export interface VideoTranscodingCreate { - transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 + transcodingType: 'hls' | 'web-video' forceTranscoding?: boolean // Default false } diff --git a/packages/models/src/videos/video.model.ts b/packages/models/src/videos/video.model.ts index 5b37e0a43..65ed150e0 100644 --- a/packages/models/src/videos/video.model.ts +++ b/packages/models/src/videos/video.model.ts @@ -84,9 +84,6 @@ export interface VideoAdditionalAttributes { } export interface VideoDetails extends Video { - // TODO: remove, deprecated in 5.0 - descriptionPath: string - support: string channel: VideoChannel account: Account diff --git a/packages/server-commands/src/videos/videos-command.ts b/packages/server-commands/src/videos/videos-command.ts index 9e5a71679..aa1b2789b 100644 --- a/packages/server-commands/src/videos/videos-command.ts +++ b/packages/server-commands/src/videos/videos-command.ts @@ -82,18 +82,6 @@ export class VideosCommand extends AbstractCommand { // --------------------------------------------------------------------------- - getDescription (options: OverrideCommandOptions & { - descriptionPath: string - }) { - return this.getRequestBody<{ description: string }>({ - ...options, - path: options.descriptionPath, - - implicitToken: false, - defaultExpectedStatus: HttpStatusCode.OK_200 - }) - } - getFileMetadata (options: OverrideCommandOptions & { url: string }) { diff --git a/packages/tests/src/api/check-params/video-passwords.ts b/packages/tests/src/api/check-params/video-passwords.ts index 45a080620..e1108962c 100644 --- a/packages/tests/src/api/check-params/video-passwords.ts +++ b/packages/tests/src/api/check-params/video-passwords.ts @@ -376,7 +376,6 @@ describe('Test video passwords validator', function () { expect(error.code).to.equal(serverCode) expect(error.detail).to.equal(message) - expect(error.error).to.equal(message) expect(error.status).to.equal(HttpStatusCode.FORBIDDEN_403) } diff --git a/packages/tests/src/api/check-params/videos.ts b/packages/tests/src/api/check-params/videos.ts index a3fd1c0d6..49d04842a 100644 --- a/packages/tests/src/api/check-params/videos.ts +++ b/packages/tests/src/api/check-params/videos.ts @@ -457,7 +457,6 @@ describe('Test videos API validator', function () { expect(error.title).to.equal('Bad Request') expect(error.detail).to.equal('Incorrect request parameters: language') - expect(error.error).to.equal('Incorrect request parameters: language') expect(error.status).to.equal(HttpStatusCode.BAD_REQUEST_400) expect(error['invalid-params'].language).to.exist @@ -725,7 +724,6 @@ describe('Test videos API validator', function () { expect(error.title).to.equal('Bad Request') expect(error.detail).to.equal('Incorrect request parameters: licence') - expect(error.error).to.equal('Incorrect request parameters: licence') expect(error.status).to.equal(HttpStatusCode.BAD_REQUEST_400) expect(error['invalid-params'].licence).to.exist @@ -774,7 +772,6 @@ describe('Test videos API validator', function () { expect(error.title).to.equal('Bad Request') expect(error.detail).to.equal('Incorrect request parameters: id') - expect(error.error).to.equal('Incorrect request parameters: id') expect(error.status).to.equal(HttpStatusCode.BAD_REQUEST_400) expect(error['invalid-params'].id).to.exist @@ -880,7 +877,6 @@ describe('Test videos API validator', function () { expect(error.title).to.equal('Bad Request') expect(error.detail).to.equal('Incorrect request parameters: id') - expect(error.error).to.equal('Incorrect request parameters: id') expect(error.status).to.equal(HttpStatusCode.BAD_REQUEST_400) expect(error['invalid-params'].id).to.exist diff --git a/packages/tests/src/api/live/live-fast-restream.ts b/packages/tests/src/api/live/live-fast-restream.ts index d34b00cbe..61e3ee9c8 100644 --- a/packages/tests/src/api/live/live-fast-restream.ts +++ b/packages/tests/src/api/live/live-fast-restream.ts @@ -94,9 +94,6 @@ describe('Fast restream in live', function () { async function runTest (replay: boolean) { const { ffmpegCommand, liveVideoUUID } = await fastRestreamWrapper({ replay }) - // TODO: remove, we try to debug a test timeout failure here - console.log('Ensuring last live works') - await ensureLastLiveWorks(liveVideoUUID) await stopFfmpeg(ffmpegCommand) diff --git a/packages/tests/src/api/server/follow-constraints.ts b/packages/tests/src/api/server/follow-constraints.ts index 19ba0ac66..c7429ec0d 100644 --- a/packages/tests/src/api/server/follow-constraints.ts +++ b/packages/tests/src/api/server/follow-constraints.ts @@ -152,7 +152,6 @@ describe('Test follow constraints', function () { expect(error.code).to.equal(ServerErrorCode.DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS) expect(error.detail).to.equal('Cannot get this video regarding follow constraints') - expect(error.error).to.equal(error.detail) expect(error.status).to.equal(HttpStatusCode.FORBIDDEN_403) diff --git a/packages/tests/src/api/users/oauth.ts b/packages/tests/src/api/users/oauth.ts index fe50872cb..814f1e375 100644 --- a/packages/tests/src/api/users/oauth.ts +++ b/packages/tests/src/api/users/oauth.ts @@ -1,9 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import { expect } from 'chai' import { wait } from '@peertube/peertube-core-utils' import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@peertube/peertube-models' -import { SQLCommand } from '@tests/shared/sql-command.js' import { cleanupTests, createSingleServer, @@ -11,6 +9,8 @@ import { PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands' +import { SQLCommand } from '@tests/shared/sql-command.js' +import { expect } from 'chai' describe('Test oauth', function () { let server: PeerTubeServer @@ -36,7 +36,7 @@ describe('Test oauth', function () { function expectInvalidClient (body: PeerTubeProblemDocument) { expect(body.code).to.equal(OAuth2ErrorCode.INVALID_CLIENT) - expect(body.error).to.contain('client is invalid') + expect(body.detail).to.contain('client is invalid') expect(body.type.startsWith('https://')).to.be.true expect(body.type).to.contain(OAuth2ErrorCode.INVALID_CLIENT) } @@ -66,7 +66,7 @@ describe('Test oauth', function () { function expectInvalidCredentials (body: PeerTubeProblemDocument) { expect(body.code).to.equal(OAuth2ErrorCode.INVALID_GRANT) - expect(body.error).to.contain('credentials are invalid') + expect(body.detail).to.contain('credentials are invalid') expect(body.type.startsWith('https://')).to.be.true expect(body.type).to.contain(OAuth2ErrorCode.INVALID_GRANT) } diff --git a/packages/tests/src/api/videos/video-description.ts b/packages/tests/src/api/videos/video-description.ts index eb41cd71c..3e5f40a7c 100644 --- a/packages/tests/src/api/videos/video-description.ts +++ b/packages/tests/src/api/videos/video-description.ts @@ -68,15 +68,6 @@ describe('Test video description', function () { } }) - it('Should fetch long description on each server', async function () { - for (const server of servers) { - const video = await server.videos.get({ id: videoUUID }) - - const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath }) - expect(description).to.equal(longDescription) - } - }) - it('Should update with a short description', async function () { const attributes = { description: 'short description' @@ -91,9 +82,6 @@ describe('Test video description', function () { const video = await server.videos.get({ id: videoUUID }) expect(video.description).to.equal('short description') - - const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath }) - expect(description).to.equal('short description') } }) diff --git a/packages/tests/src/plugins/filter-hooks.ts b/packages/tests/src/plugins/filter-hooks.ts index efa9a0f50..d58eff51b 100644 --- a/packages/tests/src/plugins/filter-hooks.ts +++ b/packages/tests/src/plugins/filter-hooks.ts @@ -525,7 +525,7 @@ describe('Test plugin filter hooks', function () { expectedStatus: HttpStatusCode.FORBIDDEN_403 }) - expect((body as unknown as PeerTubeProblemDocument).error).to.equal('No jma 2') + expect((body as unknown as PeerTubeProblemDocument).detail).to.equal('No jma 2') }) }) diff --git a/server/core/controllers/api/videos/files.ts b/server/core/controllers/api/videos/files.ts index 39efd024a..b9149ffb4 100644 --- a/server/core/controllers/api/videos/files.ts +++ b/server/core/controllers/api/videos/files.ts @@ -1,11 +1,11 @@ -import express from 'express' -import validator from 'validator' +import { HttpStatusCode, UserRight } from '@peertube/peertube-models' import { logger, loggerTagsFactory } from '@server/helpers/logger.js' import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js' import { updateM3U8AndShaPlaylist } from '@server/lib/hls.js' import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file.js' import { VideoFileModel } from '@server/models/video/video-file.js' -import { HttpStatusCode, UserRight } from '@peertube/peertube-models' +import express from 'express' +import validator from 'validator' import { asyncMiddleware, authenticate, @@ -40,15 +40,13 @@ filesRouter.delete('/:id/hls/:videoFileId', asyncMiddleware(removeHLSFileController) ) -filesRouter.delete( - [ '/:id/webtorrent', '/:id/web-videos' ], // TODO: remove webtorrent in V7 +filesRouter.delete('/:id/web-videos', authenticate, ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), asyncMiddleware(videoFilesDeleteWebVideoValidator), asyncMiddleware(removeAllWebVideoFilesController) ) -filesRouter.delete( - [ '/:id/webtorrent/:videoFileId', '/:id/web-videos/:videoFileId' ], // TODO: remove webtorrent in V7 +filesRouter.delete('/:id/web-videos/:videoFileId', authenticate, ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), asyncMiddleware(videoFilesDeleteWebVideoFileValidator), diff --git a/server/core/controllers/api/videos/index.ts b/server/core/controllers/api/videos/index.ts index a962b6789..c69056df6 100644 --- a/server/core/controllers/api/videos/index.ts +++ b/server/core/controllers/api/videos/index.ts @@ -1,15 +1,13 @@ -import express from 'express' import { HttpStatusCode } from '@peertube/peertube-models' import { pickCommonVideoQuery } from '@server/helpers/query.js' -import { doJSONRequest } from '@server/helpers/requests.js' import { openapiOperationDoc } from '@server/middlewares/doc.js' import { getServerActor } from '@server/models/application/application.js' -import { MVideoAccountLight } from '@server/types/models/index.js' +import express from 'express' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger.js' import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils.js' import { logger } from '../../../helpers/logger.js' import { getFormattedObjects } from '../../../helpers/utils.js' -import { REMOTE_SCHEME, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants.js' +import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants.js' import { sequelizeTypescript } from '../../../initializers/database.js' import { JobQueue } from '../../../lib/job-queue/index.js' import { Hooks } from '../../../lib/plugins/hooks.js' @@ -25,7 +23,6 @@ import { setDefaultPagination, setDefaultVideosSort, videosCustomGetValidator, - videosGetValidator, videosRemoveValidator, videosSortValidator } from '../../../middlewares/index.js' @@ -33,6 +30,7 @@ import { guessAdditionalAttributesFromQuery } from '../../../models/video/format import { VideoModel } from '../../../models/video/video.js' import { blacklistRouter } from './blacklist.js' import { videoCaptionsRouter } from './captions.js' +import { videoChaptersRouter } from './chapters.js' import { videoCommentRouter } from './comment.js' import { filesRouter } from './files.js' import { videoImportsRouter } from './import.js' @@ -49,7 +47,6 @@ import { transcodingRouter } from './transcoding.js' import { updateRouter } from './update.js' import { uploadRouter } from './upload.js' import { viewRouter } from './view.js' -import { videoChaptersRouter } from './chapters.js' const auditLogger = auditLoggerFactory('videos') const videosRouter = express.Router() @@ -104,13 +101,6 @@ videosRouter.get('/', asyncMiddleware(listVideos) ) -// TODO: remove, deprecated in 5.0 now we send the complete description in VideoDetails -videosRouter.get('/:id/description', - openapiOperationDoc({ operationId: 'getVideoDesc' }), - asyncMiddleware(videosGetValidator), - asyncMiddleware(getVideoDescription) -) - videosRouter.get('/:id', openapiOperationDoc({ operationId: 'getVideo' }), optionalAuthenticate, @@ -165,16 +155,6 @@ async function getVideo (req: express.Request, res: express.Response) { return res.json(video.toFormattedDetailsJSON()) } -async function getVideoDescription (req: express.Request, res: express.Response) { - const videoInstance = res.locals.videoAll - - const description = videoInstance.isOwned() - ? videoInstance.description - : await fetchRemoteVideoDescription(videoInstance) - - return res.json({ description }) -} - async function listVideos (req: express.Request, res: express.Response) { const serverActor = await getServerActor() @@ -218,15 +198,3 @@ async function removeVideo (req: express.Request, res: express.Response) { .status(HttpStatusCode.NO_CONTENT_204) .end() } - -// --------------------------------------------------------------------------- - -// FIXME: Should not exist, we rely on specific API -async function fetchRemoteVideoDescription (video: MVideoAccountLight) { - const host = video.VideoChannel.Account.Actor.Server.host - const path = video.getDescriptionAPIPath() - const url = REMOTE_SCHEME.HTTP + '://' + host + path - - const { body } = await doJSONRequest(url) - return body.description || '' -} diff --git a/server/core/controllers/static.ts b/server/core/controllers/static.ts index 85618f64b..6c6894536 100644 --- a/server/core/controllers/static.ts +++ b/server/core/controllers/static.ts @@ -1,7 +1,4 @@ -import cors from 'cors' -import express from 'express' -import { readFile } from 'fs/promises' -import { join } from 'path' +import { HttpStatusCode } from '@peertube/peertube-models' import { injectQueryToPlaylistUrls } from '@server/lib/hls.js' import { asyncMiddleware, @@ -10,9 +7,12 @@ import { handleStaticError, optionalAuthenticate } from '@server/middlewares/index.js' -import { HttpStatusCode } from '@peertube/peertube-models' +import cors from 'cors' +import express from 'express' +import { readFile } from 'fs/promises' +import { join } from 'path' import { CONFIG } from '../initializers/config.js' -import { DIRECTORIES, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants.js' +import { DIRECTORIES, STATIC_PATHS } from '../initializers/constants.js' import { buildReinjectVideoFileTokenQuery, doReinjectVideoFileToken } from './shared/m3u8-playlist.js' const staticRouter = express.Router() @@ -72,14 +72,6 @@ staticRouter.use( handleStaticError ) -// FIXME: deprecated in v6, to remove -const thumbnailsPhysicalPath = CONFIG.STORAGE.THUMBNAILS_DIR -staticRouter.use( - STATIC_PATHS.THUMBNAILS, - express.static(thumbnailsPhysicalPath, { maxAge: STATIC_MAX_AGE.SERVER, fallthrough: false }), - handleStaticError -) - // --------------------------------------------------------------------------- export { diff --git a/server/core/helpers/activity-pub-utils.ts b/server/core/helpers/activity-pub-utils.ts index 46ae4429a..d3c5667de 100644 --- a/server/core/helpers/activity-pub-utils.ts +++ b/server/core/helpers/activity-pub-utils.ts @@ -233,10 +233,7 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string }, lemmy: 'https://join-lemmy.org/ns#', - postingRestrictedToMods: 'lemmy:postingRestrictedToMods', - - // TODO: remove in a few versions, introduced in 4.2 - icons: 'as:icon' + postingRestrictedToMods: 'lemmy:postingRestrictedToMods' }), WatchAction: buildContext({ diff --git a/server/core/helpers/custom-validators/activitypub/cache-file.ts b/server/core/helpers/custom-validators/activitypub/cache-file.ts index 6b184a024..934700b74 100644 --- a/server/core/helpers/custom-validators/activitypub/cache-file.ts +++ b/server/core/helpers/custom-validators/activitypub/cache-file.ts @@ -20,7 +20,7 @@ function isPlaylistRedundancyUrlValid (url: any) { isActivityPubUrlValid(url.href) } -// TODO: compat with < 6.1, use isRemoteVideoUrlValid instead in 7.0 +// TODO: compat with < 6.1, use isRemoteVideoUrlValid instead in 8.0 function isRedundancyUrlVideoValid (url: any) { const size = url.size || url['_:size'] const fps = url.fps || url['_fps'] diff --git a/server/core/helpers/custom-validators/activitypub/playlist.ts b/server/core/helpers/custom-validators/activitypub/playlist.ts index acd337c87..69e8a202d 100644 --- a/server/core/helpers/custom-validators/activitypub/playlist.ts +++ b/server/core/helpers/custom-validators/activitypub/playlist.ts @@ -7,7 +7,7 @@ import { isActivityPubUrlValid } from './misc.js' export function isPlaylistObjectValid (object: PlaylistObject) { if (!object || object.type !== 'Playlist') return false - // TODO: compat with < 6.1, remove in 7.0 + // TODO: compat with < 6.1, remove in 8.0 if (!object.uuid && object['identifier']) object.uuid = object['identifier'] return validator.default.isInt(object.totalItems + '') && diff --git a/server/core/helpers/custom-validators/activitypub/videos.ts b/server/core/helpers/custom-validators/activitypub/videos.ts index 51f66134e..634821917 100644 --- a/server/core/helpers/custom-validators/activitypub/videos.ts +++ b/server/core/helpers/custom-validators/activitypub/videos.ts @@ -47,7 +47,7 @@ export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) { if (!setValidStoryboard(video)) return fail('preview (storyboard)') if (!setValidLicence(video)) return fail('licence') - // TODO: compat with < 6.1, remove in 7.0 + // TODO: compat with < 6.1, remove in 8.0 if (!video.uuid && video['identifier']) video.uuid = video['identifier'] // Default attributes diff --git a/server/core/helpers/custom-validators/activitypub/watch-action.ts b/server/core/helpers/custom-validators/activitypub/watch-action.ts index b2c86ab95..a34c39814 100644 --- a/server/core/helpers/custom-validators/activitypub/watch-action.ts +++ b/server/core/helpers/custom-validators/activitypub/watch-action.ts @@ -7,7 +7,7 @@ import { isActivityPubVideoDurationValid, isObjectValid } from './misc.js' function isWatchActionObjectValid (action: WatchActionObject) { if (!action || action.type !== 'WatchAction') return false - // TODO: compat with < 6.1, remove in 7.0 + // TODO: compat with < 6.1, remove in 8.0 if (!action.uuid && action['identifier']) action.uuid = action['identifier'] if (action['_:actionStatus'] && !action.actionStatus) action.actionStatus = action['_:actionStatus'] @@ -43,7 +43,7 @@ function isLocationValid (location: any) { function areWatchSectionsValid (sections: WatchActionObject['watchSections']) { return Array.isArray(sections) && sections.every(s => { - // TODO: compat with < 6.1, remove in 7.0 + // TODO: compat with < 6.1, remove in 8.0 if (s['_:endTimestamp'] && !s.endTimestamp) s.endTimestamp = s['_:endTimestamp'] return isVideoTimeValid(s.startTimestamp) && isVideoTimeValid(s.endTimestamp) diff --git a/server/core/helpers/custom-validators/metrics.ts b/server/core/helpers/custom-validators/metrics.ts index 44a863630..681bda171 100644 --- a/server/core/helpers/custom-validators/metrics.ts +++ b/server/core/helpers/custom-validators/metrics.ts @@ -1,10 +1,3 @@ -function isValidPlayerMode (value: any) { - // TODO: remove webtorrent in v7 - return value === 'webtorrent' || value === 'web-video' || value === 'p2p-media-loader' -} - -// --------------------------------------------------------------------------- - -export { - isValidPlayerMode +export function isValidPlayerMode (value: any) { + return value === 'web-video' || value === 'p2p-media-loader' } diff --git a/server/core/helpers/custom-validators/video-transcoding.ts b/server/core/helpers/custom-validators/video-transcoding.ts index aa09d273e..239bc090d 100644 --- a/server/core/helpers/custom-validators/video-transcoding.ts +++ b/server/core/helpers/custom-validators/video-transcoding.ts @@ -1,12 +1,5 @@ import { exists } from './misc.js' -function isValidCreateTranscodingType (value: any) { - return exists(value) && - (value === 'hls' || value === 'webtorrent' || value === 'web-video') // TODO: remove webtorrent in v7 -} - -// --------------------------------------------------------------------------- - -export { - isValidCreateTranscodingType +export function isValidCreateTranscodingType (value: any) { + return exists(value) && (value === 'hls' || value === 'web-video') } diff --git a/server/core/helpers/peertube-jsonld.ts b/server/core/helpers/peertube-jsonld.ts index f22743a18..33aab236e 100644 --- a/server/core/helpers/peertube-jsonld.ts +++ b/server/core/helpers/peertube-jsonld.ts @@ -34,7 +34,7 @@ export async function compactJSONLDAndCheckRSA2017Signature (fromActor: MActor, return false } - // TODO: compat with < 6.1, remove in 7.0 + // TODO: compat with < 6.1, remove in 8.0 let safe = true if ( (compacted.type === 'Create' && (compacted?.object?.type === 'WatchAction' || compacted?.object?.type === 'CacheFile')) || diff --git a/server/core/helpers/query.ts b/server/core/helpers/query.ts index 28cab9c21..4933daf83 100644 --- a/server/core/helpers/query.ts +++ b/server/core/helpers/query.ts @@ -23,7 +23,6 @@ function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) { 'include', 'skipCount', 'hasHLSFiles', - 'hasWebtorrentFiles', // TODO: Remove in v7 'hasWebVideoFiles', 'search', 'excludeAlreadyWatched', diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.ts index 75f538597..c8e57e771 100644 --- a/server/core/initializers/constants.ts +++ b/server/core/initializers/constants.ts @@ -845,9 +845,6 @@ export const USER_EXPORT_FILE_PREFIX = 'user-export-' // Express static paths (router) export const STATIC_PATHS = { - // TODO: deprecated in v6, to remove - THUMBNAILS: '/static/thumbnails/', - // Need to keep this legacy path for previously generated torrents LEGACY_WEB_VIDEOS: '/static/webseed/', WEB_VIDEOS: '/static/web-videos/', diff --git a/server/core/lib/activitypub/cache-file.ts b/server/core/lib/activitypub/cache-file.ts index a446f3e7c..475a55a2b 100644 --- a/server/core/lib/activitypub/cache-file.ts +++ b/server/core/lib/activitypub/cache-file.ts @@ -66,7 +66,7 @@ function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject } const url = cacheFileObject.url - const urlFPS = exists(url.fps) // TODO: compat with < 6.1, remove in 7.0 + const urlFPS = exists(url.fps) // TODO: compat with < 6.1, remove in 8.0 ? url.fps : url['_:fps'] diff --git a/server/core/lib/activitypub/process/process-view.ts b/server/core/lib/activitypub/process/process-view.ts index 2687eec30..12e86d993 100644 --- a/server/core/lib/activitypub/process/process-view.ts +++ b/server/core/lib/activitypub/process/process-view.ts @@ -57,7 +57,7 @@ function getViewerResultCounter (activity: ActivityView) { return counter } -// TODO: compat with < 6.1, remove in 7.0 +// TODO: compat with < 6.1, remove in 8.0 function getExpires (activity: ActivityView) { return activity.expires || activity['expiration'] as string } diff --git a/server/core/lib/plugins/plugin-helpers-builder.ts b/server/core/lib/plugins/plugin-helpers-builder.ts index 19c9f4ab5..05b14362c 100644 --- a/server/core/lib/plugins/plugin-helpers-builder.ts +++ b/server/core/lib/plugins/plugin-helpers-builder.ts @@ -142,10 +142,6 @@ function buildVideosHelpers () { })) return { - webtorrent: { // TODO: remove in v7 - videoFiles: webVideoFiles - }, - webVideo: { videoFiles: webVideoFiles }, diff --git a/server/core/lib/transcoding/create-transcoding-job.ts b/server/core/lib/transcoding/create-transcoding-job.ts index aea18b632..b13d2b8ac 100644 --- a/server/core/lib/transcoding/create-transcoding-job.ts +++ b/server/core/lib/transcoding/create-transcoding-job.ts @@ -15,7 +15,7 @@ export function createOptimizeOrMergeAudioJobs (options: { // --------------------------------------------------------------------------- export function createTranscodingJobs (options: { - transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 + transcodingType: 'hls' | 'web-video' video: MVideoFullLight resolutions: number[] isNewVideo: boolean diff --git a/server/core/lib/transcoding/shared/job-builders/abstract-job-builder.ts b/server/core/lib/transcoding/shared/job-builders/abstract-job-builder.ts index 672fec6bc..701f5dd4a 100644 --- a/server/core/lib/transcoding/shared/job-builders/abstract-job-builder.ts +++ b/server/core/lib/transcoding/shared/job-builders/abstract-job-builder.ts @@ -137,7 +137,7 @@ export abstract class AbstractJobBuilder

{ } async createTranscodingJobs (options: { - transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 + transcodingType: 'hls' | 'web-video' video: MVideoFullLight resolutions: number[] isNewVideo: boolean @@ -164,7 +164,7 @@ export abstract class AbstractJobBuilder

{ return this.buildHLSJobPayload({ video, resolution, fps, isNewVideo, separatedAudio }) } - if (transcodingType === 'webtorrent' || transcodingType === 'web-video') { + if (transcodingType === 'web-video') { return this.buildWebVideoJobPayload({ video, resolution, fps, isNewVideo }) } diff --git a/server/core/middlewares/activitypub.ts b/server/core/middlewares/activitypub.ts index 1eb380733..f531c2333 100644 --- a/server/core/middlewares/activitypub.ts +++ b/server/core/middlewares/activitypub.ts @@ -57,7 +57,7 @@ export function executeIfActivityPub (req: Request, res: Response, next: NextFun async function checkHttpSignature (req: Request, res: Response) { return wrapWithSpanAndContext('peertube.activitypub.checkHTTPSignature', async () => { - // FIXME: compatibility with http-signature < v1.3 + // Compatibility with http-signature < v1.3 const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '') diff --git a/server/core/middlewares/error.ts b/server/core/middlewares/error.ts index 020791ae0..6b84370b5 100644 --- a/server/core/middlewares/error.ts +++ b/server/core/middlewares/error.ts @@ -11,10 +11,7 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e ...data, docs: res.locals.docUrl, - code: type, - - // For <= 3.2 compatibility - error: message + code: type }) const json = new ProblemDocument({ diff --git a/server/core/middlewares/validators/videos/videos.ts b/server/core/middlewares/validators/videos/videos.ts index 0a63dc234..b94367c3d 100644 --- a/server/core/middlewares/validators/videos/videos.ts +++ b/server/core/middlewares/validators/videos/videos.ts @@ -472,10 +472,6 @@ export const commonVideosFiltersValidator = [ .optional() .customSanitizer(toBooleanOrNull) .custom(isBooleanValid).withMessage('Should have a valid hasHLSFiles boolean'), - query('hasWebtorrentFiles') // TODO: remove in v7 - .optional() - .customSanitizer(toBooleanOrNull) - .custom(isBooleanValid).withMessage('Should have a valid hasWebtorrentFiles boolean'), query('hasWebVideoFiles') .optional() .customSanitizer(toBooleanOrNull) diff --git a/server/core/models/video/formatter/video-api-format.ts b/server/core/models/video/formatter/video-api-format.ts index b95b7565e..66b62b520 100644 --- a/server/core/models/video/formatter/video-api-format.ts +++ b/server/core/models/video/formatter/video-api-format.ts @@ -157,7 +157,6 @@ export function videoModelToFormattedDetailsJSON (video: MVideoFormattableDetail ...videoJSON, support: video.support, - descriptionPath: video.getDescriptionAPIPath(), channel: video.VideoChannel.toFormattedJSON(), account: video.VideoChannel.Account.toFormattedJSON(), tags, diff --git a/server/core/models/video/sql/video/videos-id-list-query-builder.ts b/server/core/models/video/sql/video/videos-id-list-query-builder.ts index f4c9a7c66..02b3f98e0 100644 --- a/server/core/models/video/sql/video/videos-id-list-query-builder.ts +++ b/server/core/models/video/sql/video/videos-id-list-query-builder.ts @@ -54,7 +54,6 @@ export type BuildVideosListQueryOptions = { hasHLSFiles?: boolean hasWebVideoFiles?: boolean - hasWebtorrentFiles?: boolean // TODO: Remove in v7 accountId?: number videoChannelId?: number @@ -188,9 +187,7 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery { this.whereFileExists() } - if (exists(options.hasWebtorrentFiles)) { - this.whereWebVideoFileExists(options.hasWebtorrentFiles) - } else if (exists(options.hasWebVideoFiles)) { + if (exists(options.hasWebVideoFiles)) { this.whereWebVideoFileExists(options.hasWebVideoFiles) } diff --git a/server/core/models/video/video.ts b/server/core/models/video/video.ts index d72e5f744..8a471f9da 100644 --- a/server/core/models/video/video.ts +++ b/server/core/models/video/video.ts @@ -1154,7 +1154,6 @@ export class VideoModel extends SequelizeModel { hasFiles?: boolean // default false - hasWebtorrentFiles?: boolean // TODO: remove in v7 hasWebVideoFiles?: boolean hasHLSFiles?: boolean @@ -1223,7 +1222,6 @@ export class VideoModel extends SequelizeModel { 'user', 'historyOfUser', 'hasHLSFiles', - 'hasWebtorrentFiles', 'hasWebVideoFiles', 'search', 'excludeAlreadyWatched' @@ -1258,7 +1256,6 @@ export class VideoModel extends SequelizeModel { user?: MUserAccountId - hasWebtorrentFiles?: boolean // TODO: remove in v7 hasWebVideoFiles?: boolean hasHLSFiles?: boolean @@ -1311,7 +1308,6 @@ export class VideoModel extends SequelizeModel { 'durationMin', 'durationMax', 'hasHLSFiles', - 'hasWebtorrentFiles', 'hasWebVideoFiles', 'uuids', 'search', diff --git a/server/core/types/plugins/register-server-option.model.ts b/server/core/types/plugins/register-server-option.model.ts index 07dfd8082..536dedddc 100644 --- a/server/core/types/plugins/register-server-option.model.ts +++ b/server/core/types/plugins/register-server-option.model.ts @@ -42,16 +42,6 @@ export type PeerTubeHelpers = { ffprobe: (path: string) => Promise getFiles: (id: number | string) => Promise<{ - webtorrent: { // TODO: remove in v7 - videoFiles: { - path: string // Could be null if using remote storage - url: string - resolution: number - size: number - fps: number - }[] - } - webVideo: { videoFiles: { path: string // Could be null if using remote storage