feat: Update player API to use id_type in path

All Russian players now use format: /players/{player}/{id_type}/{id}
- id_type can be kp (Kinopoisk) or imdb
- Alloha, Lumex, Vibix, HDVB support both ID types
- Added validation for id_type parameter
- Updated handlers to parse id_type from path
This commit is contained in:
2025-10-18 20:21:13 +00:00
parent 43ca411897
commit b5d9f3c57d
12 changed files with 835 additions and 85 deletions

View File

@@ -39,7 +39,6 @@ func (h *DocsHandler) GetOpenAPISpec(w http.ResponseWriter, r *http.Request) {
func (h *DocsHandler) ServeDocs(w http.ResponseWriter, r *http.Request) {
baseURL := determineBaseURL(r)
// Use absolute SpecURL so the library does not try to read a local file path
htmlContent, err := scalar.ApiReferenceHTML(&scalar.Options{
SpecURL: fmt.Sprintf("%s/openapi.json", baseURL),
CustomOptions: scalar.CustomOptions{
@@ -56,6 +55,7 @@ func (h *DocsHandler) ServeDocs(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
fmt.Fprintln(w, htmlContent)
}