Rename LK_JWT_PORT to LIVEKIT_JWT_PORT (#69)

This commit is contained in:
fkwp
2025-02-26 19:05:26 +01:00
committed by GitHub
parent c3d993de01
commit 0c0297247a
2 changed files with 8 additions and 8 deletions

14
main.go
View File

@@ -102,8 +102,8 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
return
} else if r.Method == "POST" {
var body SFURequest
err := json.NewDecoder(r.Body).Decode(&body)
var sfu_access_request SFURequest
err := json.NewDecoder(r.Body).Decode(&sfu_access_request)
if err != nil {
log.Printf("Error decoding JSON: %v", err)
w.WriteHeader(http.StatusBadRequest)
@@ -117,7 +117,7 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
return
}
if body.Room == "" {
if sfu_access_request.Room == "" {
log.Printf("Request missing room")
w.WriteHeader(http.StatusBadRequest)
err = json.NewEncoder(w).Encode(gomatrix.RespError{
@@ -132,7 +132,7 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
// TODO: we should be sanitising the input here before using it
// e.g. only allowing `https://` URL scheme
userInfo, err := exchangeOIDCToken(r.Context(), body.OpenIDToken, h.skipVerifyTLS)
userInfo, err := exchangeOIDCToken(r.Context(), sfu_access_request.OpenIDToken, h.skipVerifyTLS)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
err = json.NewEncoder(w).Encode(gomatrix.RespError{
@@ -148,7 +148,7 @@ func (h *Handler) handle(w http.ResponseWriter, r *http.Request) {
log.Printf("Got user info for %s", userInfo.Sub)
// TODO: is DeviceID required? If so then we should have validated at the start of the request processing
token, err := getJoinToken(h.key, h.secret, body.Room, userInfo.Sub+":"+body.DeviceID)
token, err := getJoinToken(h.key, h.secret, sfu_access_request.Room, userInfo.Sub+":"+sfu_access_request.DeviceID)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
err = json.NewEncoder(w).Encode(gomatrix.RespError{
@@ -201,12 +201,12 @@ func main() {
log.Fatal("LIVEKIT_KEY, LIVEKIT_SECRET and LIVEKIT_URL environment variables must be set")
}
lk_jwt_port := os.Getenv("LK_JWT_PORT")
lk_jwt_port := os.Getenv("LIVEKIT_JWT_PORT")
if lk_jwt_port == "" {
lk_jwt_port = "8080"
}
log.Printf("LIVEKIT_KEY: %s, LIVEKIT_SECRET: %s, LIVEKIT_URL: %s, LK_JWT_PORT: %s", key, secret, lk_url, lk_jwt_port)
log.Printf("LIVEKIT_KEY: %s, LIVEKIT_SECRET: %s, LIVEKIT_URL: %s, LIVEKIT_JWT_PORT: %s", key, secret, lk_url, lk_jwt_port)
handler := &Handler{
key: key,