web

package
v1.4.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VersionTag string

Functions

func ConfigGinRouter

func ConfigGinRouter(router *gin.Engine)

func GetPageString added in v1.4.20

func GetPageString(s string) string

func HandleValidLogin

func HandleValidLogin(c *gin.Context, data *tools.SessionData)

HandleValidLogin starts a session and redirects the user to the page they were trying to access.

func IsFreshInstallation

func IsFreshInstallation(c *gin.Context, usersDao dao.UsersDao) (bool, error)

IsFreshInstallation Checks whether there are users in the database and returns true if so, false if not.

Types

type AdminPageData

type AdminPageData struct {
	IndexData           IndexData
	Users               []model.User
	Courses             []model.Course
	LectureHalls        []model.LectureHall
	Page                string
	Workers             WorkersData
	Semesters           []model.Semester
	CurY                int
	CurT                string
	EditCourseData      EditCourseData
	ServerNotifications []model.ServerNotification
	Tokens              TokensData
	InfoPages           []model.InfoPage
	Notifications       []model.Notification
}

func (AdminPageData) UsersAsJson

func (apd AdminPageData) UsersAsJson() string

type CacheMetrics

type CacheMetrics struct {
	Hits      uint64 `json:"hits"`
	Misses    uint64 `json:"misses"`
	KeysAdded uint64 `json:"keysAdded"`
}

type ChatData

type ChatData struct {
	IsAdminOfCourse bool // is current user admin or lecturer who created the course associated with the chat
	IndexData       IndexData
}

type CoursePageData

type CoursePageData struct {
	IndexData     IndexData
	Course        model.Course
	HighlightPage bool
	WatchedData   string
}

CoursePageData is the data for the course page.

type CourseStream

type CourseStream struct {
	Course      model.Course
	Stream      model.Stream
	LectureHall *model.LectureHall
}

type EditCourseData

type EditCourseData struct {
	IndexData    IndexData
	IngestBase   string
	LectureHalls []model.LectureHall
}

type HealthCheckData

type HealthCheckData struct {
	Version      string       `json:"version"`
	CacheMetrics CacheMetrics `json:"cacheMetrics"`
}

type IndexData

type IndexData struct {
	VersionTag          string
	TUMLiveContext      tools.TUMLiveContext
	IsUser              bool
	IsAdmin             bool
	IsStudent           bool
	LiveStreams         []CourseStream
	Courses             []model.Course
	PinnedCourses       []model.Course
	PublicCourses       []model.Course
	Semesters           []model.Semester
	CurrentYear         int
	CurrentTerm         string
	UserName            string
	ServerNotifications []model.ServerNotification
	CanonicalURL        tools.CanonicalURL
	Branding            tools.Branding
	WikiURL             string
}

func NewIndexData

func NewIndexData() IndexData

func NewIndexDataWithContext

func NewIndexDataWithContext(c *gin.Context) IndexData

func (*IndexData) LoadCoursesForRole

func (d *IndexData) LoadCoursesForRole(c *gin.Context, spanMain *sentry.Span, coursesDao dao.CoursesDao)

LoadCoursesForRole Load all courses of user. Distinguishes between admin, lecturer, and normal users.

func (*IndexData) LoadCurrentNotifications

func (d *IndexData) LoadCurrentNotifications(serverNoticationDao dao.ServerNotificationDao)

LoadCurrentNotifications Loads notifications from the database into the IndexData object

func (*IndexData) LoadLivestreams

func (d *IndexData) LoadLivestreams(c *gin.Context, daoWrapper dao.DaoWrapper)

LoadLivestreams Load non-hidden, currently live streams into the IndexData object. LoggedIn streams can only be seen by logged-in users. Enrolled streams can only be seen by users which are allowed to.

func (*IndexData) LoadPinnedCourses

func (d *IndexData) LoadPinnedCourses()

func (*IndexData) LoadPublicCourses

func (d *IndexData) LoadPublicCourses(coursesDao dao.CoursesDao)

LoadPublicCourses Load public courses of user. Filter courses which are already in IndexData.Courses

func (*IndexData) LoadSemesters

func (d *IndexData) LoadSemesters(spanMain *sentry.Span, coursesDao dao.CoursesDao)

LoadSemesters Load available Semesters from the database into the IndexData object

func (*IndexData) SetYearAndTerm

func (d *IndexData) SetYearAndTerm(c *gin.Context)

SetYearAndTerm Sets year and term on the IndexData object from the URL. Aborts with 404 if invalid

type LectureStatsPageData added in v1.4.20

type LectureStatsPageData struct {
	IndexData IndexData
	Lecture   model.Stream
}

type LectureUnitsPageData

type LectureUnitsPageData struct {
	IndexData IndexData
	Lecture   model.Stream
	Units     []model.StreamUnit
}

type LoginPageData

type LoginPageData struct {
	VersionTag string
	Error      bool

	UseSAML  bool
	IDPName  string
	IDPColor string

	Branding     tools.Branding
	CanonicalURL tools.CanonicalURL
}

LoginPageData contains the data for login page templates

func NewLoginPageData

func NewLoginPageData(err bool) LoginPageData

NewLoginPageData returns a new struct LoginPageData with the Error value err

type OptOutPageData

type OptOutPageData struct {
	IndexData IndexData
	Course    *model.Course
}

type TokensData added in v1.4.22

type TokensData struct {
	Tokens       []dao.AllTokensDto
	RtmpProxyURL string
	User         *model.User
}

type WatchPageData

type WatchPageData struct {
	IsAdminOfCourse bool // is current user admin or lecturer who created this course
	IsHighlightPage bool
	AlertsEnabled   bool // whether the alert config is set
	Version         string
	Unit            *model.StreamUnit
	Presets         []model.CameraPreset
	Progress        model.StreamProgress
	IndexData       IndexData
	Description     template.HTML
	CutOffLength    int    // The maximum length for the preview of a description.
	DVR             string // ?dvr if dvr is enabled, empty string otherwise
	LectureHallName string
	ChatData        ChatData
}

WatchPageData contains all the metadata that is related to the watch page.

func (*WatchPageData) Prepare

func (d *WatchPageData) Prepare(c *gin.Context, lectureHallsDao dao.LectureHallsDao) error

Prepare populates the data for the watch page.

type WorkersData

type WorkersData struct {
	Workers []model.Worker
	Token   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL