Do not require create permission for WHIP participant. (#3715)

This commit is contained in:
Raja Subramanian
2025-06-09 22:19:00 -07:00
committed by GitHub
parent e0aea17a06
commit 1d9a43667a
+3 -5
View File
@@ -91,7 +91,6 @@ func (s *RTCRestService) handleGet(w http.ResponseWriter, r *http.Request) {
}
func (s *RTCRestService) handleOptions(w http.ResponseWriter, r *http.Request) {
logger.Infow("RAJA got here to options", "req", r) // REMOVE
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Allow-Methods", "PATCH, OPTIONS, GET, POST, DELETE")
@@ -124,10 +123,6 @@ func (s *RTCRestService) validateCreate(r *http.Request) (*createRequest, int, e
return nil, http.StatusUnauthorized, rtc.ErrPermissionDenied
}
if err := EnsureCreatePermission(r.Context()); err != nil {
return nil, http.StatusUnauthorized, err
}
roomName, err := EnsureJoinPermission(r.Context())
if err != nil {
return nil, http.StatusUnauthorized, err
@@ -161,6 +156,9 @@ func (s *RTCRestService) validateCreate(r *http.Request) (*createRequest, int, e
if err != nil {
return nil, http.StatusBadRequest, fmt.Errorf("body does not have SDP offer: %s", err)
}
if len(offerSDPBytes) == 0 {
return nil, http.StatusBadRequest, errors.New("body does not have SDP offer")
}
offerSDP := string(offerSDPBytes)
sd := &webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,