mirror of
https://gitlab.com/foxixus/neomovies-api.git
synced 2025-10-28 01:48:51 +05:00
feat(players): build Lumex URL as portal.lumex.host/api/short?api_token=...&kinopoisk_id=... (or imdb_id)
This commit is contained in:
@@ -160,20 +160,27 @@ func (h *PlayersHandler) GetLumexPlayer(w http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
log.Printf("Processing %s ID: %s", idType, id)
|
log.Printf("Processing %s ID: %s", idType, id)
|
||||||
|
|
||||||
if h.config.LumexURL == "" {
|
if h.config.LumexURL == "" {
|
||||||
log.Printf("Error: LUMEX_URL is missing")
|
log.Printf("Error: LUMEX_URL is missing")
|
||||||
http.Error(w, "Server misconfiguration: LUMEX_URL missing", http.StatusInternalServerError)
|
http.Error(w, "Server misconfiguration: LUMEX_URL missing", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var paramName string
|
// Формируем запрос вида: https://portal.lumex.host/api/short?api_token=...&kinopoisk_id=...
|
||||||
if idType == "kp" {
|
// Ожидается, что LUMEX_URL уже содержит базовый URL и api_token, например:
|
||||||
paramName = "kinopoisk_id"
|
// LUMEX_URL=https://portal.lumex.host/api/short?api_token=XXXX
|
||||||
} else {
|
var paramName string
|
||||||
paramName = "imdb_id"
|
if idType == "kp" {
|
||||||
}
|
paramName = "kinopoisk_id"
|
||||||
|
} else {
|
||||||
|
paramName = "imdb_id"
|
||||||
|
}
|
||||||
|
|
||||||
playerURL := fmt.Sprintf("%s?%s=%s", h.config.LumexURL, paramName, id)
|
separator := "&"
|
||||||
|
if !strings.Contains(h.config.LumexURL, "?") {
|
||||||
|
separator = "?"
|
||||||
|
}
|
||||||
|
playerURL := fmt.Sprintf("%s% s%s=%s", h.config.LumexURL, separator, paramName, id)
|
||||||
log.Printf("Lumex URL: %s", playerURL)
|
log.Printf("Lumex URL: %s", playerURL)
|
||||||
|
|
||||||
iframe := fmt.Sprintf(`<iframe src="%s" allowfullscreen loading="lazy" style="border:none;width:100%%;height:100%%;"></iframe>`, playerURL)
|
iframe := fmt.Sprintf(`<iframe src="%s" allowfullscreen loading="lazy" style="border:none;width:100%%;height:100%%;"></iframe>`, playerURL)
|
||||||
|
|||||||
Reference in New Issue
Block a user