Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateFromPassword(password string) (encodedHash string, err error)
- func ParsableTimeFormat(time time.Time) string
- type Audit
- type AuditType
- type Bookmark
- type CameraPreset
- type CameraPresetPreference
- type CameraType
- type Chat
- type ChatReaction
- type Course
- func (c Course) AdminJson(lhs []LectureHall) []gin.H
- func (c Course) CanUseSource(lectureHallID uint, sourceType string) bool
- func (c Course) CompareTo(other Course) bool
- func (c Course) GetCameraPresetPreference() []CameraPresetPreference
- func (c Course) GetLastRecording() Stream
- func (c Course) GetLiveStreams() []Stream
- func (c Course) GetNextLecture() Stream
- func (c Course) GetNextLectureDate() time.Time
- func (c Course) GetNextLectureDateFormatted() string
- func (c Course) GetRecordings() []Stream
- func (c Course) GetSourceModeForLectureHall(id uint) SourceMode
- func (c Course) GetSourcePreference() []SourcePreference
- func (c Course) GetStreamUrl(stream Stream) string
- func (c Course) GetUrl() string
- func (c Course) HasNextLecture() bool
- func (c Course) HasRecordings() bool
- func (c Course) HasStreams() bool
- func (c Course) IsEnrolled() bool
- func (c Course) IsHidden() bool
- func (c Course) IsLive() bool
- func (c Course) IsLoggedIn() bool
- func (c Course) IsNextLectureSelfStream() bool
- func (c Course) IsNextLectureStartingSoon() bool
- func (c Course) NextLectureHasReachedTimeSlot() bool
- func (c Course) NumStreams() int
- func (c Course) NumUsers() int
- func (c *Course) SetCameraPresetPreference(pref []CameraPresetPreference)
- func (c *Course) SetSourcePreference(pref []SourcePreference)
- func (c Course) StreamTimes() []string
- func (c *Course) ToDTO() CourseDTO
- type CourseDTO
- type DownloadableVod
- type Email
- type File
- type FileType
- type InfoPage
- type InfoPageType
- type IngestServer
- type LectureHall
- type LectureHallDTO
- type Model
- type Notification
- type NotificationTarget
- type PlaybackSpeedSetting
- type PlaybackSpeedSettings
- type Poll
- type PollOption
- type RegisterLink
- type ServerNotification
- type ShortLink
- type Silence
- type SourceMode
- type SourcePreference
- type Stat
- type Stream
- func (s Stream) Attachments() []File
- func (s Stream) Color() string
- func (s Stream) FriendlyDate() string
- func (s Stream) FriendlyNextDate() string
- func (s Stream) FriendlyTime() string
- func (s Stream) GetDescriptionHTML() string
- func (s Stream) GetLGThumbnail() (string, error)
- func (s Stream) GetLGThumbnailForVideoType(videoType VideoType) (string, error)
- func (s Stream) GetName() string
- func (s Stream) GetSilencesJson() string
- func (s Stream) GetStartInSeconds() int
- func (s Stream) GetThumbIdForSource(source string) uint
- func (s Stream) GetVodFiles() []DownloadableVod
- func (s Stream) HLSUrl() string
- func (s Stream) IsComingUp() bool
- func (s Stream) IsConverting() bool
- func (s Stream) IsDownloadable() bool
- func (s Stream) IsPast() bool
- func (s Stream) IsPlanned() bool
- func (s Stream) IsSelfStream() bool
- func (s Stream) IsStartingInMoreThanOneDay() bool
- func (s Stream) IsStartingInOneDay() bool
- func (s Stream) ParsableLiveNowTimestamp() string
- func (s Stream) ParsableStartTime() string
- func (s Stream) TimeSlotReached() bool
- func (s Stream) ToDTO() StreamDTO
- type StreamDTO
- type StreamName
- type StreamProgress
- type StreamUnit
- type StreamVersion
- type Subtitles
- type Token
- type TranscodingFailure
- type TranscodingProgress
- type UploadKey
- type User
- func (u *User) BeforeCreate(tx *gorm.DB) (err error)
- func (u *User) ComparePasswordAndHash(password string) (match bool, err error)
- func (u *User) CoursesForSemester(year int, term string, context context.Context) []Course
- func (u *User) GetLoginString() string
- func (u *User) GetPlaybackSpeeds() (speeds PlaybackSpeedSettings)
- func (u User) GetPreferredGreeting() string
- func (u User) GetPreferredName() string
- func (u *User) IsAdminOfCourse(course Course) bool
- func (u *User) IsEligibleToWatchCourse(course Course) bool
- func (u User) PreferredNameChangeAllowed() bool
- func (u *User) SetPassword(password string) (err error)
- type UserSetting
- type UserSettingType
- type VideoSection
- type VideoSeekChunk
- type VideoType
- type Worker
Constants ¶
const ( FILETYPE_INVALID = iota // Deprecated: vods can now be downloaded from the edge server using the signed playlist url + ?download=1. FILETYPE_VOD FILETYPE_ATTACHMENT FILETYPE_IMAGE_JPG FILETYPE_THUMB_COMB FILETYPE_THUMB_CAM FILETYPE_THUMB_PRES FILETYPE_THUMB_LG_COMB FILETYPE_THUMB_LG_CAM FILETYPE_THUMB_LG_PRES FILETYPE_THUMB_LG_CAM_PRES // generated from CAM and PRES, preferred over the others )
const ( TargetAll = iota + 1 //TargetAll Is any user, regardless if logged in or not TargetUser //TargetUser Are all users that are logged in TargetStudent //TargetStudent Are all users that are logged in and are students TargetLecturer //TargetLecturer Are all users that are logged in and are lecturers TargetAdmin //TargetAdmin Are all users that are logged in and are admins )
const ( VideoTypeCombined VideoType = "COMB" VideoTypePresentation = "PRES" VideoTypeCamera = "CAM" )
const ( AdminType = 1 LecturerType = 2 GenericType = 3 StudentType = 4 )
const TokenScopeAdmin = "admin"
Variables ¶
var ( ErrReplyToReply = errors.New("reply to reply not allowed") ErrReplyToWrongStream = errors.New("reply to message from different stream not allowed") ErrReplyToNoMsg = errors.New("reply to message not found") ErrMessageTooLong = errors.New("message too long") ErrMessageNoText = errors.New("message has no text") ErrCooledDown = errors.New("user is cooled down") )
var ( ErrUsernameTooLong = errors.New("username is too long") ErrUsernameNoText = errors.New("username has no text") )
var ( ErrInvalidHash = errors.New("the encoded hash is not in the correct format") ErrIncompatibleVersion = errors.New("incompatible version of argon2") )
Functions ¶
func GenerateFromPassword ¶
func ParsableTimeFormat ¶
ParsableTimeFormat returns a JavaScript friendly formatted date string
Types ¶
type Audit ¶
type Bookmark ¶
type Bookmark struct { gorm.Model Description string `gorm:"not null" json:"description"` Hours uint `gorm:"not null" json:"hours"` Minutes uint `gorm:"not null" json:"minutes"` Seconds uint `gorm:"not null" json:"seconds"` UserID uint `gorm:"not null" json:"-"` StreamID uint `gorm:"not null" json:"-"` }
type CameraPreset ¶
type CameraPresetPreference ¶
type Chat ¶
type Chat struct { gorm.Model UserID string `gorm:"not null" json:"userId"` UserName string `gorm:"not null" json:"name"` Message string `gorm:"type:text;not null;index:,class:FULLTEXT" json:"-"` SanitizedMessage string `gorm:"-" json:"message"` // don't store the sanitized message in the database StreamID uint `gorm:"not null" json:"-"` Admin bool `gorm:"not null;default:false" json:"admin"` Color string `gorm:"not null;default:'#368bd6'" json:"color"` Visible sql.NullBool `gorm:"not null;default:true" json:"-"` IsVisible bool `gorm:"-" json:"visible"` // IsVisible is .Bool value of Visible for simplicity Reactions []ChatReaction `gorm:"foreignKey:chat_id;" json:"reactions"` AddressedToUsers []User `gorm:"many2many:chat_user_addressedto" json:"-"` AddressedToIds []uint `gorm:"-" json:"addressedTo"` Replies []Chat `gorm:"foreignkey:ReplyTo" json:"replies"` ReplyTo sql.NullInt64 `json:"replyTo"` Resolved bool `gorm:"not null;default:false" json:"resolved"` }
func (*Chat) AfterFind ¶
AfterFind is a GORM hook that sanitizes the message after it's loaded from the database.
func (*Chat) BeforeCreate ¶
BeforeCreate is a GORM hook that is called before a new chat is created. Messages won't be saved if any of these apply: - message is empty (after trimming) - message is too long (>maxMessageLength) - user is cooled down (user sent > coolDownMessages messages within coolDown) - message is a reply, and:
- reply is to a reply (not allowed)
- reply is to a message from a different stream
- reply is to a message that doesn't exist
func (*Chat) SanitiseMessage ¶
func (c *Chat) SanitiseMessage()
SanitiseMessage sets chat.SanitizedMessage to the sanitized html version of chat.Message, including <a> tags for links
type ChatReaction ¶
type Course ¶
type Course struct { gorm.Model UserID uint `gorm:"not null"` // Owner of the course Name string `gorm:"not null"` Slug string `gorm:"not null"` // eg. eidi Year int `gorm:"not null"` // eg. 2021 TeachingTerm string `gorm:"not null"` // eg. Summer/Winter TUMOnlineIdentifier string VODEnabled bool `gorm:"default:true"` DownloadsEnabled bool `gorm:"default:false"` ChatEnabled bool `gorm:"default:false"` AnonymousChatEnabled bool `gorm:"not null;default:true"` ModeratedChatEnabled bool `gorm:"not null;default:false"` VodChatEnabled bool Visibility string `gorm:"default:loggedin"` // public, loggedin or enrolled Streams []Stream Users []User `gorm:"many2many:course_users;"` Admins []User `gorm:"many2many:course_admins;"` Token string UserCreatedByToken bool `gorm:"default:false"` CameraPresetPreferences string // json encoded. e.g. [{lectureHallID:1, presetID:4}, ...] SourcePreferences string // json encoded. e.g. [{lectureHallID:1, sourceMode:0}, ...] Pinned bool `gorm:"-"` // Used to determine if the course is pinned when loaded for a specific user. LivePrivate bool `gorm:"not null; default:false"` // whether Livestreams are private VodPrivate bool `gorm:"not null; default:false"` // Whether VODs are made private after livestreams }
func (Course) AdminJson ¶
func (c Course) AdminJson(lhs []LectureHall) []gin.H
AdminJson is the JSON representation of a courses streams for the admin panel
func (Course) CanUseSource ¶
CanUseSource returns whether the specified source type is allowed for the lecture hall id given
func (Course) GetCameraPresetPreference ¶
func (c Course) GetCameraPresetPreference() []CameraPresetPreference
GetCameraPresetPreference retrieves the camera preset preferences
func (Course) GetLastRecording ¶
GetLastRecording returns the most recent lecture of the course Assumes an ascending order of c.Streams
func (Course) GetLiveStreams ¶
GetLiveStreams returns the current live streams of the course or an empty slice if none are live
func (Course) GetNextLecture ¶
GetNextLecture returns the next lecture of the course
func (Course) GetNextLectureDate ¶
GetNextLectureDate returns the next lecture date of the course
func (Course) GetNextLectureDateFormatted ¶
GetNextLectureDateFormatted returns a JavaScript friendly formatted date string
func (Course) GetRecordings ¶
GetRecordings returns all recording of this course as streams
func (Course) GetSourceModeForLectureHall ¶
func (c Course) GetSourceModeForLectureHall(id uint) SourceMode
GetSourceModeForLectureHall retrieves the source preference for the given lecture hall, returns default SourcePreference if non-existing
func (Course) GetSourcePreference ¶
func (c Course) GetSourcePreference() []SourcePreference
GetSourcePreference retrieves the source preferences
func (Course) GetStreamUrl ¶
GetStreamUrl returns the URL of the stream, e.g. /w/MyStream/42
func (Course) HasNextLecture ¶
HasNextLecture checks whether there is another upcoming lecture
func (Course) HasRecordings ¶
HasRecordings returns whether the course has any recordings.
func (Course) HasStreams ¶
HasStreams checks whether the lecture has any streams (recorded, live or upcoming) associated to it
func (Course) IsEnrolled ¶
IsEnrolled returns true if visibility is set to 'enrolled' and false if not
func (Course) IsLoggedIn ¶
IsLoggedIn returns true if visibility is set to 'loggedin' and false if not
func (Course) IsNextLectureSelfStream ¶
IsNextLectureSelfStream checks whether the next lecture is a self stream
func (Course) IsNextLectureStartingSoon ¶
IsNextLectureStartingSoon checks whether the course has a lecture that starts soon
func (Course) NextLectureHasReachedTimeSlot ¶
NextLectureHasReachedTimeSlot returns whether the courses next lecture arrived at its timeslot
func (Course) NumStreams ¶
NumStreams returns the number of streams for the course that are VoDs or live
func (*Course) SetCameraPresetPreference ¶
func (c *Course) SetCameraPresetPreference(pref []CameraPresetPreference)
SetCameraPresetPreference updates the camera preset preferences
func (*Course) SetSourcePreference ¶
func (c *Course) SetSourcePreference(pref []SourcePreference)
SetSourcePreference updates the source preferences
func (Course) StreamTimes ¶
type DownloadableVod ¶
type DownloadableVod struct {
FriendlyName, DownloadURL string
}
type Email ¶
type Email struct { gorm.Model From string `gorm:"not null"` To string `gorm:"not null"` Subject string `gorm:"not null"` Body string `gorm:"longtext;not null"` Success bool `gorm:"not null;default:false"` Retries int `gorm:"not null;default:0"` LastTry time.Time `gorm:"default:null"` Errors string `gorm:"longtext;default:null"` }
Email represents an email to be sent.
type File ¶
type File struct { gorm.Model StreamID uint `gorm:"not null"` Path string `gorm:"not null"` Filename string Type FileType `gorm:"not null; default: 1"` }
func (File) GetDownloadFileName ¶
func (File) GetFriendlyFileName ¶
func (File) GetVodTypeByName ¶
GetVodTypeByName infers the type of a video file based on its name.
type InfoPage ¶
type InfoPage struct { gorm.Model Name string `gorm:"not null"` // e.g. 'privacy', 'imprint',... RawContent string `gorm:"text; not null"` Type InfoPageType `gorm:"not null; default: 1"` }
type IngestServer ¶
type IngestServer struct { gorm.Model `json:"gorm_model"` Url string `json:"url"` // e.g. rtmp://user:password@ingest1.huge.server.com OutUrl string `gorm:"not null"` // e.g. https://out.server.com/streams/%s/playlist.m3u8 where %s is the stream name Workload int `json:"workload,omitempty"` // # of streams currently ingesting to this server StreamNames []StreamName // array of stream names that will be assigned to this server }
IngestServer represents a server we ingest our streams to. This is used for load balancing.
type LectureHall ¶
type LectureHall struct { gorm.Model Name string `gorm:"not null"` //as in smp (e.g. room_00_13_009A) FullName string `gorm:"not null"` //e.g. '5613.EG.009A (00.13.009A, Seminarraum), Boltzmannstr. 3(5613), 85748 Garching b. München' CombIP string PresIP string CamIP string CameraIP string // ip of the actual camera (not smp) CameraType CameraType `gorm:"not null; default:1"` Streams []Stream CameraPresets []CameraPreset RoomID int // used by TUMOnline PwrCtrlIp string // power control api for red live light LiveLightIndex int // id of power outlet for live light ExternalURL string }
func (LectureHall) NumSources ¶
func (l LectureHall) NumSources() int
func (*LectureHall) ToDTO ¶
func (l *LectureHall) ToDTO() *LectureHallDTO
type LectureHallDTO ¶
type Model ¶
type Model struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"-"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` }
Model is a base model that can be embedded in other models it's basically the same as gorm.Model but with convenient json annotations
type Notification ¶
type Notification struct { Model Title *string `json:"title,omitempty"` Body string `json:"-" gorm:"not null"` Target NotificationTarget `json:"-" gorm:"not null; default:1"` // SanitizedBody is the body of the notification, converted from markdown to HTML SanitizedBody string `json:"body" gorm:"-"` }
Notification is a message (e.g. a feature alert) that is displayed to users
func (*Notification) AfterFind ¶
func (n *Notification) AfterFind(_ *gorm.DB) error
AfterFind populates the SanitizedBody after getting the Notification from the database
func (Notification) GetBodyForGoTemplate ¶
func (n Notification) GetBodyForGoTemplate() template.HTML
type NotificationTarget ¶
type NotificationTarget int
NotificationTarget is a User group the Notification is displayed to
type PlaybackSpeedSetting ¶
type PlaybackSpeedSettings ¶
type PlaybackSpeedSettings []PlaybackSpeedSetting
func (PlaybackSpeedSettings) GetEnabled ¶
func (s PlaybackSpeedSettings) GetEnabled() (res []float32)
type Poll ¶
type Poll struct { gorm.Model StreamID uint // used by gorm Stream Stream `gorm:"foreignKey:stream_id;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Question string `gorm:"not null" json:"question"` Active bool `gorm:"not null;default:true" json:"active"` PollOptions []PollOption `gorm:"many2many:chat_poll_options" json:"pollOptions"` }
type PollOption ¶
type PollOption struct { gorm.Model Answer string `gorm:"not null" json:"answer"` Votes []User `gorm:"many2many:poll_option_user_votes" json:"-"` }
func (PollOption) GetStatsMap ¶
func (o PollOption) GetStatsMap(votes int64) gin.H
type RegisterLink ¶
type ServerNotification ¶
type ServerNotification struct { gorm.Model Text string `gorm:"not null"` Warn bool `gorm:"not null;default:false"` // if false -> Info Start time.Time `gorm:"not null"` Expires time.Time `gorm:"not null"` }
ServerNotification todo: rename to ServerAlert to avoid confusion with Notification
func (ServerNotification) BeforeCreate ¶
func (s ServerNotification) BeforeCreate(tx *gorm.DB) (err error)
func (ServerNotification) FormatExpires ¶
func (s ServerNotification) FormatExpires() string
func (ServerNotification) FormatFrom ¶
func (s ServerNotification) FormatFrom() string
func (ServerNotification) HTML ¶
func (s ServerNotification) HTML() template.HTML
type ShortLink ¶
type ShortLink struct { gorm.Model Link string `gorm:"type:varchar(256); unique; not null"` CourseId uint `gorm:"not null"` }
ShortLink friendly name for a link to courses highlight page
type SourcePreference ¶
type SourcePreference struct { LectureHallID uint `json:"lecture_hall_id"` SourceMode SourceMode `json:"source_mode"` }
type Stream ¶
type Stream struct { gorm.Model Name string `gorm:"index:,class:FULLTEXT"` Description string `gorm:"type:text;index:,class:FULLTEXT"` CourseID uint Start time.Time `gorm:"not null"` End time.Time `gorm:"not null"` ChatEnabled bool `gorm:"default:null"` RoomName string RoomCode string EventTypeName string TUMOnlineEventID uint SeriesIdentifier string `gorm:"default:null"` StreamKey string `gorm:"not null"` PlaylistUrl string PlaylistUrlPRES string PlaylistUrlCAM string LiveNow bool `gorm:"not null"` LiveNowTimestamp time.Time `gorm:"default:null;column:live_now_timestamp"` Recording bool Premiere bool `gorm:"default:null"` Ended bool `gorm:"default:null"` Chats []Chat Stats []Stat Units []StreamUnit VodViews uint `gorm:"default:0"` // todo: remove me before next semester StartOffset uint `gorm:"default:null"` EndOffset uint `gorm:"default:null"` LectureHallID uint `gorm:"default:null"` Silences []Silence Files []File `gorm:"foreignKey:StreamID"` ThumbInterval uint32 `gorm:"default:null"` StreamName string Duration sql.NullInt32 `gorm:"default:null"` StreamWorkers []Worker `gorm:"many2many:stream_workers;"` StreamProgresses []StreamProgress `gorm:"foreignKey:StreamID"` VideoSections []VideoSection TranscodingProgresses []TranscodingProgress `gorm:"foreignKey:StreamID"` Private bool `gorm:"not null;default:false"` Watched bool `gorm:"-"` // Used to determine if stream is watched when loaded for a specific user. }
func (Stream) Attachments ¶
func (Stream) FriendlyDate ¶
func (Stream) FriendlyNextDate ¶
func (Stream) FriendlyTime ¶
func (Stream) GetDescriptionHTML ¶
func (Stream) GetLGThumbnail ¶
func (Stream) GetLGThumbnailForVideoType ¶
func (Stream) GetSilencesJson ¶
func (Stream) GetStartInSeconds ¶
GetStartInSeconds returns the number of seconds until the stream starts (or 0 if it has already started or is a vod)
func (Stream) GetThumbIdForSource ¶
GetThumbIdForSource returns the id of file that stores the thumbnail sprite for a specific source type.
func (Stream) GetVodFiles ¶
func (s Stream) GetVodFiles() []DownloadableVod
GetVodFiles returns all downloadable files that user can see when using the download dropdown for a stream.
func (Stream) IsComingUp ¶
IsComingUp returns whether the stream begins in 30 minutes
func (Stream) IsConverting ¶
func (Stream) IsDownloadable ¶
IsDownloadable returns true if the stream is a recording and has at least one stream associated with it.
func (Stream) IsSelfStream ¶
IsSelfStream returns whether the stream is a scheduled stream in a lecture hall
func (Stream) IsStartingInMoreThanOneDay ¶
IsStartingInMoreThanOneDay returns whether the stream starts in at least 2 days
func (Stream) IsStartingInOneDay ¶
IsStartingInOneDay returns whether the stream starts within 1 day
func (Stream) ParsableLiveNowTimestamp ¶
ParsableLiveNowTimestamp returns a JavaScript friendly formatted date string
func (Stream) ParsableStartTime ¶
ParsableStartTime returns a JavaScript friendly formatted date string
func (Stream) TimeSlotReached ¶
TimeSlotReached returns whether stream has passed the starting time
type StreamName ¶
type StreamName struct { gorm.Model StreamName string `gorm:"type:varchar(64); unique; not null"` IsTranscoding bool `gorm:"not null;default:false"` IngestServerID uint `gorm:"not null"` StreamID uint // Is null when the slot is not used FreedAt time.Time `gorm:"not null;default:0"` }
StreamName is essentially a "streaming slot" used for load balancing
type StreamProgress ¶
type StreamProgress struct { Progress float64 `gorm:"not null" json:"progress"` // The progress of the stream as represented as a floating point value between 0 and 1. Watched bool `gorm:"not null;default:false" json:"watched"` // Whether the user has marked the stream as watched. // We need to use a primary key in order to use ON CONFLICT in dao/progress.go, same as e.g. https://www.sqlite.org/lang_conflict.html. StreamID uint `gorm:"primaryKey" json:"streamId"` UserID uint `gorm:"primaryKey" json:"-"` }
StreamProgress represents the progress of a stream or video. Currently, it is only used for VoDs.
type StreamUnit ¶
type StreamUnit struct { gorm.Model UnitName string UnitDescription string UnitStart uint `gorm:"not null"` UnitEnd uint `gorm:"not null"` StreamID uint `gorm:"not null"` }
func (StreamUnit) GetDescriptionHTML ¶
func (s StreamUnit) GetDescriptionHTML() template.HTML
func (StreamUnit) GetRoundedUnitLen ¶
func (s StreamUnit) GetRoundedUnitLen() string
func (StreamUnit) GetUnitDurationMS ¶
func (s StreamUnit) GetUnitDurationMS() uint
type StreamVersion ¶
type StreamVersion string
const ( COMB StreamVersion = "COMB" CAM StreamVersion = "CAM" PRES StreamVersion = "PRES" )
type Subtitles ¶
type Subtitles struct { gorm.Model StreamID uint `gorm:"not null"` Content string `gorm:"not null"` // the .srt content provided by the voice-service Language string `gorm:"not null"` }
Subtitles represents subtitles for a particular stream in a particular language
func (*Subtitles) BeforeCreate ¶
BeforeCreate is currently not implemented for Subtitles
type Token ¶
type Token struct { gorm.Model UserID uint // used by gorm User User `gorm:"foreignKey:user_id;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` // creator of the token Token string `json:"token" gorm:"not null"` // secret token Expires sql.NullTime `json:"expires"` // expiration date (null if none) Scope string `json:"scope" gorm:"not null"` // scope of the token, currently only admin LastUse sql.NullTime `json:"last_use"` // last time the token was used }
Token can be used to authenticate instead of a user account
type TranscodingFailure ¶
type TranscodingFailure struct { gorm.Model StreamID uint `gorm:"not null"` Stream Stream Version StreamVersion `gorm:"not null"` Logs string `gorm:"not null"` ExitCode int FilePath string `gorm:"not null"` // the source file that could not be transcoded Hostname string `gorm:"not null"` // the hostname of the worker that failed // Ignored by gorm: FriendlyTime string `gorm:"-"` }
TranscodingFailure represents a failed transcoding attempt
type TranscodingProgress ¶
type TranscodingProgress struct { StreamID uint `gorm:"primaryKey" json:"streamID"` Version StreamVersion `gorm:"primaryKey" json:"version"` Progress int `gorm:"not null; default:0" json:"progress"` }
TranscodingProgress is the progress as a percentage of the conversion of a single stream view (e.g. stream 123, COMB view)
type UploadKey ¶
type UploadKey struct { gorm.Model UploadKey string `gorm:"not null"` Stream Stream StreamID uint VideoType VideoType `gorm:"not null"` }
UploadKey represents a key that is created when a user uploads a file, sent to the worker with the upload request and back to TUM-Live to authenticate the request.
type User ¶
type User struct { gorm.Model Name string `gorm:"type:varchar(80); not null" json:"name"` LastName *string `json:"-"` Email sql.NullString `gorm:"type:varchar(256); uniqueIndex; default:null" json:"-"` MatriculationNumber string `gorm:"type:varchar(256); uniqueIndex; default:null" json:"-"` LrzID string `json:"-"` Role uint `gorm:"default:4" json:"-"` // AdminType = 1, LecturerType = 2, GenericType = 3, StudentType = 4 Password string `gorm:"default:null" json:"-"` Courses []Course `gorm:"many2many:course_users" json:"-"` // courses a lecturer invited this user to AdministeredCourses []Course `gorm:"many2many:course_admins"` // courses this user is an admin of PinnedCourses []Course `gorm:"many2many:pinned_courses"` Settings []UserSetting `gorm:"foreignkey:UserID"` Bookmarks []Bookmark `gorm:"foreignkey:UserID" json:"-"` }
func (*User) BeforeCreate ¶
BeforeCreate is a GORM hook that is called before a new user is created. Users won't be saved if any of these apply: - username is empty (after trimming) - username is too long (>maxUsernameLength)
func (*User) ComparePasswordAndHash ¶
func (*User) CoursesForSemester ¶
func (*User) GetLoginString ¶
GetLoginString returns the email if it is set, otherwise the lrzID
func (*User) GetPlaybackSpeeds ¶
func (u *User) GetPlaybackSpeeds() (speeds PlaybackSpeedSettings)
func (User) GetPreferredGreeting ¶
GetPreferredGreeting returns the preferred greeting of the user if set, otherwise Moin
func (User) GetPreferredName ¶
GetPreferredName returns the preferred name of the user if set, otherwise the firstName from TUMOnline
func (*User) IsAdminOfCourse ¶
IsAdminOfCourse checks if the user is an admin of the course
func (*User) IsEligibleToWatchCourse ¶
func (User) PreferredNameChangeAllowed ¶
PreferredNameChangeAllowed returns false if the user has set a preferred name within the last 3 months, otherwise true
func (*User) SetPassword ¶
type UserSetting ¶
type UserSetting struct { gorm.Model UserID uint `gorm:"not null"` Type UserSettingType `gorm:"not null"` Value string `gorm:"not null"` //json encoded setting }
type UserSettingType ¶
type UserSettingType int
const ( PreferredName UserSettingType = iota + 1 Greeting CustomPlaybackSpeeds )
type VideoSection ¶
type VideoSection struct { gorm.Model Description string `gorm:"not null;index:,class:FULLTEXT" json:"description"` StartHours uint `gorm:"not null" json:"startHours"` StartMinutes uint `gorm:"not null" json:"startMinutes"` StartSeconds uint `gorm:"not null" json:"startSeconds"` StreamID uint `gorm:"not null" json:"streamID"` FileID uint `gorm:"not null" json:"fileID"` }
type VideoSeekChunk ¶
type Worker ¶
type Worker struct { WorkerID string `gorm:"primaryKey"` Host string Status string Workload uint // How much the worker has to do. +1 per silence detection job, +2 per converting job, +3 per streaming job LastSeen time.Time // VM stats: CPU string Memory string Disk string Uptime string Version string }
Source Files ¶
- audit.go
- bookmark.go
- camera_preset.go
- chat.go
- chat_reaction.go
- course.go
- email.go
- file.go
- info-page.go
- ingest-server.go
- lecture_hall.go
- model-base.go
- notification.go
- poll.go
- progress.go
- register_link.go
- server-notification.go
- shortlink.go
- silence.go
- stat.go
- stream-name.go
- stream-unit.go
- stream.go
- subtitles.go
- token.go
- transcoding-failure.go
- transcodingProgress.go
- upload-key.go
- user.go
- video-section.go
- video-seek-chunk.go
- worker.go