Skip to content

Commit

Permalink
Merge branch 'dev' into feat/playlist-scroll-pos
Browse files Browse the repository at this point in the history
  • Loading branch information
mono424 committed Sep 21, 2023
2 parents ff3563f + 95b124e commit 2e8ced8
Show file tree
Hide file tree
Showing 285 changed files with 6,555 additions and 4,514 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/deploy-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
tags:
- '*'

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,7 +19,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/joschahenningsen/tum-live/tum-live
images: ghcr.io/tum-dev/gocast/tum-live
tags: |
type=ref,event=branch
type=ref,event=pr
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/deploy-workers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
tags:
- '*'

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -24,11 +27,16 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/joschahenningsen/tum-live/${{ env.containername }}
images: ghcr.io/tum-dev/gocast/${{ env.containername }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
flavor: |
latest=true
prefix=
suffix=
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ts-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
# The branches below must be a subset of the branches above
branches: [ dev ]

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -20,7 +23,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/joschahenningsen/tum-live/test-server
images: ghcr.io/tum-dev/gocast/test-server
tags: |
type=sha
flavor: |
Expand All @@ -46,7 +49,7 @@ jobs:
id: metaWorker
uses: docker/metadata-action@v4
with:
images: ghcr.io/joschahenningsen/tum-live/test-worker
images: ghcr.io/tum-dev/gocast/test-worker
tags: |
type=sha
flavor: |
Expand Down
2 changes: 1 addition & 1 deletion .idea/runConfigurations/TUM_Live__frontend__worker.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/runConfigurations/run_production.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/run_tumlive_go.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN rm -rf web/assets/ts-dist &&\
WORKDIR /app/web
RUN npm i --no-dev

FROM golang:1.20-alpine3.17 as build-env
FROM golang:1.21-alpine3.18 as build-env

RUN mkdir /gostuff
WORKDIR /gostuff
Expand Down
6 changes: 3 additions & 3 deletions api/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"gorm.io/gorm"
"net/http"
)
Expand Down
10 changes: 5 additions & 5 deletions api/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/mock_dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/testutils"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/matthiasreumann/gomino"
"net/http"
"testing"
Expand Down
6 changes: 3 additions & 3 deletions api/bookmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"gorm.io/gorm"
"net/http"
"strconv"
Expand Down
10 changes: 5 additions & 5 deletions api/bookmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/mock_dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/testutils"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/matthiasreumann/gomino"
"gorm.io/gorm"
"net/http"
Expand Down
41 changes: 25 additions & 16 deletions api/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (

"gorm.io/gorm"

"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/realtime"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/realtime"

"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
Expand All @@ -36,6 +36,12 @@ var allowedReactions = map[string]struct{}{
"eyes": {},
}

const (
POLL_START_MSG = "start_poll"
POLL_CLOSE_MSG = "close_active_poll"
POLL_PARTICIPATION_MSG = "submit_poll_option_vote"
)

var routes chatRoutes

func RegisterRealtimeChatChannel() {
Expand Down Expand Up @@ -130,6 +136,7 @@ func (r chatRoutes) handleSubmitPollOptionVote(ctx tools.TUMLiveContext, msg []b
voteCount, _ := r.ChatDao.GetPollOptionVoteCount(req.PollOptionId)

voteUpdateMap := gin.H{
"type": POLL_PARTICIPATION_MSG,
"pollOptionId": req.PollOptionId,
"votes": voteCount,
}
Expand Down Expand Up @@ -191,10 +198,11 @@ func (r chatRoutes) handleStartPoll(ctx tools.TUMLiveContext, msg []byte) {
}

pollMap := gin.H{
"active": true,
"question": poll.Question,
"pollOptions": pollOptionsJson,
"submitted": 0,
"type": POLL_START_MSG,
"active": true,
"question": poll.Question,
"options": pollOptionsJson,
"submitted": 0,
}
if pollJson, err := json.Marshal(pollMap); err == nil {
broadcastStream(ctx.Stream.ID, pollJson)
Expand Down Expand Up @@ -222,8 +230,9 @@ func (r chatRoutes) handleCloseActivePoll(ctx tools.TUMLiveContext) {
}

statsMap := gin.H{
"question": poll.Question,
"pollOptionResults": pollOptions,
"type": POLL_CLOSE_MSG,
"question": poll.Question,
"options": pollOptions,
}

if statsJson, err := json.Marshal(statsMap); err == nil {
Expand Down Expand Up @@ -397,10 +406,10 @@ func (r chatRoutes) handleRetract(ctx tools.TUMLiveContext, msg []byte) {
func (r chatRoutes) handleMessage(ctx tools.TUMLiveContext, context *realtime.Context, msg []byte) {
var chat chatReq
if err := json.Unmarshal(msg, &chat); err != nil {
log.WithError(err).Error("error unmarshaling chat message")
log.WithError(err).Error("error unmarshalling chat message")
return
}
if !ctx.Course.ChatEnabled {
if !ctx.Course.ChatEnabled && !ctx.Stream.ChatEnabled {
return
}
uname := ctx.User.GetPreferredName()
Expand Down Expand Up @@ -577,10 +586,10 @@ func (r chatRoutes) getActivePoll(c *gin.Context) {
}

c.JSON(http.StatusOK, gin.H{
"active": true,
"question": poll.Question,
"pollOptions": pollOptions,
"submitted": submitted,
"active": true,
"question": poll.Question,
"options": pollOptions,
"submitted": submitted,
})
}

Expand Down
18 changes: 9 additions & 9 deletions api/chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (

"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/mock_dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/testutils"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/matthiasreumann/gomino"
"gorm.io/gorm"
)
Expand Down Expand Up @@ -99,10 +99,10 @@ func TestActivePoll(t *testing.T) {
}

res := gin.H{
"active": true,
"question": testutils.PollStreamFPVLive.Question,
"pollOptions": pollOptions,
"submitted": submitted,
"active": true,
"question": testutils.PollStreamFPVLive.Question,
"options": pollOptions,
"submitted": submitted,
}

gomino.TestCases{
Expand Down
6 changes: 3 additions & 3 deletions api/courseimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
campusonline "github.com/RBG-TUM/CAMPUSOnline"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/tum"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/tum"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"html/template"
Expand Down
20 changes: 16 additions & 4 deletions api/courses.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"errors"
"fmt"
"github.com/RBG-TUM/commons"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/tum"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/tum"
"github.com/meilisearch/meilisearch-go"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -61,6 +61,7 @@ func configGinCourseRouter(router *gin.Engine, daoWrapper dao.DaoWrapper) {
courses.Use(tools.InitCourse(daoWrapper))
courses.Use(tools.AdminOfCourse)
courses.DELETE("/", routes.deleteCourse)
courses.GET("/lectures", routes.fetchLectures)
courses.POST("/createVOD", routes.createVOD)
courses.POST("/uploadVODMedia", routes.uploadVODMedia)
courses.POST("/copy", routes.copyCourse)
Expand Down Expand Up @@ -1038,6 +1039,17 @@ func (r coursesRoutes) renameLecture(c *gin.Context) {
}
}

func (r coursesRoutes) fetchLectures(c *gin.Context) {
tlctx := c.MustGet("TUMLiveContext").(tools.TUMLiveContext)

lectureHalls := r.LectureHallsDao.GetAllLectureHalls()
streams := tlctx.Course.AdminJson(lectureHalls)

c.JSON(http.StatusOK, gin.H{
"streams": streams,
})
}

func (r coursesRoutes) updateLectureSeries(c *gin.Context) {
stream, err := r.StreamsDao.GetStreamByID(context.Background(), c.Param("streamID"))
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions api/courses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"github.com/dgraph-io/ristretto"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/mock_dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/testutils"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/mock_dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/TUM-Dev/gocast/tools/testutils"
"github.com/matthiasreumann/gomino"
"github.com/u2takey/go-utils/uuid"
"gorm.io/gorm"
Expand Down
6 changes: 3 additions & 3 deletions api/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
log "github.com/sirupsen/logrus"
"net/http"
"os"
Expand Down
6 changes: 3 additions & 3 deletions api/download_ics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package api

import (
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
log "github.com/sirupsen/logrus"
"html/template"
"net/http"
Expand Down
Loading

0 comments on commit 2e8ced8

Please sign in to comment.