web

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 28 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

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.

func SetLoginRedirectCookie added in v1.7.10

func SetLoginRedirectCookie(c *gin.Context)

SetLoginRedirectCookie stores where to send the user once they have logged in.

It has to happen while serving the login page, before the user picks between the internal form and an external identity provider, because an external login leaves the site entirely and comes back without the original query string. It is exported so that the route serving the SPA login page keeps the same behaviour.

Types

type AdminPageData

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

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 EditCourseData

type EditCourseData struct {
	IndexData    IndexData
	IngestBase   string
	LectureHalls []model.LectureHall
	Courses      []model.Course // administered courses of user
}

type HealthCheckData

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

type IndexData

type IndexData struct {
	VersionTag     string
	TUMLiveContext tools.TUMLiveContext
	CanonicalURL   tools.CanonicalURL
	Branding       tools.Branding
	WikiURL        string
	// Only the course editor still sets these, to mark a course as being of a past
	// semester. EditCoursePage fills them; nothing else does.
	CurrentYear int
	CurrentTerm string
}

IndexData is what every server-rendered page needs: who is asking, and how the installation presents itself. The course and semester listings it used to carry went with the start page, which the SPA serves.

func NewIndexData

func NewIndexData() IndexData

func NewIndexDataWithContext

func NewIndexDataWithContext(c *gin.Context) IndexData

type LectureStatsPageData

type LectureStatsPageData struct {
	IndexData IndexData
	Lecture   model.Stream
}

type LectureUnitsPageData

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

type LiveLectureManagementData

type LiveLectureManagementData struct {
	IndexData IndexData
	Lecture   model.Stream
	ChatData  ChatData
}

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

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.
	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