Remove deprecated server code

This commit is contained in:
Chocobozzz 2024-11-04 10:16:31 +01:00
parent 11fd3a4618
commit 3842a527f6
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
39 changed files with 40 additions and 173 deletions

View File

@ -15,7 +15,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
declare channel: VideoChannel declare channel: VideoChannel
declare account: Account declare account: Account
descriptionPath: string
support: string support: string
tags: string[] tags: string[]
downloadEnabled: boolean downloadEnabled: boolean
@ -39,7 +38,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
constructor (hash: VideoDetailsServerModel, translations = {}) { constructor (hash: VideoDetailsServerModel, translations = {}) {
super(hash, translations) super(hash, translations)
this.descriptionPath = hash.descriptionPath
this.channel = new VideoChannel(hash.channel) this.channel = new VideoChannel(hash.channel)
this.account = new Account(hash.account) this.account = new Account(hash.account)
this.tags = hash.tags this.tags = hash.tags

View File

@ -1,7 +1,7 @@
import { VideoResolutionType } from '../videos/index.js' import { VideoResolutionType } from '../videos/index.js'
export interface PlaybackMetricCreate { 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 resolution?: VideoResolutionType
fps?: number fps?: number

View File

@ -26,7 +26,6 @@ export interface VideosCommonQuery {
hasHLSFiles?: boolean hasHLSFiles?: boolean
hasWebtorrentFiles?: boolean // TODO: remove in v7
hasWebVideoFiles?: boolean hasWebVideoFiles?: boolean
skipCount?: boolean skipCount?: boolean

View File

@ -22,8 +22,6 @@ export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData {
title: string title: string
detail: string detail: string
// FIXME: Compat PeerTube <= 3.2
error: string
status: HttpStatusCodeType status: HttpStatusCodeType

View File

@ -1,5 +1,5 @@
export interface VideoTranscodingCreate { export interface VideoTranscodingCreate {
transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 transcodingType: 'hls' | 'web-video'
forceTranscoding?: boolean // Default false forceTranscoding?: boolean // Default false
} }

View File

@ -84,9 +84,6 @@ export interface VideoAdditionalAttributes {
} }
export interface VideoDetails extends Video { export interface VideoDetails extends Video {
// TODO: remove, deprecated in 5.0
descriptionPath: string
support: string support: string
channel: VideoChannel channel: VideoChannel
account: Account account: Account

View File

@ -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 & { getFileMetadata (options: OverrideCommandOptions & {
url: string url: string
}) { }) {

View File

@ -376,7 +376,6 @@ describe('Test video passwords validator', function () {
expect(error.code).to.equal(serverCode) expect(error.code).to.equal(serverCode)
expect(error.detail).to.equal(message) expect(error.detail).to.equal(message)
expect(error.error).to.equal(message)
expect(error.status).to.equal(HttpStatusCode.FORBIDDEN_403) expect(error.status).to.equal(HttpStatusCode.FORBIDDEN_403)
} }

View File

@ -457,7 +457,6 @@ describe('Test videos API validator', function () {
expect(error.title).to.equal('Bad Request') expect(error.title).to.equal('Bad Request')
expect(error.detail).to.equal('Incorrect request parameters: language') 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.status).to.equal(HttpStatusCode.BAD_REQUEST_400)
expect(error['invalid-params'].language).to.exist 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.title).to.equal('Bad Request')
expect(error.detail).to.equal('Incorrect request parameters: licence') 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.status).to.equal(HttpStatusCode.BAD_REQUEST_400)
expect(error['invalid-params'].licence).to.exist 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.title).to.equal('Bad Request')
expect(error.detail).to.equal('Incorrect request parameters: id') 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.status).to.equal(HttpStatusCode.BAD_REQUEST_400)
expect(error['invalid-params'].id).to.exist 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.title).to.equal('Bad Request')
expect(error.detail).to.equal('Incorrect request parameters: id') 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.status).to.equal(HttpStatusCode.BAD_REQUEST_400)
expect(error['invalid-params'].id).to.exist expect(error['invalid-params'].id).to.exist

View File

@ -94,9 +94,6 @@ describe('Fast restream in live', function () {
async function runTest (replay: boolean) { async function runTest (replay: boolean) {
const { ffmpegCommand, liveVideoUUID } = await fastRestreamWrapper({ replay }) 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 ensureLastLiveWorks(liveVideoUUID)
await stopFfmpeg(ffmpegCommand) await stopFfmpeg(ffmpegCommand)

View File

@ -152,7 +152,6 @@ describe('Test follow constraints', function () {
expect(error.code).to.equal(ServerErrorCode.DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS) 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.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) expect(error.status).to.equal(HttpStatusCode.FORBIDDEN_403)

View File

@ -1,9 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { wait } from '@peertube/peertube-core-utils' import { wait } from '@peertube/peertube-core-utils'
import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@peertube/peertube-models' import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@peertube/peertube-models'
import { SQLCommand } from '@tests/shared/sql-command.js'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -11,6 +9,8 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@peertube/peertube-server-commands' } from '@peertube/peertube-server-commands'
import { SQLCommand } from '@tests/shared/sql-command.js'
import { expect } from 'chai'
describe('Test oauth', function () { describe('Test oauth', function () {
let server: PeerTubeServer let server: PeerTubeServer
@ -36,7 +36,7 @@ describe('Test oauth', function () {
function expectInvalidClient (body: PeerTubeProblemDocument) { function expectInvalidClient (body: PeerTubeProblemDocument) {
expect(body.code).to.equal(OAuth2ErrorCode.INVALID_CLIENT) 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.startsWith('https://')).to.be.true
expect(body.type).to.contain(OAuth2ErrorCode.INVALID_CLIENT) expect(body.type).to.contain(OAuth2ErrorCode.INVALID_CLIENT)
} }
@ -66,7 +66,7 @@ describe('Test oauth', function () {
function expectInvalidCredentials (body: PeerTubeProblemDocument) { function expectInvalidCredentials (body: PeerTubeProblemDocument) {
expect(body.code).to.equal(OAuth2ErrorCode.INVALID_GRANT) 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.startsWith('https://')).to.be.true
expect(body.type).to.contain(OAuth2ErrorCode.INVALID_GRANT) expect(body.type).to.contain(OAuth2ErrorCode.INVALID_GRANT)
} }

View File

@ -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 () { it('Should update with a short description', async function () {
const attributes = { const attributes = {
description: 'short description' description: 'short description'
@ -91,9 +82,6 @@ describe('Test video description', function () {
const video = await server.videos.get({ id: videoUUID }) const video = await server.videos.get({ id: videoUUID })
expect(video.description).to.equal('short description') expect(video.description).to.equal('short description')
const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
expect(description).to.equal('short description')
} }
}) })

View File

@ -525,7 +525,7 @@ describe('Test plugin filter hooks', function () {
expectedStatus: HttpStatusCode.FORBIDDEN_403 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')
}) })
}) })

View File

@ -1,11 +1,11 @@
import express from 'express' import { HttpStatusCode, UserRight } from '@peertube/peertube-models'
import validator from 'validator'
import { logger, loggerTagsFactory } from '@server/helpers/logger.js' import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js' import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'
import { updateM3U8AndShaPlaylist } from '@server/lib/hls.js' import { updateM3U8AndShaPlaylist } from '@server/lib/hls.js'
import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file.js' import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file.js'
import { VideoFileModel } from '@server/models/video/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 { import {
asyncMiddleware, asyncMiddleware,
authenticate, authenticate,
@ -40,15 +40,13 @@ filesRouter.delete('/:id/hls/:videoFileId',
asyncMiddleware(removeHLSFileController) asyncMiddleware(removeHLSFileController)
) )
filesRouter.delete( filesRouter.delete('/:id/web-videos',
[ '/:id/webtorrent', '/:id/web-videos' ], // TODO: remove webtorrent in V7
authenticate, authenticate,
ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES),
asyncMiddleware(videoFilesDeleteWebVideoValidator), asyncMiddleware(videoFilesDeleteWebVideoValidator),
asyncMiddleware(removeAllWebVideoFilesController) asyncMiddleware(removeAllWebVideoFilesController)
) )
filesRouter.delete( filesRouter.delete('/:id/web-videos/:videoFileId',
[ '/:id/webtorrent/:videoFileId', '/:id/web-videos/:videoFileId' ], // TODO: remove webtorrent in V7
authenticate, authenticate,
ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES), ensureUserHasRight(UserRight.MANAGE_VIDEO_FILES),
asyncMiddleware(videoFilesDeleteWebVideoFileValidator), asyncMiddleware(videoFilesDeleteWebVideoFileValidator),

View File

@ -1,15 +1,13 @@
import express from 'express'
import { HttpStatusCode } from '@peertube/peertube-models' import { HttpStatusCode } from '@peertube/peertube-models'
import { pickCommonVideoQuery } from '@server/helpers/query.js' import { pickCommonVideoQuery } from '@server/helpers/query.js'
import { doJSONRequest } from '@server/helpers/requests.js'
import { openapiOperationDoc } from '@server/middlewares/doc.js' import { openapiOperationDoc } from '@server/middlewares/doc.js'
import { getServerActor } from '@server/models/application/application.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 { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger.js'
import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils.js' import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils.js'
import { logger } from '../../../helpers/logger.js' import { logger } from '../../../helpers/logger.js'
import { getFormattedObjects } from '../../../helpers/utils.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 { sequelizeTypescript } from '../../../initializers/database.js'
import { JobQueue } from '../../../lib/job-queue/index.js' import { JobQueue } from '../../../lib/job-queue/index.js'
import { Hooks } from '../../../lib/plugins/hooks.js' import { Hooks } from '../../../lib/plugins/hooks.js'
@ -25,7 +23,6 @@ import {
setDefaultPagination, setDefaultPagination,
setDefaultVideosSort, setDefaultVideosSort,
videosCustomGetValidator, videosCustomGetValidator,
videosGetValidator,
videosRemoveValidator, videosRemoveValidator,
videosSortValidator videosSortValidator
} from '../../../middlewares/index.js' } from '../../../middlewares/index.js'
@ -33,6 +30,7 @@ import { guessAdditionalAttributesFromQuery } from '../../../models/video/format
import { VideoModel } from '../../../models/video/video.js' import { VideoModel } from '../../../models/video/video.js'
import { blacklistRouter } from './blacklist.js' import { blacklistRouter } from './blacklist.js'
import { videoCaptionsRouter } from './captions.js' import { videoCaptionsRouter } from './captions.js'
import { videoChaptersRouter } from './chapters.js'
import { videoCommentRouter } from './comment.js' import { videoCommentRouter } from './comment.js'
import { filesRouter } from './files.js' import { filesRouter } from './files.js'
import { videoImportsRouter } from './import.js' import { videoImportsRouter } from './import.js'
@ -49,7 +47,6 @@ import { transcodingRouter } from './transcoding.js'
import { updateRouter } from './update.js' import { updateRouter } from './update.js'
import { uploadRouter } from './upload.js' import { uploadRouter } from './upload.js'
import { viewRouter } from './view.js' import { viewRouter } from './view.js'
import { videoChaptersRouter } from './chapters.js'
const auditLogger = auditLoggerFactory('videos') const auditLogger = auditLoggerFactory('videos')
const videosRouter = express.Router() const videosRouter = express.Router()
@ -104,13 +101,6 @@ videosRouter.get('/',
asyncMiddleware(listVideos) 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', videosRouter.get('/:id',
openapiOperationDoc({ operationId: 'getVideo' }), openapiOperationDoc({ operationId: 'getVideo' }),
optionalAuthenticate, optionalAuthenticate,
@ -165,16 +155,6 @@ async function getVideo (req: express.Request, res: express.Response) {
return res.json(video.toFormattedDetailsJSON()) 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) { async function listVideos (req: express.Request, res: express.Response) {
const serverActor = await getServerActor() const serverActor = await getServerActor()
@ -218,15 +198,3 @@ async function removeVideo (req: express.Request, res: express.Response) {
.status(HttpStatusCode.NO_CONTENT_204) .status(HttpStatusCode.NO_CONTENT_204)
.end() .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<any>(url)
return body.description || ''
}

View File

@ -1,7 +1,4 @@
import cors from 'cors' import { HttpStatusCode } from '@peertube/peertube-models'
import express from 'express'
import { readFile } from 'fs/promises'
import { join } from 'path'
import { injectQueryToPlaylistUrls } from '@server/lib/hls.js' import { injectQueryToPlaylistUrls } from '@server/lib/hls.js'
import { import {
asyncMiddleware, asyncMiddleware,
@ -10,9 +7,12 @@ import {
handleStaticError, handleStaticError,
optionalAuthenticate optionalAuthenticate
} from '@server/middlewares/index.js' } 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 { 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' import { buildReinjectVideoFileTokenQuery, doReinjectVideoFileToken } from './shared/m3u8-playlist.js'
const staticRouter = express.Router() const staticRouter = express.Router()
@ -72,14 +72,6 @@ staticRouter.use(
handleStaticError 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 { export {

View File

@ -233,10 +233,7 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string
}, },
lemmy: 'https://join-lemmy.org/ns#', lemmy: 'https://join-lemmy.org/ns#',
postingRestrictedToMods: 'lemmy:postingRestrictedToMods', postingRestrictedToMods: 'lemmy:postingRestrictedToMods'
// TODO: remove in a few versions, introduced in 4.2
icons: 'as:icon'
}), }),
WatchAction: buildContext({ WatchAction: buildContext({

View File

@ -20,7 +20,7 @@ function isPlaylistRedundancyUrlValid (url: any) {
isActivityPubUrlValid(url.href) 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) { function isRedundancyUrlVideoValid (url: any) {
const size = url.size || url['_:size'] const size = url.size || url['_:size']
const fps = url.fps || url['_fps'] const fps = url.fps || url['_fps']

View File

@ -7,7 +7,7 @@ import { isActivityPubUrlValid } from './misc.js'
export function isPlaylistObjectValid (object: PlaylistObject) { export function isPlaylistObjectValid (object: PlaylistObject) {
if (!object || object.type !== 'Playlist') return false 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'] if (!object.uuid && object['identifier']) object.uuid = object['identifier']
return validator.default.isInt(object.totalItems + '') && return validator.default.isInt(object.totalItems + '') &&

View File

@ -47,7 +47,7 @@ export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
if (!setValidStoryboard(video)) return fail('preview (storyboard)') if (!setValidStoryboard(video)) return fail('preview (storyboard)')
if (!setValidLicence(video)) return fail('licence') 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'] if (!video.uuid && video['identifier']) video.uuid = video['identifier']
// Default attributes // Default attributes

View File

@ -7,7 +7,7 @@ import { isActivityPubVideoDurationValid, isObjectValid } from './misc.js'
function isWatchActionObjectValid (action: WatchActionObject) { function isWatchActionObjectValid (action: WatchActionObject) {
if (!action || action.type !== 'WatchAction') return false 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.uuid && action['identifier']) action.uuid = action['identifier']
if (action['_:actionStatus'] && !action.actionStatus) action.actionStatus = action['_:actionStatus'] if (action['_:actionStatus'] && !action.actionStatus) action.actionStatus = action['_:actionStatus']
@ -43,7 +43,7 @@ function isLocationValid (location: any) {
function areWatchSectionsValid (sections: WatchActionObject['watchSections']) { function areWatchSectionsValid (sections: WatchActionObject['watchSections']) {
return Array.isArray(sections) && sections.every(s => { 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'] if (s['_:endTimestamp'] && !s.endTimestamp) s.endTimestamp = s['_:endTimestamp']
return isVideoTimeValid(s.startTimestamp) && isVideoTimeValid(s.endTimestamp) return isVideoTimeValid(s.startTimestamp) && isVideoTimeValid(s.endTimestamp)

View File

@ -1,10 +1,3 @@
function isValidPlayerMode (value: any) { export function isValidPlayerMode (value: any) {
// TODO: remove webtorrent in v7 return value === 'web-video' || value === 'p2p-media-loader'
return value === 'webtorrent' || value === 'web-video' || value === 'p2p-media-loader'
}
// ---------------------------------------------------------------------------
export {
isValidPlayerMode
} }

View File

@ -1,12 +1,5 @@
import { exists } from './misc.js' import { exists } from './misc.js'
function isValidCreateTranscodingType (value: any) { export function isValidCreateTranscodingType (value: any) {
return exists(value) && return exists(value) && (value === 'hls' || value === 'web-video')
(value === 'hls' || value === 'webtorrent' || value === 'web-video') // TODO: remove webtorrent in v7
}
// ---------------------------------------------------------------------------
export {
isValidCreateTranscodingType
} }

View File

@ -34,7 +34,7 @@ export async function compactJSONLDAndCheckRSA2017Signature (fromActor: MActor,
return false return false
} }
// TODO: compat with < 6.1, remove in 7.0 // TODO: compat with < 6.1, remove in 8.0
let safe = true let safe = true
if ( if (
(compacted.type === 'Create' && (compacted?.object?.type === 'WatchAction' || compacted?.object?.type === 'CacheFile')) || (compacted.type === 'Create' && (compacted?.object?.type === 'WatchAction' || compacted?.object?.type === 'CacheFile')) ||

View File

@ -23,7 +23,6 @@ function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {
'include', 'include',
'skipCount', 'skipCount',
'hasHLSFiles', 'hasHLSFiles',
'hasWebtorrentFiles', // TODO: Remove in v7
'hasWebVideoFiles', 'hasWebVideoFiles',
'search', 'search',
'excludeAlreadyWatched', 'excludeAlreadyWatched',

View File

@ -845,9 +845,6 @@ export const USER_EXPORT_FILE_PREFIX = 'user-export-'
// Express static paths (router) // Express static paths (router)
export const STATIC_PATHS = { export const STATIC_PATHS = {
// TODO: deprecated in v6, to remove
THUMBNAILS: '/static/thumbnails/',
// Need to keep this legacy path for previously generated torrents // Need to keep this legacy path for previously generated torrents
LEGACY_WEB_VIDEOS: '/static/webseed/', LEGACY_WEB_VIDEOS: '/static/webseed/',
WEB_VIDEOS: '/static/web-videos/', WEB_VIDEOS: '/static/web-videos/',

View File

@ -66,7 +66,7 @@ function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject
} }
const url = cacheFileObject.url 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
: url['_:fps'] : url['_:fps']

View File

@ -57,7 +57,7 @@ function getViewerResultCounter (activity: ActivityView) {
return counter return counter
} }
// TODO: compat with < 6.1, remove in 7.0 // TODO: compat with < 6.1, remove in 8.0
function getExpires (activity: ActivityView) { function getExpires (activity: ActivityView) {
return activity.expires || activity['expiration'] as string return activity.expires || activity['expiration'] as string
} }

View File

@ -142,10 +142,6 @@ function buildVideosHelpers () {
})) }))
return { return {
webtorrent: { // TODO: remove in v7
videoFiles: webVideoFiles
},
webVideo: { webVideo: {
videoFiles: webVideoFiles videoFiles: webVideoFiles
}, },

View File

@ -15,7 +15,7 @@ export function createOptimizeOrMergeAudioJobs (options: {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
export function createTranscodingJobs (options: { export function createTranscodingJobs (options: {
transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 transcodingType: 'hls' | 'web-video'
video: MVideoFullLight video: MVideoFullLight
resolutions: number[] resolutions: number[]
isNewVideo: boolean isNewVideo: boolean

View File

@ -137,7 +137,7 @@ export abstract class AbstractJobBuilder <P> {
} }
async createTranscodingJobs (options: { async createTranscodingJobs (options: {
transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 transcodingType: 'hls' | 'web-video'
video: MVideoFullLight video: MVideoFullLight
resolutions: number[] resolutions: number[]
isNewVideo: boolean isNewVideo: boolean
@ -164,7 +164,7 @@ export abstract class AbstractJobBuilder <P> {
return this.buildHLSJobPayload({ video, resolution, fps, isNewVideo, separatedAudio }) 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 }) return this.buildWebVideoJobPayload({ video, resolution, fps, isNewVideo })
} }

View File

@ -57,7 +57,7 @@ export function executeIfActivityPub (req: Request, res: Response, next: NextFun
async function checkHttpSignature (req: Request, res: Response) { async function checkHttpSignature (req: Request, res: Response) {
return wrapWithSpanAndContext('peertube.activitypub.checkHTTPSignature', async () => { 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 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 /, '') if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '')

View File

@ -11,10 +11,7 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
...data, ...data,
docs: res.locals.docUrl, docs: res.locals.docUrl,
code: type, code: type
// For <= 3.2 compatibility
error: message
}) })
const json = new ProblemDocument({ const json = new ProblemDocument({

View File

@ -472,10 +472,6 @@ export const commonVideosFiltersValidator = [
.optional() .optional()
.customSanitizer(toBooleanOrNull) .customSanitizer(toBooleanOrNull)
.custom(isBooleanValid).withMessage('Should have a valid hasHLSFiles boolean'), .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') query('hasWebVideoFiles')
.optional() .optional()
.customSanitizer(toBooleanOrNull) .customSanitizer(toBooleanOrNull)

View File

@ -157,7 +157,6 @@ export function videoModelToFormattedDetailsJSON (video: MVideoFormattableDetail
...videoJSON, ...videoJSON,
support: video.support, support: video.support,
descriptionPath: video.getDescriptionAPIPath(),
channel: video.VideoChannel.toFormattedJSON(), channel: video.VideoChannel.toFormattedJSON(),
account: video.VideoChannel.Account.toFormattedJSON(), account: video.VideoChannel.Account.toFormattedJSON(),
tags, tags,

View File

@ -54,7 +54,6 @@ export type BuildVideosListQueryOptions = {
hasHLSFiles?: boolean hasHLSFiles?: boolean
hasWebVideoFiles?: boolean hasWebVideoFiles?: boolean
hasWebtorrentFiles?: boolean // TODO: Remove in v7
accountId?: number accountId?: number
videoChannelId?: number videoChannelId?: number
@ -188,9 +187,7 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
this.whereFileExists() this.whereFileExists()
} }
if (exists(options.hasWebtorrentFiles)) { if (exists(options.hasWebVideoFiles)) {
this.whereWebVideoFileExists(options.hasWebtorrentFiles)
} else if (exists(options.hasWebVideoFiles)) {
this.whereWebVideoFileExists(options.hasWebVideoFiles) this.whereWebVideoFileExists(options.hasWebVideoFiles)
} }

View File

@ -1154,7 +1154,6 @@ export class VideoModel extends SequelizeModel<VideoModel> {
hasFiles?: boolean // default false hasFiles?: boolean // default false
hasWebtorrentFiles?: boolean // TODO: remove in v7
hasWebVideoFiles?: boolean hasWebVideoFiles?: boolean
hasHLSFiles?: boolean hasHLSFiles?: boolean
@ -1223,7 +1222,6 @@ export class VideoModel extends SequelizeModel<VideoModel> {
'user', 'user',
'historyOfUser', 'historyOfUser',
'hasHLSFiles', 'hasHLSFiles',
'hasWebtorrentFiles',
'hasWebVideoFiles', 'hasWebVideoFiles',
'search', 'search',
'excludeAlreadyWatched' 'excludeAlreadyWatched'
@ -1258,7 +1256,6 @@ export class VideoModel extends SequelizeModel<VideoModel> {
user?: MUserAccountId user?: MUserAccountId
hasWebtorrentFiles?: boolean // TODO: remove in v7
hasWebVideoFiles?: boolean hasWebVideoFiles?: boolean
hasHLSFiles?: boolean hasHLSFiles?: boolean
@ -1311,7 +1308,6 @@ export class VideoModel extends SequelizeModel<VideoModel> {
'durationMin', 'durationMin',
'durationMax', 'durationMax',
'hasHLSFiles', 'hasHLSFiles',
'hasWebtorrentFiles',
'hasWebVideoFiles', 'hasWebVideoFiles',
'uuids', 'uuids',
'search', 'search',

View File

@ -42,16 +42,6 @@ export type PeerTubeHelpers = {
ffprobe: (path: string) => Promise<any> ffprobe: (path: string) => Promise<any>
getFiles: (id: number | 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: { webVideo: {
videoFiles: { videoFiles: {
path: string // Could be null if using remote storage path: string // Could be null if using remote storage