mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Add video chapters support
This commit is contained in:
parent
7113f32a87
commit
77b70702d2
101 changed files with 1957 additions and 158 deletions
|
@ -30,6 +30,7 @@ import {
|
|||
ChangeOwnershipCommand,
|
||||
ChannelsCommand,
|
||||
ChannelSyncsCommand,
|
||||
ChaptersCommand,
|
||||
CommentsCommand,
|
||||
HistoryCommand,
|
||||
ImportsCommand,
|
||||
|
@ -152,6 +153,7 @@ export class PeerTubeServer {
|
|||
videoPasswords?: VideoPasswordsCommand
|
||||
|
||||
storyboard?: StoryboardCommand
|
||||
chapters?: ChaptersCommand
|
||||
|
||||
runners?: RunnersCommand
|
||||
runnerRegistrationTokens?: RunnerRegistrationTokensCommand
|
||||
|
@ -442,6 +444,7 @@ export class PeerTubeServer {
|
|||
this.registrations = new RegistrationsCommand(this)
|
||||
|
||||
this.storyboard = new StoryboardCommand(this)
|
||||
this.chapters = new ChaptersCommand(this)
|
||||
|
||||
this.runners = new RunnersCommand(this)
|
||||
this.runnerRegistrationTokens = new RunnerRegistrationTokensCommand(this)
|
||||
|
|
38
packages/server-commands/src/videos/chapters-command.ts
Normal file
38
packages/server-commands/src/videos/chapters-command.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import {
|
||||
HttpStatusCode, VideoChapterUpdate, VideoChapters
|
||||
} from '@peertube/peertube-models'
|
||||
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'
|
||||
|
||||
export class ChaptersCommand extends AbstractCommand {
|
||||
|
||||
list (options: OverrideCommandOptions & {
|
||||
videoId: string | number
|
||||
}) {
|
||||
const path = '/api/v1/videos/' + options.videoId + '/chapters'
|
||||
|
||||
return this.getRequestBody<VideoChapters>({
|
||||
...options,
|
||||
|
||||
path,
|
||||
implicitToken: true,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
})
|
||||
}
|
||||
|
||||
update (options: OverrideCommandOptions & VideoChapterUpdate & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
const path = '/api/v1/videos/' + options.videoId + '/chapters'
|
||||
|
||||
return this.putBodyRequest({
|
||||
...options,
|
||||
|
||||
path,
|
||||
fields: {
|
||||
chapters: options.chapters
|
||||
},
|
||||
implicitToken: true,
|
||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||
})
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ export * from './captions-command.js'
|
|||
export * from './change-ownership-command.js'
|
||||
export * from './channels.js'
|
||||
export * from './channels-command.js'
|
||||
export * from './chapters-command.js'
|
||||
export * from './channel-syncs-command.js'
|
||||
export * from './comments-command.js'
|
||||
export * from './history-command.js'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue