diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-06-21 15:31:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 15:31:25 +0200 |
commit | 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (patch) | |
tree | eee1e6213ca4d635837ca01c2bdc5c876b8d8b7d /shared | |
parent | dec49521556fc228c6e05b6199e9b07f619b38fb (diff) | |
download | PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.gz PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.zst PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.zip |
store uploaded video filename (#4885)
* store uploaded video filename
closes #4731
* dont crash if videos channel exist
* migration: use raw query
* video source: fixes after code review
* cleanup
* bump migration
* updates after code review
* refactor: use checkUserCanManageVideo
* videoSource: add openapi doc
* test(check-params/video-source): fix timeout
* Styling
* Correctly set original filename as source
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/videos/video-source.ts | 3 | ||||
-rw-r--r-- | shared/server-commands/videos/videos-command.ts | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/shared/models/videos/video-source.ts b/shared/models/videos/video-source.ts new file mode 100644 index 000000000..57e54fc7f --- /dev/null +++ b/shared/models/videos/video-source.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoSource { | ||
2 | filename: string | ||
3 | } | ||
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index 1cceb58db..e952c9777 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts | |||
@@ -23,6 +23,7 @@ import { | |||
23 | import { unwrapBody } from '../requests' | 23 | import { unwrapBody } from '../requests' |
24 | import { waitJobs } from '../server' | 24 | import { waitJobs } from '../server' |
25 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 25 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
26 | import { VideoSource } from '@shared/models/videos/video-source' | ||
26 | 27 | ||
27 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { | 28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { |
28 | fixture?: string | 29 | fixture?: string |
@@ -150,6 +151,20 @@ export class VideosCommand extends AbstractCommand { | |||
150 | }) | 151 | }) |
151 | } | 152 | } |
152 | 153 | ||
154 | getSource (options: OverrideCommandOptions & { | ||
155 | id: number | string | ||
156 | }) { | ||
157 | const path = '/api/v1/videos/' + options.id + '/source' | ||
158 | |||
159 | return this.getRequestBody<VideoSource>({ | ||
160 | ...options, | ||
161 | |||
162 | path, | ||
163 | implicitToken: true, | ||
164 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
165 | }) | ||
166 | } | ||
167 | |||
153 | async getId (options: OverrideCommandOptions & { | 168 | async getId (options: OverrideCommandOptions & { |
154 | uuid: number | string | 169 | uuid: number | string |
155 | }) { | 170 | }) { |