From f35a37cea1aff1ef1933fae751b1123b346d2c19 Mon Sep 17 00:00:00 2001
From: Admin9705 <9705@duck.com>
Date: Sun, 1 Feb 2026 16:13:22 -0500
Subject: [PATCH] update
---
frontend/static/js/app.js | 7 +
.../features/requestarr/requestarr-content.js | 14 +
.../features/requestarr/requestarr-modal.js | 19 +-
.../requestarr/requestarr-settings.js | 38 ++-
.../js/modules/features/settings/core.js | 1 +
.../js/modules/features/settings/general.js | 10 +
.../utils/tmdb-image-cache-standalone.js | 281 +++++++++++++++++
.../js/modules/utils/tmdb-image-cache.js | 284 ++++++++++++++++++
frontend/templates/components/scripts.html | 3 +
src/primary/default_settings.py | 1 +
10 files changed, 652 insertions(+), 6 deletions(-)
create mode 100644 frontend/static/js/modules/utils/tmdb-image-cache-standalone.js
create mode 100644 frontend/static/js/modules/utils/tmdb-image-cache.js
diff --git a/frontend/static/js/app.js b/frontend/static/js/app.js
index 7ec7cd34..f3bd455f 100644
--- a/frontend/static/js/app.js
+++ b/frontend/static/js/app.js
@@ -2404,6 +2404,13 @@ let huntarrUI = {
// Initialize when document is ready
document.addEventListener('DOMContentLoaded', function() {
+ // Initialize TMDB image cache first
+ if (typeof tmdbImageCache !== 'undefined') {
+ tmdbImageCache.init().catch(error => {
+ console.error('[app.js] Failed to initialize TMDB image cache:', error);
+ });
+ }
+
huntarrUI.init();
// Initialize our enhanced UI features
diff --git a/frontend/static/js/modules/features/requestarr/requestarr-content.js b/frontend/static/js/modules/features/requestarr/requestarr-content.js
index cfbbab8e..3cf0c705 100644
--- a/frontend/static/js/modules/features/requestarr/requestarr-content.js
+++ b/frontend/static/js/modules/features/requestarr/requestarr-content.js
@@ -862,6 +862,20 @@ export class RequestarrContent {
`;
+ // Load and cache image asynchronously after card is created
+ if (posterUrl && !posterUrl.includes('./static/images/') && window.getCachedTMDBImage && window.tmdbImageCache) {
+ const imgElement = card.querySelector('.media-card-poster img');
+ if (imgElement) {
+ window.getCachedTMDBImage(posterUrl, window.tmdbImageCache).then(cachedUrl => {
+ if (cachedUrl && cachedUrl !== posterUrl) {
+ imgElement.src = cachedUrl;
+ }
+ }).catch(err => {
+ console.error('[RequestarrContent] Failed to cache image:', err);
+ });
+ }
+ }
+
const posterDiv = card.querySelector('.media-card-poster');
const requestBtn = card.querySelector('.media-card-request-btn');
const hideBtn = card.querySelector('.media-card-hide-btn');
diff --git a/frontend/static/js/modules/features/requestarr/requestarr-modal.js b/frontend/static/js/modules/features/requestarr/requestarr-modal.js
index e414bb32..35222e34 100644
--- a/frontend/static/js/modules/features/requestarr/requestarr-modal.js
+++ b/frontend/static/js/modules/features/requestarr/requestarr-modal.js
@@ -85,8 +85,10 @@ export class RequestarrModal {
finalDefault: defaultInstance
});
+ const backdropUrl = data.backdrop_path || '';
+
let modalHTML = `
-
`;
+ // Load and cache image asynchronously
+ if (posterUrl && !posterUrl.includes('./static/images/') && window.getCachedTMDBImage && window.tmdbImageCache) {
+ try {
+ const cachedUrl = await window.getCachedTMDBImage(posterUrl, window.tmdbImageCache);
+ if (cachedUrl && cachedUrl !== posterUrl) {
+ const imgElement = card.querySelector('.media-card-poster img');
+ if (imgElement) imgElement.src = cachedUrl;
+ }
+ } catch (err) {
+ console.error('[RequestarrSettings] Failed to cache hidden media image:', err);
+ }
+ }
+
const unhideBtn = card.querySelector('.media-card-unhide-btn');
if (unhideBtn) {
unhideBtn.addEventListener('click', async (e) => {
diff --git a/frontend/static/js/modules/features/settings/core.js b/frontend/static/js/modules/features/settings/core.js
index 064b7dbd..ab143654 100644
--- a/frontend/static/js/modules/features/settings/core.js
+++ b/frontend/static/js/modules/features/settings/core.js
@@ -757,6 +757,7 @@ window.SettingsForms = {
enable_requestarr: getVal('enable_requestarr', true),
low_usage_mode: getVal('low_usage_mode', true),
show_trending: getVal('show_trending', true),
+ tmdb_image_cache_days: parseInt(container.querySelector('#tmdb_image_cache_days')?.value || '7'),
auth_mode: (container.querySelector('#auth_mode') && container.querySelector('#auth_mode').value) || 'login',
ssl_verify: getVal('ssl_verify', true),
base_url: getVal('base_url', ''),
diff --git a/frontend/static/js/modules/features/settings/general.js b/frontend/static/js/modules/features/settings/general.js
index b055588d..6dfff1c6 100644
--- a/frontend/static/js/modules/features/settings/general.js
+++ b/frontend/static/js/modules/features/settings/general.js
@@ -246,6 +246,16 @@
box-shadow: 0 4px 12px rgba(90, 109, 137, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
">
Display Settings
+
+
+
+
Cache TMDB images to reduce load times and API usage. Missing images will still attempt to load. Set to "Disabled" to always fetch fresh images.
+