X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-live.ts;h=014491d50011f532de056c2e79e022d1276ce33c;hb=16c016e8b1d5ca46343d3363f9a49e24c5d7c944;hp=0e229de6ab0c946d7cb6c1015999c8e7610808ed;hpb=ef680f68351ec10ab73a1131570a6d14ce14c195;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index 0e229de6a..014491d50 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts @@ -1,6 +1,7 @@ import { AllowNull, BelongsTo, Column, CreatedAt, DataType, DefaultScope, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' import { WEBSERVER } from '@server/initializers/constants' import { MVideoLive, MVideoLiveVideo } from '@server/types/models' +import { AttributesOnly } from '@shared/core-utils' import { LiveVideo, VideoState } from '@shared/models' import { VideoModel } from './video' import { VideoBlacklistModel } from './video-blacklist' @@ -28,7 +29,7 @@ import { VideoBlacklistModel } from './video-blacklist' } ] }) -export class VideoLiveModel extends Model { +export class VideoLiveModel extends Model>> { @AllowNull(true) @Column(DataType.STRING) @@ -38,6 +39,10 @@ export class VideoLiveModel extends Model { @Column saveReplay: boolean + @AllowNull(false) + @Column + permanentLive: boolean + @CreatedAt createdAt: Date @@ -93,8 +98,14 @@ export class VideoLiveModel extends Model { toFormattedJSON (): LiveVideo { return { - rtmpUrl: WEBSERVER.RTMP_URL, - streamKey: this.streamKey + // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL + rtmpUrl: this.streamKey + ? WEBSERVER.RTMP_URL + : null, + + streamKey: this.streamKey, + permanentLive: this.permanentLive, + saveReplay: this.saveReplay } } }