ActivityPub-federated video streaming platform using P2P directly in your web browser
Change models
clementbrizardc80341655fce
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.tsindex fc772a3cf4..9078bb5d28 100644--- a/client/src/app/shared/video/video-edit.model.ts+++ b/client/src/app/shared/video/video-edit.model.ts@@ -25,6 +25,7 @@ export class VideoEdit implements VideoUpdate {uuid?: stringid?: numberscheduleUpdate?: VideoScheduleUpdate+ originallyPublishedAt?: Date | stringconstructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {if (video) {@@ -46,6 +47,7 @@ export class VideoEdit implements VideoUpdate {this.previewUrl = video.previewUrlthis.scheduleUpdate = video.scheduledUpdate+ this.originallyPublishedAt = new Date(video.originallyPublishedAt)}}@@ -67,6 +69,12 @@ export class VideoEdit implements VideoUpdate {} else {this.scheduleUpdate = null}++ // Convert originallyPublishedAt to string so that function objectToFormData() works correctly+ if (this.originallyPublishedAt) {+ const originallyPublishedAt = new Date(values['originallyPublishedAt'])+ this.originallyPublishedAt = originallyPublishedAt.toISOString()+ }}toFormPatch () {@@ -82,7 +90,8 @@ export class VideoEdit implements VideoUpdate {commentsEnabled: this.commentsEnabled,waitTranscoding: this.waitTranscoding,channelId: this.channelId,- privacy: this.privacy+ privacy: this.privacy,+ originallyPublishedAt: this.originallyPublishedAt}// Special case if we scheduled an updatediff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.tsindex b92c96450b..c9b0529517 100644--- a/client/src/app/shared/video/video.model.ts+++ b/client/src/app/shared/video/video.model.ts@@ -17,6 +17,7 @@ export class Video implements VideoServerModel {createdAt: DateupdatedAt: DatepublishedAt: Date+ originallyPublishedAt: Date | stringcategory: VideoConstant<number>licence: VideoConstant<number>language: VideoConstant<string>@@ -116,6 +117,9 @@ export class Video implements VideoServerModel {this.privacy.label = peertubeTranslate(this.privacy.label, translations)this.scheduledUpdate = hash.scheduledUpdate+ this.originallyPublishedAt = hash.originallyPublishedAt ?+ new Date(hash.originallyPublishedAt.toString())+ : nullif (this.state) this.state.label = peertubeTranslate(this.state.label, translations)this.blacklisted = hash.blacklisteddiff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.tsindex de0747f222..7a9513cbe5 100644--- a/server/models/video/video-format-utils.ts+++ b/server/models/video/video-format-utils.ts@@ -60,6 +60,7 @@ function videoModelToFormattedJSON (video: VideoModel, options?: VideoFormattingcreatedAt: video.createdAt,updatedAt: video.updatedAt,publishedAt: video.publishedAt,+ originallyPublishedAt: video.originallyPublishedAt,account: {id: formattedAccount.id,uuid: formattedAccount.uuid,@@ -264,6 +265,9 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject {state: video.state,commentsEnabled: video.commentsEnabled,published: video.publishedAt.toISOString(),+ originallyPublishedAt: video.originallyPublishedAt ?+ video.originallyPublishedAt.toISOString() :+ null,updated: video.updatedAt.toISOString(),mediaType: 'text/markdown',content: video.getTruncatedDescription(),diff --git a/server/models/video/video.ts b/server/models/video/video.tsindex 80a6c78320..806b6e0464 100644--- a/server/models/video/video.ts+++ b/server/models/video/video.ts@@ -102,6 +102,7 @@ const indexes: Sequelize.DefineIndexesOptions[] = [{ fields: [ 'createdAt' ] },{ fields: [ 'publishedAt' ] },+ { fields: [ 'originallyPublishedAt' ] },{ fields: [ 'duration' ] },{ fields: [ 'views' ] },{ fields: [ 'channelId' ] },@@ -684,6 +685,9 @@ export class VideoModel extends Model<VideoModel> {@ColumnpublishedAt: Date+ @Column+ originallyPublishedAt: Date+@ForeignKey(() => VideoChannelModel)@ColumnchannelId: numberdiff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.tsindex 8504c178fa..df07507b43 100644--- a/shared/models/activitypub/objects/video-torrent-object.ts+++ b/shared/models/activitypub/objects/video-torrent-object.ts@@ -24,6 +24,7 @@ export interface VideoTorrentObject {waitTranscoding: booleanstate: VideoStatepublished: string+ originallyPublishedAt: stringupdated: stringmediaType: 'text/markdown'content: stringdiff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.tsindex 190d637832..392bd10258 100644--- a/shared/models/videos/video-create.model.ts+++ b/shared/models/videos/video-create.model.ts@@ -15,4 +15,5 @@ export interface VideoCreate {commentsEnabled?: booleanprivacy: VideoPrivacyscheduleUpdate?: VideoScheduleUpdate+ originallyPublishedAt: Date | string}diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.tsindex ed141a824f..62e02e0794 100644--- a/shared/models/videos/video-update.model.ts+++ b/shared/models/videos/video-update.model.ts@@ -17,4 +17,5 @@ export interface VideoUpdate {thumbnailfile?: Blobpreviewfile?: BlobscheduleUpdate?: VideoScheduleUpdate+ originallyPublishedAt?: Date | string}diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.tsindex 4a9fa58b10..2373ceb189 100644--- a/shared/models/videos/video.model.ts+++ b/shared/models/videos/video.model.ts@@ -43,6 +43,7 @@ export interface Video {createdAt: Date | stringupdatedAt: Date | stringpublishedAt: Date | string+ originallyPublishedAt: Date | stringcategory: VideoConstant<number>licence: VideoConstant<number>language: VideoConstant<string>