diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-21 17:46:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-25 11:53:08 +0200 |
commit | f42fcb4b58f146c2e5ace236548a99d361ade55f (patch) | |
tree | afddb566b00a02770043c04257ccd1bc7be3d462 /server/controllers/api/videos/source.ts | |
parent | 12dc3a942a13c7f1489822dae052da197ef15905 (diff) | |
download | PeerTube-f42fcb4b58f146c2e5ace236548a99d361ade55f.tar.gz PeerTube-f42fcb4b58f146c2e5ace236548a99d361ade55f.tar.zst PeerTube-f42fcb4b58f146c2e5ace236548a99d361ade55f.zip |
Implement video file replacement in client
Diffstat (limited to 'server/controllers/api/videos/source.ts')
-rw-r--r-- | server/controllers/api/videos/source.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/videos/source.ts b/server/controllers/api/videos/source.ts index b20c4af0e..75fe68b6c 100644 --- a/server/controllers/api/videos/source.ts +++ b/server/controllers/api/videos/source.ts | |||
@@ -14,7 +14,7 @@ import { openapiOperationDoc } from '@server/middlewares/doc' | |||
14 | import { VideoModel } from '@server/models/video/video' | 14 | import { VideoModel } from '@server/models/video/video' |
15 | import { VideoSourceModel } from '@server/models/video/video-source' | 15 | import { VideoSourceModel } from '@server/models/video/video-source' |
16 | import { MStreamingPlaylistFiles, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 16 | import { MStreamingPlaylistFiles, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
17 | import { HttpStatusCode, VideoState } from '@shared/models' | 17 | import { VideoState } from '@shared/models' |
18 | import { logger, loggerTagsFactory } from '../../../helpers/logger' | 18 | import { logger, loggerTagsFactory } from '../../../helpers/logger' |
19 | import { | 19 | import { |
20 | asyncMiddleware, | 20 | asyncMiddleware, |
@@ -121,7 +121,7 @@ async function replaceVideoSourceResumable (req: express.Request, res: express.R | |||
121 | 121 | ||
122 | await removeOldFiles({ video, files: oldWebVideoFiles, playlists: oldStreamingPlaylists }) | 122 | await removeOldFiles({ video, files: oldWebVideoFiles, playlists: oldStreamingPlaylists }) |
123 | 123 | ||
124 | await VideoSourceModel.create({ | 124 | const source = await VideoSourceModel.create({ |
125 | filename: originalFilename, | 125 | filename: originalFilename, |
126 | videoId: video.id, | 126 | videoId: video.id, |
127 | createdAt: inputFileUpdatedAt | 127 | createdAt: inputFileUpdatedAt |
@@ -135,7 +135,7 @@ async function replaceVideoSourceResumable (req: express.Request, res: express.R | |||
135 | 135 | ||
136 | Hooks.runAction('action:api.video.file-updated', { video, req, res }) | 136 | Hooks.runAction('action:api.video.file-updated', { video, req, res }) |
137 | 137 | ||
138 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) | 138 | return res.json(source.toFormattedJSON()) |
139 | } finally { | 139 | } finally { |
140 | videoFileMutexReleaser() | 140 | videoFileMutexReleaser() |
141 | } | 141 | } |