diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-17 16:04:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-18 09:04:30 +0100 |
commit | b46cf4b920984492df598c1b61179acfc7f6f22e (patch) | |
tree | 21fda049c85be48ab3d37b537aafa98e94649ad7 /server/controllers/api/videos/index.ts | |
parent | 3cfa817672657df18260ece5b354efa0f3b6e317 (diff) | |
download | PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.gz PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.zst PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.zip |
Add ability to remove hls/webtorrent files
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 72b382595..2d088a73e 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import toInt from 'validator/lib/toInt' | ||
3 | import { pickCommonVideoQuery } from '@server/helpers/query' | 2 | import { pickCommonVideoQuery } from '@server/helpers/query' |
4 | import { doJSONRequest } from '@server/helpers/requests' | 3 | import { doJSONRequest } from '@server/helpers/requests' |
5 | import { VideoViews } from '@server/lib/video-views' | 4 | import { VideoViews } from '@server/lib/video-views' |
@@ -27,17 +26,16 @@ import { | |||
27 | paginationValidator, | 26 | paginationValidator, |
28 | setDefaultPagination, | 27 | setDefaultPagination, |
29 | setDefaultVideosSort, | 28 | setDefaultVideosSort, |
30 | videoFileMetadataGetValidator, | ||
31 | videosCustomGetValidator, | 29 | videosCustomGetValidator, |
32 | videosGetValidator, | 30 | videosGetValidator, |
33 | videosRemoveValidator, | 31 | videosRemoveValidator, |
34 | videosSortValidator | 32 | videosSortValidator |
35 | } from '../../../middlewares' | 33 | } from '../../../middlewares' |
36 | import { VideoModel } from '../../../models/video/video' | 34 | import { VideoModel } from '../../../models/video/video' |
37 | import { VideoFileModel } from '../../../models/video/video-file' | ||
38 | import { blacklistRouter } from './blacklist' | 35 | import { blacklistRouter } from './blacklist' |
39 | import { videoCaptionsRouter } from './captions' | 36 | import { videoCaptionsRouter } from './captions' |
40 | import { videoCommentRouter } from './comment' | 37 | import { videoCommentRouter } from './comment' |
38 | import { filesRouter } from './files' | ||
41 | import { videoImportsRouter } from './import' | 39 | import { videoImportsRouter } from './import' |
42 | import { liveRouter } from './live' | 40 | import { liveRouter } from './live' |
43 | import { ownershipVideoRouter } from './ownership' | 41 | import { ownershipVideoRouter } from './ownership' |
@@ -59,6 +57,7 @@ videosRouter.use('/', watchingRouter) | |||
59 | videosRouter.use('/', liveRouter) | 57 | videosRouter.use('/', liveRouter) |
60 | videosRouter.use('/', uploadRouter) | 58 | videosRouter.use('/', uploadRouter) |
61 | videosRouter.use('/', updateRouter) | 59 | videosRouter.use('/', updateRouter) |
60 | videosRouter.use('/', filesRouter) | ||
62 | 61 | ||
63 | videosRouter.get('/categories', | 62 | videosRouter.get('/categories', |
64 | openapiOperationDoc({ operationId: 'getCategories' }), | 63 | openapiOperationDoc({ operationId: 'getCategories' }), |
@@ -93,10 +92,6 @@ videosRouter.get('/:id/description', | |||
93 | asyncMiddleware(videosGetValidator), | 92 | asyncMiddleware(videosGetValidator), |
94 | asyncMiddleware(getVideoDescription) | 93 | asyncMiddleware(getVideoDescription) |
95 | ) | 94 | ) |
96 | videosRouter.get('/:id/metadata/:videoFileId', | ||
97 | asyncMiddleware(videoFileMetadataGetValidator), | ||
98 | asyncMiddleware(getVideoFileMetadata) | ||
99 | ) | ||
100 | videosRouter.get('/:id', | 95 | videosRouter.get('/:id', |
101 | openapiOperationDoc({ operationId: 'getVideo' }), | 96 | openapiOperationDoc({ operationId: 'getVideo' }), |
102 | optionalAuthenticate, | 97 | optionalAuthenticate, |
@@ -177,12 +172,6 @@ async function getVideoDescription (req: express.Request, res: express.Response) | |||
177 | return res.json({ description }) | 172 | return res.json({ description }) |
178 | } | 173 | } |
179 | 174 | ||
180 | async function getVideoFileMetadata (req: express.Request, res: express.Response) { | ||
181 | const videoFile = await VideoFileModel.loadWithMetadata(toInt(req.params.videoFileId)) | ||
182 | |||
183 | return res.json(videoFile.metadata) | ||
184 | } | ||
185 | |||
186 | async function listVideos (req: express.Request, res: express.Response) { | 175 | async function listVideos (req: express.Request, res: express.Response) { |
187 | const serverActor = await getServerActor() | 176 | const serverActor = await getServerActor() |
188 | 177 | ||