🐛 Bug fixes of Video/Audio Call

This commit is contained in:
2024-04-06 17:28:21 +08:00
parent eaf074609e
commit 476466f8c6
4 changed files with 11 additions and 5 deletions

View File

@ -137,7 +137,12 @@ func exchangeCallToken(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"token": tk,
"endpoint": viper.GetString("meeting.endpoint"),
"full_url": fmt.Sprintf("%s?jwt=%s", viper.GetString("meeting.endpoint"), url.QueryEscape(tk)),
"full_url": fmt.Sprintf(
"%s/%s?jwt=%s",
viper.GetString("meeting.endpoint"),
call.ExternalID,
url.QueryEscape(tk),
),
})
}
}

View File

@ -99,7 +99,7 @@ func NewServer() {
channels.Get("/:channel/calls", listCall)
channels.Get("/:channel/calls/ongoing", getOngoingCall)
channels.Post("/:channel/calls", authMiddleware, startCall)
channels.Delete("/:channel/calls", authMiddleware, endCall)
channels.Delete("/:channel/calls/ongoing", authMiddleware, endCall)
channels.Post("/:channel/calls/ongoing/token", authMiddleware, exchangeCallToken)
}

View File

@ -129,7 +129,8 @@ func EndCall(call models.Call) (models.Call, error) {
}
func EncodeCallToken(call models.Call, user models.Account) (string, error) {
tk := jwt.NewWithClaims(jwt.SigningMethodHS512, jwt.MapClaims{
// Jitsi requires HS256 as algorithm, so we cannot use HS512
tk := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"context": jwt.MapClaims{
"user": jwt.MapClaims{
"avatar": user.Avatar,