]>
Commit | Line | Data |
---|---|---|
2650d6d4 C |
1 | import { join } from 'path' |
2 | import { FindOptions, literal, Op, ScopeOptions, Transaction, WhereOptions } from 'sequelize' | |
418d092a C |
3 | import { |
4 | AllowNull, | |
418d092a C |
5 | BelongsTo, |
6 | Column, | |
7 | CreatedAt, | |
8 | DataType, | |
9 | Default, | |
10 | ForeignKey, | |
11 | HasMany, | |
e8bafea3 | 12 | HasOne, |
418d092a C |
13 | Is, |
14 | IsUUID, | |
15 | Model, | |
16 | Scopes, | |
17 | Table, | |
822c7e61 | 18 | UpdatedAt |
418d092a | 19 | } from 'sequelize-typescript' |
2650d6d4 C |
20 | import { MAccountId, MChannelId } from '@server/types/models' |
21 | import { ActivityIconObject } from '../../../shared/models/activitypub/objects' | |
22 | import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object' | |
418d092a | 23 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' |
2650d6d4 C |
24 | import { VideoPlaylistType } from '../../../shared/models/videos/playlist/video-playlist-type.model' |
25 | import { VideoPlaylist } from '../../../shared/models/videos/playlist/video-playlist.model' | |
26 | import { activityPubCollectionPagination } from '../../helpers/activitypub' | |
27 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | |
418d092a C |
28 | import { |
29 | isVideoPlaylistDescriptionValid, | |
30 | isVideoPlaylistNameValid, | |
31 | isVideoPlaylistPrivacyValid | |
32 | } from '../../helpers/custom-validators/video-playlists' | |
df0b219d | 33 | import { |
9f79ade6 | 34 | ACTIVITY_PUB, |
df0b219d C |
35 | CONSTRAINTS_FIELDS, |
36 | STATIC_PATHS, | |
37 | THUMBNAILS_SIZE, | |
38 | VIDEO_PLAYLIST_PRIVACIES, | |
6dd9de95 C |
39 | VIDEO_PLAYLIST_TYPES, |
40 | WEBSERVER | |
74dc3bca | 41 | } from '../../initializers/constants' |
2650d6d4 | 42 | import { MThumbnail } from '../../types/models/video/thumbnail' |
453e83ea | 43 | import { |
822c7e61 C |
44 | MVideoPlaylistAccountThumbnail, |
45 | MVideoPlaylistAP, | |
1ca9f7c3 | 46 | MVideoPlaylistFormattable, |
453e83ea C |
47 | MVideoPlaylistFull, |
48 | MVideoPlaylistFullSummary, | |
49 | MVideoPlaylistIdWithElements | |
26d6bf65 | 50 | } from '../../types/models/video/video-playlist' |
2650d6d4 C |
51 | import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account' |
52 | import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getPlaylistSort, isOutdated, throwIfNotValid } from '../utils' | |
53 | import { ThumbnailModel } from './thumbnail' | |
54 | import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' | |
55 | import { VideoPlaylistElementModel } from './video-playlist-element' | |
418d092a C |
56 | |
57 | enum ScopeNames { | |
58 | AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST', | |
59 | WITH_VIDEOS_LENGTH = 'WITH_VIDEOS_LENGTH', | |
df0b219d | 60 | WITH_ACCOUNT_AND_CHANNEL_SUMMARY = 'WITH_ACCOUNT_AND_CHANNEL_SUMMARY', |
09979f89 | 61 | WITH_ACCOUNT = 'WITH_ACCOUNT', |
e8bafea3 | 62 | WITH_THUMBNAIL = 'WITH_THUMBNAIL', |
09979f89 | 63 | WITH_ACCOUNT_AND_CHANNEL = 'WITH_ACCOUNT_AND_CHANNEL' |
418d092a C |
64 | } |
65 | ||
66 | type AvailableForListOptions = { | |
67 | followerActorId: number | |
df0b219d C |
68 | type?: VideoPlaylistType |
69 | accountId?: number | |
418d092a | 70 | videoChannelId?: number |
a1587156 | 71 | listMyPlaylists?: boolean |
c06af501 | 72 | search?: string |
418d092a C |
73 | } |
74 | ||
3acc5084 | 75 | @Scopes(() => ({ |
a1587156 | 76 | [ScopeNames.WITH_THUMBNAIL]: { |
e8bafea3 C |
77 | include: [ |
78 | { | |
3acc5084 | 79 | model: ThumbnailModel, |
e8bafea3 C |
80 | required: false |
81 | } | |
82 | ] | |
83 | }, | |
a1587156 | 84 | [ScopeNames.WITH_VIDEOS_LENGTH]: { |
418d092a C |
85 | attributes: { |
86 | include: [ | |
1735c825 C |
87 | [ |
88 | literal('(SELECT COUNT("id") FROM "videoPlaylistElement" WHERE "videoPlaylistId" = "VideoPlaylistModel"."id")'), | |
418d092a C |
89 | 'videosLength' |
90 | ] | |
91 | ] | |
92 | } | |
3acc5084 | 93 | } as FindOptions, |
a1587156 | 94 | [ScopeNames.WITH_ACCOUNT]: { |
df0b219d C |
95 | include: [ |
96 | { | |
3acc5084 | 97 | model: AccountModel, |
df0b219d C |
98 | required: true |
99 | } | |
100 | ] | |
101 | }, | |
a1587156 | 102 | [ScopeNames.WITH_ACCOUNT_AND_CHANNEL_SUMMARY]: { |
418d092a C |
103 | include: [ |
104 | { | |
3acc5084 | 105 | model: AccountModel.scope(AccountScopeNames.SUMMARY), |
418d092a C |
106 | required: true |
107 | }, | |
108 | { | |
3acc5084 | 109 | model: VideoChannelModel.scope(VideoChannelScopeNames.SUMMARY), |
418d092a C |
110 | required: false |
111 | } | |
112 | ] | |
113 | }, | |
a1587156 | 114 | [ScopeNames.WITH_ACCOUNT_AND_CHANNEL]: { |
09979f89 C |
115 | include: [ |
116 | { | |
3acc5084 | 117 | model: AccountModel, |
09979f89 C |
118 | required: true |
119 | }, | |
120 | { | |
3acc5084 | 121 | model: VideoChannelModel, |
09979f89 C |
122 | required: false |
123 | } | |
124 | ] | |
125 | }, | |
a1587156 | 126 | [ScopeNames.AVAILABLE_FOR_LIST]: (options: AvailableForListOptions) => { |
6b0c3c7c | 127 | let whereActor: WhereOptions = {} |
418d092a | 128 | |
3acc5084 | 129 | const whereAnd: WhereOptions[] = [] |
418d092a | 130 | |
6b0c3c7c | 131 | if (options.listMyPlaylists !== true) { |
418d092a C |
132 | whereAnd.push({ |
133 | privacy: VideoPlaylistPrivacy.PUBLIC | |
134 | }) | |
6b0c3c7c C |
135 | |
136 | // Only list local playlists OR playlists that are on an instance followed by actorId | |
137 | const inQueryInstanceFollow = buildServerIdsFollowedBy(options.followerActorId) | |
138 | ||
139 | whereActor = { | |
a1587156 | 140 | [Op.or]: [ |
6b0c3c7c C |
141 | { |
142 | serverId: null | |
143 | }, | |
144 | { | |
145 | serverId: { | |
a1587156 | 146 | [Op.in]: literal(inQueryInstanceFollow) |
6b0c3c7c C |
147 | } |
148 | } | |
149 | ] | |
150 | } | |
418d092a C |
151 | } |
152 | ||
153 | if (options.accountId) { | |
154 | whereAnd.push({ | |
155 | ownerAccountId: options.accountId | |
156 | }) | |
157 | } | |
158 | ||
159 | if (options.videoChannelId) { | |
160 | whereAnd.push({ | |
161 | videoChannelId: options.videoChannelId | |
162 | }) | |
163 | } | |
164 | ||
df0b219d C |
165 | if (options.type) { |
166 | whereAnd.push({ | |
167 | type: options.type | |
168 | }) | |
169 | } | |
170 | ||
c06af501 | 171 | if (options.search) { |
c06af501 | 172 | whereAnd.push({ |
822c7e61 | 173 | name: { |
a1587156 | 174 | [Op.iLike]: '%' + options.search + '%' |
c06af501 RK |
175 | } |
176 | }) | |
177 | } | |
178 | ||
418d092a | 179 | const where = { |
1735c825 | 180 | [Op.and]: whereAnd |
418d092a C |
181 | } |
182 | ||
418d092a C |
183 | return { |
184 | where, | |
185 | include: [ | |
186 | { | |
b49f22d8 C |
187 | model: AccountModel.scope({ |
188 | method: [ AccountScopeNames.SUMMARY, { whereActor } as SummaryOptions ] | |
189 | }), | |
418d092a C |
190 | required: true |
191 | }, | |
192 | { | |
193 | model: VideoChannelModel.scope(VideoChannelScopeNames.SUMMARY), | |
194 | required: false | |
195 | } | |
196 | ] | |
3acc5084 | 197 | } as FindOptions |
418d092a | 198 | } |
3acc5084 | 199 | })) |
418d092a C |
200 | |
201 | @Table({ | |
202 | tableName: 'videoPlaylist', | |
203 | indexes: [ | |
204 | { | |
205 | fields: [ 'ownerAccountId' ] | |
206 | }, | |
207 | { | |
208 | fields: [ 'videoChannelId' ] | |
209 | }, | |
210 | { | |
211 | fields: [ 'url' ], | |
212 | unique: true | |
213 | } | |
214 | ] | |
215 | }) | |
b49f22d8 | 216 | export class VideoPlaylistModel extends Model { |
418d092a C |
217 | @CreatedAt |
218 | createdAt: Date | |
219 | ||
220 | @UpdatedAt | |
221 | updatedAt: Date | |
222 | ||
223 | @AllowNull(false) | |
224 | @Is('VideoPlaylistName', value => throwIfNotValid(value, isVideoPlaylistNameValid, 'name')) | |
225 | @Column | |
226 | name: string | |
227 | ||
228 | @AllowNull(true) | |
1735c825 | 229 | @Is('VideoPlaylistDescription', value => throwIfNotValid(value, isVideoPlaylistDescriptionValid, 'description', true)) |
1c320673 | 230 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.DESCRIPTION.max)) |
418d092a C |
231 | description: string |
232 | ||
233 | @AllowNull(false) | |
234 | @Is('VideoPlaylistPrivacy', value => throwIfNotValid(value, isVideoPlaylistPrivacyValid, 'privacy')) | |
235 | @Column | |
236 | privacy: VideoPlaylistPrivacy | |
237 | ||
238 | @AllowNull(false) | |
239 | @Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url')) | |
240 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max)) | |
241 | url: string | |
242 | ||
243 | @AllowNull(false) | |
244 | @Default(DataType.UUIDV4) | |
245 | @IsUUID(4) | |
246 | @Column(DataType.UUID) | |
247 | uuid: string | |
248 | ||
df0b219d C |
249 | @AllowNull(false) |
250 | @Default(VideoPlaylistType.REGULAR) | |
251 | @Column | |
252 | type: VideoPlaylistType | |
253 | ||
418d092a C |
254 | @ForeignKey(() => AccountModel) |
255 | @Column | |
256 | ownerAccountId: number | |
257 | ||
258 | @BelongsTo(() => AccountModel, { | |
259 | foreignKey: { | |
260 | allowNull: false | |
261 | }, | |
262 | onDelete: 'CASCADE' | |
263 | }) | |
264 | OwnerAccount: AccountModel | |
265 | ||
266 | @ForeignKey(() => VideoChannelModel) | |
267 | @Column | |
268 | videoChannelId: number | |
269 | ||
270 | @BelongsTo(() => VideoChannelModel, { | |
271 | foreignKey: { | |
07b1a18a | 272 | allowNull: true |
418d092a C |
273 | }, |
274 | onDelete: 'CASCADE' | |
275 | }) | |
276 | VideoChannel: VideoChannelModel | |
277 | ||
278 | @HasMany(() => VideoPlaylistElementModel, { | |
279 | foreignKey: { | |
280 | name: 'videoPlaylistId', | |
281 | allowNull: false | |
282 | }, | |
df0b219d | 283 | onDelete: 'CASCADE' |
418d092a C |
284 | }) |
285 | VideoPlaylistElements: VideoPlaylistElementModel[] | |
286 | ||
e8bafea3 C |
287 | @HasOne(() => ThumbnailModel, { |
288 | foreignKey: { | |
289 | name: 'videoPlaylistId', | |
290 | allowNull: true | |
291 | }, | |
292 | onDelete: 'CASCADE', | |
293 | hooks: true | |
294 | }) | |
295 | Thumbnail: ThumbnailModel | |
418d092a C |
296 | |
297 | static listForApi (options: { | |
298 | followerActorId: number | |
a1587156 C |
299 | start: number |
300 | count: number | |
301 | sort: string | |
302 | type?: VideoPlaylistType | |
303 | accountId?: number | |
304 | videoChannelId?: number | |
305 | listMyPlaylists?: boolean | |
c06af501 | 306 | search?: string |
418d092a C |
307 | }) { |
308 | const query = { | |
309 | offset: options.start, | |
310 | limit: options.count, | |
49cff3a4 | 311 | order: getPlaylistSort(options.sort) |
418d092a C |
312 | } |
313 | ||
3acc5084 | 314 | const scopes: (string | ScopeOptions)[] = [ |
418d092a C |
315 | { |
316 | method: [ | |
317 | ScopeNames.AVAILABLE_FOR_LIST, | |
318 | { | |
df0b219d | 319 | type: options.type, |
418d092a C |
320 | followerActorId: options.followerActorId, |
321 | accountId: options.accountId, | |
322 | videoChannelId: options.videoChannelId, | |
6b0c3c7c | 323 | listMyPlaylists: options.listMyPlaylists, |
c06af501 | 324 | search: options.search |
418d092a C |
325 | } as AvailableForListOptions |
326 | ] | |
3acc5084 | 327 | }, |
e8bafea3 C |
328 | ScopeNames.WITH_VIDEOS_LENGTH, |
329 | ScopeNames.WITH_THUMBNAIL | |
418d092a C |
330 | ] |
331 | ||
332 | return VideoPlaylistModel | |
333 | .scope(scopes) | |
334 | .findAndCountAll(query) | |
335 | .then(({ rows, count }) => { | |
336 | return { total: count, data: rows } | |
337 | }) | |
338 | } | |
339 | ||
7405b6ba C |
340 | static listPublicUrlsOfForAP (options: { account?: MAccountId, channel?: MChannelId }, start: number, count: number) { |
341 | const where = { | |
342 | privacy: VideoPlaylistPrivacy.PUBLIC | |
343 | } | |
344 | ||
345 | if (options.account) { | |
346 | Object.assign(where, { ownerAccountId: options.account.id }) | |
347 | } | |
348 | ||
349 | if (options.channel) { | |
350 | Object.assign(where, { videoChannelId: options.channel.id }) | |
351 | } | |
352 | ||
418d092a C |
353 | const query = { |
354 | attributes: [ 'url' ], | |
355 | offset: start, | |
356 | limit: count, | |
7405b6ba | 357 | where |
418d092a C |
358 | } |
359 | ||
360 | return VideoPlaylistModel.findAndCountAll(query) | |
361 | .then(({ rows, count }) => { | |
362 | return { total: count, data: rows.map(p => p.url) } | |
363 | }) | |
364 | } | |
365 | ||
b49f22d8 | 366 | static listPlaylistIdsOf (accountId: number, videoIds: number[]): Promise<MVideoPlaylistIdWithElements[]> { |
f0a39880 C |
367 | const query = { |
368 | attributes: [ 'id' ], | |
369 | where: { | |
370 | ownerAccountId: accountId | |
371 | }, | |
372 | include: [ | |
373 | { | |
bfbd9128 | 374 | attributes: [ 'id', 'videoId', 'startTimestamp', 'stopTimestamp' ], |
f0a39880 C |
375 | model: VideoPlaylistElementModel.unscoped(), |
376 | where: { | |
377 | videoId: { | |
0374b6b5 | 378 | [Op.in]: videoIds |
f0a39880 C |
379 | } |
380 | }, | |
381 | required: true | |
382 | } | |
383 | ] | |
384 | } | |
385 | ||
386 | return VideoPlaylistModel.findAll(query) | |
387 | } | |
388 | ||
418d092a C |
389 | static doesPlaylistExist (url: string) { |
390 | const query = { | |
b49f22d8 | 391 | attributes: [ 'id' ], |
418d092a C |
392 | where: { |
393 | url | |
394 | } | |
395 | } | |
396 | ||
397 | return VideoPlaylistModel | |
398 | .findOne(query) | |
399 | .then(e => !!e) | |
400 | } | |
401 | ||
b49f22d8 | 402 | static loadWithAccountAndChannelSummary (id: number | string, transaction: Transaction): Promise<MVideoPlaylistFullSummary> { |
418d092a C |
403 | const where = buildWhereIdOrUUID(id) |
404 | ||
405 | const query = { | |
406 | where, | |
407 | transaction | |
408 | } | |
409 | ||
410 | return VideoPlaylistModel | |
e8bafea3 | 411 | .scope([ ScopeNames.WITH_ACCOUNT_AND_CHANNEL_SUMMARY, ScopeNames.WITH_VIDEOS_LENGTH, ScopeNames.WITH_THUMBNAIL ]) |
09979f89 C |
412 | .findOne(query) |
413 | } | |
414 | ||
b49f22d8 | 415 | static loadWithAccountAndChannel (id: number | string, transaction: Transaction): Promise<MVideoPlaylistFull> { |
09979f89 C |
416 | const where = buildWhereIdOrUUID(id) |
417 | ||
418 | const query = { | |
419 | where, | |
420 | transaction | |
421 | } | |
422 | ||
423 | return VideoPlaylistModel | |
e8bafea3 | 424 | .scope([ ScopeNames.WITH_ACCOUNT_AND_CHANNEL, ScopeNames.WITH_VIDEOS_LENGTH, ScopeNames.WITH_THUMBNAIL ]) |
418d092a C |
425 | .findOne(query) |
426 | } | |
427 | ||
b49f22d8 | 428 | static loadByUrlAndPopulateAccount (url: string): Promise<MVideoPlaylistAccountThumbnail> { |
df0b219d C |
429 | const query = { |
430 | where: { | |
431 | url | |
432 | } | |
433 | } | |
434 | ||
e8bafea3 | 435 | return VideoPlaylistModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_THUMBNAIL ]).findOne(query) |
df0b219d C |
436 | } |
437 | ||
418d092a C |
438 | static getPrivacyLabel (privacy: VideoPlaylistPrivacy) { |
439 | return VIDEO_PLAYLIST_PRIVACIES[privacy] || 'Unknown' | |
440 | } | |
441 | ||
df0b219d C |
442 | static getTypeLabel (type: VideoPlaylistType) { |
443 | return VIDEO_PLAYLIST_TYPES[type] || 'Unknown' | |
444 | } | |
445 | ||
1735c825 | 446 | static resetPlaylistsOfChannel (videoChannelId: number, transaction: Transaction) { |
df0b219d C |
447 | const query = { |
448 | where: { | |
449 | videoChannelId | |
450 | }, | |
451 | transaction | |
452 | } | |
453 | ||
454 | return VideoPlaylistModel.update({ privacy: VideoPlaylistPrivacy.PRIVATE, videoChannelId: null }, query) | |
455 | } | |
456 | ||
453e83ea | 457 | async setAndSaveThumbnail (thumbnail: MThumbnail, t: Transaction) { |
3acc5084 | 458 | thumbnail.videoPlaylistId = this.id |
e8bafea3 | 459 | |
3acc5084 | 460 | this.Thumbnail = await thumbnail.save({ transaction: t }) |
e8bafea3 C |
461 | } |
462 | ||
463 | hasThumbnail () { | |
464 | return !!this.Thumbnail | |
465 | } | |
466 | ||
65af03a2 C |
467 | hasGeneratedThumbnail () { |
468 | return this.hasThumbnail() && this.Thumbnail.automaticallyGenerated === true | |
469 | } | |
470 | ||
e8bafea3 | 471 | generateThumbnailName () { |
418d092a C |
472 | const extension = '.jpg' |
473 | ||
474 | return 'playlist-' + this.uuid + extension | |
475 | } | |
476 | ||
477 | getThumbnailUrl () { | |
e8bafea3 C |
478 | if (!this.hasThumbnail()) return null |
479 | ||
3acc5084 | 480 | return WEBSERVER.URL + STATIC_PATHS.THUMBNAILS + this.Thumbnail.filename |
418d092a C |
481 | } |
482 | ||
483 | getThumbnailStaticPath () { | |
e8bafea3 | 484 | if (!this.hasThumbnail()) return null |
418d092a | 485 | |
3acc5084 | 486 | return join(STATIC_PATHS.THUMBNAILS, this.Thumbnail.filename) |
418d092a C |
487 | } |
488 | ||
8d987ec6 K |
489 | getWatchUrl () { |
490 | return WEBSERVER.URL + '/videos/watch/playlist/' + this.uuid | |
491 | } | |
492 | ||
6fad8e51 C |
493 | getEmbedStaticPath () { |
494 | return '/video-playlists/embed/' + this.uuid | |
495 | } | |
496 | ||
9f79ade6 C |
497 | setAsRefreshed () { |
498 | this.changed('updatedAt', true) | |
499 | ||
500 | return this.save() | |
501 | } | |
502 | ||
418d092a C |
503 | isOwned () { |
504 | return this.OwnerAccount.isOwned() | |
505 | } | |
506 | ||
9f79ade6 C |
507 | isOutdated () { |
508 | if (this.isOwned()) return false | |
509 | ||
510 | return isOutdated(this, ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL) | |
511 | } | |
512 | ||
1ca9f7c3 | 513 | toFormattedJSON (this: MVideoPlaylistFormattable): VideoPlaylist { |
418d092a C |
514 | return { |
515 | id: this.id, | |
516 | uuid: this.uuid, | |
517 | isLocal: this.isOwned(), | |
518 | ||
519 | displayName: this.name, | |
520 | description: this.description, | |
521 | privacy: { | |
522 | id: this.privacy, | |
523 | label: VideoPlaylistModel.getPrivacyLabel(this.privacy) | |
524 | }, | |
525 | ||
526 | thumbnailPath: this.getThumbnailStaticPath(), | |
951b582f | 527 | embedPath: this.getEmbedStaticPath(), |
418d092a | 528 | |
df0b219d C |
529 | type: { |
530 | id: this.type, | |
531 | label: VideoPlaylistModel.getTypeLabel(this.type) | |
532 | }, | |
533 | ||
1735c825 | 534 | videosLength: this.get('videosLength') as number, |
418d092a C |
535 | |
536 | createdAt: this.createdAt, | |
537 | updatedAt: this.updatedAt, | |
538 | ||
539 | ownerAccount: this.OwnerAccount.toFormattedSummaryJSON(), | |
c1843150 C |
540 | videoChannel: this.VideoChannel |
541 | ? this.VideoChannel.toFormattedSummaryJSON() | |
542 | : null | |
418d092a C |
543 | } |
544 | } | |
545 | ||
b5fecbf4 | 546 | toActivityPubObject (this: MVideoPlaylistAP, page: number, t: Transaction): Promise<PlaylistObject> { |
418d092a | 547 | const handler = (start: number, count: number) => { |
df0b219d | 548 | return VideoPlaylistElementModel.listUrlsOfForAP(this.id, start, count, t) |
418d092a C |
549 | } |
550 | ||
e8bafea3 C |
551 | let icon: ActivityIconObject |
552 | if (this.hasThumbnail()) { | |
553 | icon = { | |
554 | type: 'Image' as 'Image', | |
555 | url: this.getThumbnailUrl(), | |
556 | mediaType: 'image/jpeg' as 'image/jpeg', | |
557 | width: THUMBNAILS_SIZE.width, | |
558 | height: THUMBNAILS_SIZE.height | |
559 | } | |
560 | } | |
561 | ||
df0b219d | 562 | return activityPubCollectionPagination(this.url, handler, page) |
418d092a C |
563 | .then(o => { |
564 | return Object.assign(o, { | |
565 | type: 'Playlist' as 'Playlist', | |
566 | name: this.name, | |
567 | content: this.description, | |
568 | uuid: this.uuid, | |
df0b219d C |
569 | published: this.createdAt.toISOString(), |
570 | updated: this.updatedAt.toISOString(), | |
418d092a | 571 | attributedTo: this.VideoChannel ? [ this.VideoChannel.Actor.url ] : [], |
e8bafea3 | 572 | icon |
418d092a C |
573 | }) |
574 | }) | |
575 | } | |
576 | } |