Allow clientId to be specified in query params

This commit is contained in:
Zoe Roux
2025-10-13 19:10:23 +02:00
parent b7c6ba1e85
commit a7d5f94dfb
7 changed files with 25 additions and 21 deletions
+5 -2
View File
@@ -217,9 +217,12 @@ func (h *shandler) GetAudioSegment(c echo.Context) error {
}
func getClientId(c echo.Context) (string, error) {
key := c.Request().Header.Get("X-CLIENT-ID")
key := c.QueryParam("clientId")
if key == "" {
return "", echo.NewHTTPError(http.StatusBadRequest, "missing client id. Please specify the X-CLIENT-ID header to a guid constant for the lifetime of the player (but unique per instance)")
key = c.Request().Header.Get("X-CLIENT-ID")
}
if key == "" {
return "", echo.NewHTTPError(http.StatusBadRequest, "missing client id. Please specify the X-CLIENT-ID header (or the clientId query param) to a guid constant for the lifetime of the player (but unique per instance)")
}
return key, nil
}