From b72691fc626169c061a144663641bbd43f9f2ab5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 4 Oct 2025 21:36:15 +0000 Subject: [PATCH] feat: add advanced popup and redirect protection Multi-layered protection for English players: - Block window.open with immutable override - Prevent navigation when iframe is focused (beforeunload) - Stop event propagation on iframe clicks - Add overflow:hidden to prevent scrollbar exploits - Keep players functional while reducing popups Note: Some popups may still appear due to iframe cross-origin restrictions --- pkg/handlers/players.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/handlers/players.go b/pkg/handlers/players.go index e0d83aa..fd6091c 100644 --- a/pkg/handlers/players.go +++ b/pkg/handlers/players.go @@ -531,9 +531,9 @@ func (h *PlayersHandler) GetVidsrcPlayer(w http.ResponseWriter, r *http.Request) log.Printf("Generated Vidsrc URL: %s", playerURL) - // Блокировка всплывающих окон через JavaScript - iframe := fmt.Sprintf(``, playerURL) - htmlDoc := fmt.Sprintf(`Vidsrc Player%s`, iframe) + // Продвинутая защита от всплывающих окон и редиректов + iframe := fmt.Sprintf(``, playerURL) + htmlDoc := fmt.Sprintf(`Vidsrc Player%s`, iframe) w.Header().Set("Content-Type", "text/html") w.Write([]byte(htmlDoc)) @@ -557,9 +557,9 @@ func (h *PlayersHandler) GetVidlinkMoviePlayer(w http.ResponseWriter, r *http.Re log.Printf("Generated Vidlink Movie URL: %s", playerURL) - // Блокировка всплывающих окон через JavaScript - iframe := fmt.Sprintf(``, playerURL) - htmlDoc := fmt.Sprintf(`Vidlink Player%s`, iframe) + // Продвинутая защита от всплывающих окон и редиректов + iframe := fmt.Sprintf(``, playerURL) + htmlDoc := fmt.Sprintf(`Vidlink Player%s`, iframe) w.Header().Set("Content-Type", "text/html") w.Write([]byte(htmlDoc)) @@ -590,9 +590,9 @@ func (h *PlayersHandler) GetVidlinkTVPlayer(w http.ResponseWriter, r *http.Reque log.Printf("Generated Vidlink TV URL: %s", playerURL) - // Блокировка всплывающих окон через JavaScript - iframe := fmt.Sprintf(``, playerURL) - htmlDoc := fmt.Sprintf(`Vidlink Player%s`, iframe) + // Продвинутая защита от всплывающих окон и редиректов + iframe := fmt.Sprintf(``, playerURL) + htmlDoc := fmt.Sprintf(`Vidlink Player%s`, iframe) w.Header().Set("Content-Type", "text/html") w.Write([]byte(htmlDoc))