Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test:
.PHONY: lint
lint:
golangci-lint run
cd web; npx eslint ts/

.PHONY: protoVoice
protoVoice:
Expand Down
2 changes: 1 addition & 1 deletion cmd/tumlive/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func serveHttp(ctx context.Context, manager *runner_manager.Manager, camService
}

router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
if param.StatusCode >= 400 && VersionTag == "development" {
if param.StatusCode >= 400 && VersionTag == "development" {
return fmt.Sprintf("{\"service\": \"GIN\", \"time\": %s, \"status\": %d, \"client\": \"%s\", \"path\": \"%s\", \"agent\": %s}\n",
param.TimeStamp.Format(time.DateTime),
param.StatusCode,
Expand Down
2 changes: 1 addition & 1 deletion ingest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bluenviron/mediamtx:1.18.0 as mediamtx
FROM bluenviron/mediamtx:1.18.0 AS mediamtx


FROM alpine:3.23
Expand Down
3 changes: 2 additions & 1 deletion pkg/campus/campusonline/campusonline.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"net/http"
"regexp"

"golang.org/x/oauth2/clientcredentials"

genaccount "github.com/TUM-Dev/gocast/pkg/campus/campusonline/gen/account"
gencourse "github.com/TUM-Dev/gocast/pkg/campus/campusonline/gen/course"
"github.com/TUM-Dev/gocast/pkg/campus/model"
"golang.org/x/oauth2/clientcredentials"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.26 as builder
FROM golang:1.26 AS builder

WORKDIR /go/src/github.com/TUM-Dev/gocast/runner
COPY . .
Expand Down
2 changes: 2 additions & 0 deletions tools/template_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ func (e DebugTemplateExecutor) ExecuteTemplate(w io.Writer, name string, data in
t, err := template.New("base").Funcs(sprig.FuncMap()).ParseGlob(e.Patterns[0])
if err != nil {
logger.Error("Failed to load pattern: '"+e.Patterns[0], "err", err.Error())
return err
}

for i := 1; i < len(e.Patterns); i++ {
pattern := e.Patterns[i]
_, err := t.ParseGlob(pattern)
if err != nil {
logger.Error("Failed to load pattern: '"+pattern+"'.", "err", err.Error())
return err
}
}

Expand Down
2 changes: 1 addition & 1 deletion vod-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.26 as builder
FROM golang:1.26 AS builder

WORKDIR /app

Expand Down
8 changes: 6 additions & 2 deletions web/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (r mainRoutes) MainPage(c *gin.Context) {

if err := templateExecutor.ExecuteTemplate(c.Writer, "index.gohtml", indexData); err != nil {
logger.Error("Could not execute template: 'index.gohtml'", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)
}
Comment on lines 43 to 46
}

Expand All @@ -66,11 +67,14 @@ func (r mainRoutes) InfoPage(id uint, name string) gin.HandlerFunc {
c.AbortWithStatus(http.StatusInternalServerError)
return
}
_ = templateExecutor.ExecuteTemplate(c.Writer, "info-page.gohtml", struct {
if err := templateExecutor.ExecuteTemplate(c.Writer, "info-page.gohtml", struct {
IndexData
Text template.HTML
Name string
}{indexData, text.Render(), name})
}{indexData, text.Render(), name}); err != nil {
logger.Error("Could not execute template: 'info-page.gohtml'", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions web/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,26 @@ func (r mainRoutes) home(c *gin.Context) {
return
}
if isFresh {
_ = templateExecutor.ExecuteTemplate(c.Writer, "onboarding.gohtml", NewIndexData())
if err := templateExecutor.ExecuteTemplate(c.Writer, "onboarding.gohtml", NewIndexData()); err != nil {
logger.Error("Could not execute template: 'onboarding.gohtml'", "err", err)
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": "Failed to load page"})
}
Comment on lines +196 to +199
return
}

indexData := NewIndexDataWithContext(c)

if err := templateExecutor.ExecuteTemplate(c.Writer, "home.gohtml", indexData); err != nil {
logger.Error("Could not execute template: 'home.gohtml'", "err", err)
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": "Failed to load page"})
}
}

func (r mainRoutes) SearchPage(c *gin.Context) {
indexData := NewIndexDataWithContext(c)
if err := templateExecutor.ExecuteTemplate(c.Writer, "search-page.gohtml", indexData); err != nil {
logger.Error("Could not execute template: 'search.gohtml'", "err", err)
logger.Error("Could not execute template: 'search-page.gohtml'", "err", err)
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": "Failed to load page"})
}
}

Expand Down
3 changes: 2 additions & 1 deletion web/template/watch.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
<script defer src="/static/node_modules/katex/dist/contrib/copy-tex.min.js"></script>
{{end}}
</head>
<body x-data="{'streamID': {{$stream.Model.ID}}, seekLogger: new watch.SeekLogger('{{$stream.ID}}'), sidebar: $persist(watch.SidebarState.Hidden).as('sidebarState'), showShare: false, showShortcuts: false, transcriptAvailable: false}"
<body {{if $stream.LiveNow}}data-stream-start-time="{{$stream.Start.UnixMilli}}"{{end}}
x-data="{'streamID': {{$stream.Model.ID}}, seekLogger: new watch.SeekLogger('{{$stream.ID}}'), sidebar: $persist(watch.SidebarState.Hidden).as('sidebarState'), showShare: false, showShortcuts: false, transcriptAvailable: false}"
x-init="seekLogger.attach();">
{{template "header" .IndexData.TUMLiveContext}}
<div x-cloak x-show="showShortcuts"
Expand Down
12 changes: 10 additions & 2 deletions web/ts/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ export class BookmarkDialog {
}

reset(): void {
const player = getPlayers()[0];
const time = Time.FromSeconds(player.currentTime()).toObject();
let elapsedSeconds: number;
const streamStartAttr = document.body.dataset.streamStartTime;
if (streamStartAttr) {
const streamStart = parseInt(streamStartAttr, 10);
elapsedSeconds = Math.max(0, Math.floor((Date.now() - streamStart) / 1000));
} else {
elapsedSeconds = Math.floor(getPlayers()[0].currentTime());
Comment on lines +73 to +77
}

const time = Time.FromSeconds(elapsedSeconds).toObject();
this.request = {
StreamID: this.streamId,
Description: "",
Expand Down
8 changes: 4 additions & 4 deletions web/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ func (r mainRoutes) WatchPage(c *gin.Context) {
data.Description = template.HTML(data.IndexData.TUMLiveContext.Stream.GetDescriptionHTML())
}
if c.Query("video_only") == "1" {
err := templateExecutor.ExecuteTemplate(c.Writer, "video_only.gohtml", data)
if err != nil {
if err := templateExecutor.ExecuteTemplate(c.Writer, "video_only.gohtml", data); err != nil {
logger.Error("couldn't render template", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)
}
} else {
err := templateExecutor.ExecuteTemplate(c.Writer, "watch.gohtml", data)
if err != nil {
if err := templateExecutor.ExecuteTemplate(c.Writer, "watch.gohtml", data); err != nil {
logger.Error("couldn't render template", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)
Comment on lines +135 to +142
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion worker/edge/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.26 as builder
FROM golang:1.26 AS builder

WORKDIR /go/src/github.com/TUM-Dev/gocast/worker
COPY . .
Expand Down
Loading