refactor: split playback proxy logic into separate handler files
This commit is contained in:
23
internal/playback/handler/proxy_token.go
Normal file
23
internal/playback/handler/proxy_token.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (h *PlaybackHandler) resolveProxyRequestTarget(c *gin.Context, scope string) (string, string, bool) {
|
||||
token := c.Query("token")
|
||||
if token == "" {
|
||||
c.Status(http.StatusBadRequest)
|
||||
return "", "", false
|
||||
}
|
||||
|
||||
targetURL, referer, err := h.svc.ResolveProxyToken(token, scope)
|
||||
if err != nil {
|
||||
c.Status(http.StatusForbidden)
|
||||
return "", "", false
|
||||
}
|
||||
|
||||
return targetURL, referer, true
|
||||
}
|
||||
Reference in New Issue
Block a user