@@ -151,11 +151,14 @@ function renderVodGrid() {
151151 const displayGroup = item . group || 'Uncategorized' ;
152152 const displayLogo = item . logo || placeholderImageUrl ;
153153
154+ // Use image proxy for both HTTP and HTTPS posters to avoid mixed content warnings
155+ const proxiedLogo = displayLogo . startsWith ( 'http' ) ? `/api/image-proxy?url=${ encodeURIComponent ( displayLogo ) } ` : displayLogo ;
156+
154157 return `
155158 <div class="vod-item" data-id="${ itemIdStr } ">
156159 <span class="vod-type-badge">${ itemType } </span>
157160 <div class="vod-item-poster">
158- <img src="${ displayLogo } "
161+ <img src="${ proxiedLogo } "
159162 alt="${ displayName . replace ( / " / g, '"' ) } "
160163 onerror="this.onerror=null; this.src='${ placeholderImageUrl } '; this.style.objectFit='cover';">
161164 </div>
@@ -182,10 +185,15 @@ function renderVodGrid() {
182185async function openVodDetails ( item ) { // Make the function async
183186 if ( ! item ) return ;
184187
185- // --- Common Fields (No Change ) ---
188+ // --- Common Fields (with image proxy ) ---
186189 UIElements . vodDetailsTitle . textContent = item . name ;
187- UIElements . vodDetailsPoster . src = item . logo || `https://placehold.co/400x600/1f2937/d1d5db?text=${ encodeURIComponent ( item . name ) } ` ;
188- UIElements . vodDetailsBackdropImg . src = item . logo || '' ;
190+
191+ // Use image proxy for modal posters/backdrops
192+ const posterUrl = item . logo || `https://placehold.co/400x600/1f2937/d1d5db?text=${ encodeURIComponent ( item . name ) } ` ;
193+ const proxiedPoster = posterUrl . startsWith ( 'http' ) ? `/api/image-proxy?url=${ encodeURIComponent ( posterUrl ) } ` : posterUrl ;
194+ UIElements . vodDetailsPoster . src = proxiedPoster ;
195+ UIElements . vodDetailsBackdropImg . src = item . logo ? proxiedPoster : '' ;
196+
189197 UIElements . vodDetailsYear . textContent = item . year || '' ;
190198 UIElements . vodDetailsRating . textContent = '' ; // Placeholder
191199 UIElements . vodDetailsDuration . textContent = '' ; // Placeholder
@@ -216,7 +224,7 @@ async function openVodDetails(item) { // Make the function async
216224 closeModal ( UIElements . vodDetailsModal ) ;
217225 } ;
218226
219- // --- Series Logic (Lazy Loading) ---
227+ // --- Series Logic (Lazy Loading) ---
220228 } else if ( item . type === 'series' ) {
221229 UIElements . vodDetailsType . textContent = 'Series' ;
222230 UIElements . vodDetailsSeriesActions . classList . remove ( 'hidden' ) ; // Show series section immediately
@@ -335,7 +343,7 @@ function setupVodEventListeners() {
335343 clearTimeout ( vodState . searchDebounce ) ;
336344 vodState . searchDebounce = setTimeout ( renderVodGrid , 300 ) ;
337345 } ) ;
338-
346+
339347 UIElements . vodDirectPlayCheckbox . addEventListener ( 'change' , ( ) => {
340348 const isEnabled = UIElements . vodDirectPlayCheckbox . checked ;
341349 guideState . settings . vodDirectPlayEnabled = isEnabled ;
@@ -353,7 +361,7 @@ function setupVodEventListeners() {
353361 // Listener for page size change is initially attached here and re-attached on render
354362 const pageSizeSelect = paginationContainer . querySelector ( '#vod-page-size-select' ) ;
355363 if ( pageSizeSelect ) {
356- pageSizeSelect . addEventListener ( 'change' , changeVodPageSize ) ;
364+ pageSizeSelect . addEventListener ( 'change' , changeVodPageSize ) ;
357365 }
358366 }
359367
@@ -434,7 +442,7 @@ function renderVodPaginationControls() {
434442 }
435443
436444 if ( totalPages > 1 ) {
437- pagesHTML += `<li><button class="pagination-btn page-number-btn ${ totalPages === currentPage ? 'active' : '' } " data-page="${ totalPages } ">${ totalPages } </button></li>` ;
445+ pagesHTML += `<li><button class="pagination-btn page-number-btn ${ totalPages === currentPage ? 'active' : '' } " data-page="${ totalPages } ">${ totalPages } </button></li>` ;
438446 }
439447
440448
@@ -469,19 +477,19 @@ function renderVodPaginationControls() {
469477 const paginationPages = controlsContainer . querySelector ( '#vod-pagination-pages' ) ;
470478 if ( paginationPages ) {
471479 paginationPages . addEventListener ( 'click' , ( e ) => {
472- const button = e . target . closest ( 'button' ) ;
473- if ( ! button || button . disabled ) return ;
474-
475- if ( button . classList . contains ( 'prev-page-btn' ) ) {
476- goToVodPage ( vodState . pagination . currentPage - 1 ) ;
477- } else if ( button . classList . contains ( 'next-page-btn' ) ) {
478- goToVodPage ( vodState . pagination . currentPage + 1 ) ;
479- } else if ( button . classList . contains ( 'page-number-btn' ) ) {
480- const pageNum = parseInt ( button . dataset . page , 10 ) ;
481- if ( pageNum ) {
482- goToVodPage ( pageNum ) ;
483- }
484- }
480+ const button = e . target . closest ( 'button' ) ;
481+ if ( ! button || button . disabled ) return ;
482+
483+ if ( button . classList . contains ( 'prev-page-btn' ) ) {
484+ goToVodPage ( vodState . pagination . currentPage - 1 ) ;
485+ } else if ( button . classList . contains ( 'next-page-btn' ) ) {
486+ goToVodPage ( vodState . pagination . currentPage + 1 ) ;
487+ } else if ( button . classList . contains ( 'page-number-btn' ) ) {
488+ const pageNum = parseInt ( button . dataset . page , 10 ) ;
489+ if ( pageNum ) {
490+ goToVodPage ( pageNum ) ;
491+ }
492+ }
485493 } ) ;
486494 }
487495}
0 commit comments