1
0
Fork 0
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:
Chocobozzz 2023-08-28 10:55:04 +02:00
parent 7113f32a87
commit 77b70702d2
No known key found for this signature in database
GPG key ID: 583A612D890159BE
101 changed files with 1957 additions and 158 deletions

View file

@ -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)

View 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
})
}
}

View file

@ -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'