🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Fixed expired JWT
sassanix75cc074260a0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cc1644f..f1c2497 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,17 @@# Changelog-## 1.0.3 - 2026-03-29+## 1.0.3 - 2026-05-18++### Fixed+- **Expired JWT Broken UI State:** Fixed critical issue where users returning to the app after their JWT expired would see a broken, empty UI instead of being redirected to login.+ - **Root Cause:** `auth-redirect.js` only checked for the *presence* of `auth_token` in localStorage, not its validity. An expired token was treated as authenticated, causing the UI to render with stale cached data while API calls returned 401.+ - **Solution:** Updated `auth-redirect.js` to synchronously decode the JWT payload and verify the `exp` claim before allowing protected pages to load. Expired or malformed tokens are automatically cleared from localStorage and the user is redirected to login.+ - Added OIDC SSO bypass for `auth-redirect.html` to prevent redirect loops during SSO token processing.+ - _Files: `frontend/auth-redirect.js`, `frontend/sw.js`, `frontend/index.html`, `frontend/status.html`, `frontend/settings-new.html`, `frontend/login.html`, `frontend/register.html`, `frontend/auth-redirect.html`_++- **Docker Build Failure (Stale Package Versions):** Fixed Dockerfile failing to build due to outdated pinned Debian package versions.+ - **Root Cause:** Exact version pins for Debian Trixie packages became stale after security updates (e.g., `libcurl4` renamed to `libcurl4t64`, versions bumped with `+deb13u3` suffix).+ - **Solution:** Removed brittle version pins from `apt-get install` commands. Reproducibility is maintained via the SHA-pinned base image digest.+ - _Files: `Dockerfile`_### Enhanced- **Frontend Architecture Refactoring:** Migrated frontend JavaScript from monolithic `script.js` to modular ES modules for improved maintainability and code organization.@@ -27,6 +39,16 @@- _Files: `frontend/js/components/paperless.js`, `frontend/script.js`, `frontend/style.css`_### Fixed+- **Paperless-ngx Document Browse in Add Warranty Wizard:** Fixed bug where browsing and selecting an existing Paperless-ngx document during new warranty creation would silently fail to attach the document.+ - **Root Cause:** The modular `paperless.js` (loaded as an ES module after `script.js`) was overriding the working legacy Paperless browser functions with broken versions that used a non-existent API endpoint (`/api/paperless/documents` instead of `/api/paperless/search`), targeted a non-existent DOM container (`#paperlessDocumentsContainer` instead of `#paperlessDocumentsList`), and failed to dynamically create hidden inputs to store the selected document ID.+ - **Solution:** Fixed the modular `openPaperlessBrowser`, `fetchPaperlessDocuments`, `selectPaperlessDocument`, and related functions to use the correct API endpoint, DOM element IDs, pagination controls, and to dynamically create hidden inputs when a document is selected. Also added Paperless browse selection support to the edit warranty modal (`editModal.js`).+ - _Files: `frontend/js/components/paperless.js`, `frontend/js/components/addWarrantyForm.js`, `frontend/js/components/editModal.js`_++- **Warranty Card Invoice Label:** Fixed warranty card document link displaying "Invoice/Receipt" instead of just "Invoice".+ - **Root Cause:** `warrantyRenderer.js` was using the `warranties.invoice_receipt` translation key (full form label) instead of the `warranties.invoice_receipt_short` key intended for card display.+ - **Solution:** Changed the translation key to `warranties.invoice_receipt_short`.+ - _Files: `frontend/js/components/warrantyRenderer.js`_+- **Paperless-ngx File Upload:** Fixed critical bug where files selected for Paperless-ngx storage were incorrectly uploaded locally instead.- **Root Cause:** The `getStorageOption()` function was generating incorrect radio button names for the add warranty form (`InvoiceStorage` instead of `invoiceStorage`), causing the storage selection to default to 'local'.- **Solution:** Corrected the function to use lowercase names for add form (`invoiceStorage`, `manualStorage`) and camelCase for edit form (`editInvoiceStorage`, `editManualStorage`).@@ -65,6 +87,16 @@- Added keys: `filters.filter`, `filters.filter_by`, `filters.clear`, `filters.apply`, `filters.sort`, `warranties.archived`, `actions.data`, `warranties.or_link_to_invoice_url`, `warranties.or_link_to_manual_url`, `warranties.or_link_to_files_url`, `warranties.enter_serial_number`, `warranties.add_serial_number`.- _Files: `locales/en/translation.json`_+- **Missing `actions.view` Translation Key:** Fixed edit modal showing raw key `actions.view` instead of "View" for document preview links.+ - **Root Cause:** The `actions.view` key was absent from the `actions` section in all 20 locale files. `editModal.js` called `i18n.t('actions.view')` without a `defaultValue`, so when the key was missing i18next returned the key path string instead of a human-readable fallback.+ - **Solution:** Added `"view"` to the `actions` section of all 20 locale files with the appropriate native translation for each language. Also updated all 7 call sites in `editModal.js` to use `{ defaultValue: 'View' }` so missing keys always fall back gracefully.+ - _Files: `frontend/js/components/editModal.js`, `locales/*/translation.json` (all 20 locales)_++- **Service Worker Caching JS Files Indefinitely:** Fixed JS module updates (e.g. `editModal.js`, `warrantyRenderer.js`) not being picked up by returning users even after a Docker rebuild.+ - **Root Cause:** The service worker used a cache-first strategy for all request types including scripts. Once a JS file was stored in the SW cache it was served directly from there, completely bypassing nginx — making nginx cache headers irrelevant and preventing code updates from reaching users until the `CACHE_NAME` was manually bumped.+ - **Solution:** Changed the SW fetch handler to use a **network-first** strategy for all script requests (falling back to cache only when offline) and kept cache-first only for non-code assets (images, fonts, CSS, HTML). Also updated nginx to serve `.js` files with `Cache-Control: no-cache, must-revalidate` so the browser always revalidates JS on each visit.+ - _Files: `frontend/sw.js`, `nginx.conf`_+## 1.0.2 - 2025-10-30### Addeddiff --git a/Dockerfile b/Dockerfileindex 17df14a..58bd71b 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,48 +1,15 @@# syntax=docker/dockerfile:1.19.0@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6-# renovate: datasource=deb depName=build-essential-ARG BUILD_ESSENTIAL_VERSION=12.12-# renovate: datasource=deb depName=libpq-dev-ARG LIBPQ_DEV_VERSION=17.6-0+deb13u1-# renovate: datasource=deb depName=libcurl4-openssl-dev-ARG LIBCURL4_OPENSSL_DEV_VERSION=8.14.1-2-# renovate: datasource=deb depName=libssl-dev-ARG LIBSSL_DEV_VERSION=3.5.1-1+deb13u1-# renovate: datasource=deb depName=pkg-config-ARG PKG_CONFIG_VERSION=1.8.1-4-# renovate: datasource=deb depName=nginx-ARG NGINX_VERSION=1.26.3-3+deb13u1-# renovate: datasource=deb depName=supervisor-ARG SUPERVISOR_VERSION=4.2.5-3-# renovate: datasource=deb depName=postgresql-client-ARG POSTGRESQL_CLIENT_VERSION=17+278-# renovate: datasource=deb depName=gettext-base-ARG GETTEXT_BASE_VERSION=0.23.1-2-# renovate: datasource=deb depName=curl-ARG CURL_VERSION=8.14.1-2-# renovate: datasource=deb depName=ca-certificates-ARG CA_CERTIFICATES_VERSION=20250419-# renovate: datasource=deb depName=libpq5-ARG LIBPQ5_VERSION=17.6-0+deb13u1-# renovate: datasource=deb depName=libssl3t64-ARG LIBSSL3T64_VERSION=3.5.1-1+deb13u1-FROM python:3.13-slim-trixie@sha256:079601253d5d25ae095110937ea8cfd7403917b53b077870bccd8b026dc7c42f AS builder-ARG BUILD_ESSENTIAL_VERSION-ARG LIBPQ_DEV_VERSION-ARG LIBCURL4_OPENSSL_DEV_VERSION-ARG LIBSSL_DEV_VERSION-ARG PKG_CONFIG_VERSION-# Install build tools (only in builder stage)RUN apt-get update && \apt-get install -y --no-install-recommends \- build-essential=${BUILD_ESSENTIAL_VERSION} \- libpq-dev=${LIBPQ_DEV_VERSION} \- libcurl4-openssl-dev=${LIBCURL4_OPENSSL_DEV_VERSION} \- libssl-dev=${LIBSSL_DEV_VERSION} \- pkg-config=${PKG_CONFIG_VERSION} && \+ build-essential \+ libpq-dev \+ libcurl4-openssl-dev \+ libssl-dev \+ pkg-config && \apt-get clean && \rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*@@ -56,16 +23,6 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txtFROM python:3.13-slim-trixie@sha256:079601253d5d25ae095110937ea8cfd7403917b53b077870bccd8b026dc7c42f AS runtime-ARG NGINX_VERSION-ARG SUPERVISOR_VERSION-ARG POSTGRESQL_CLIENT_VERSION-ARG GETTEXT_BASE_VERSION-ARG CURL_VERSION-ARG CA_CERTIFICATES_VERSION-ARG LIBPQ5_VERSION-ARG LIBCURL4_OPENSSL_DEV_VERSION-ARG LIBSSL3T64_VERSION-# Metadata for final imageLABEL org.opencontainers.image.source="https://github.com/sassanix/Warracker"LABEL org.opencontainers.image.description="Warracker - Warranty Tracker"@@ -73,15 +30,15 @@ LABEL org.opencontainers.image.description="Warracker - Warranty Tracker"# Install runtime dependencies onlyRUN apt-get update && \apt-get install -y --no-install-recommends \- nginx=${NGINX_VERSION} \- supervisor=${SUPERVISOR_VERSION} \- postgresql-client=${POSTGRESQL_CLIENT_VERSION} \- gettext-base=${GETTEXT_BASE_VERSION} \- curl=${CURL_VERSION} \- ca-certificates=${CA_CERTIFICATES_VERSION} \- libpq5=${LIBPQ5_VERSION} \- libcurl4=${LIBCURL4_OPENSSL_DEV_VERSION} \- libssl3t64=${LIBSSL3T64_VERSION} && \+ nginx \+ supervisor \+ postgresql-client \+ gettext-base \+ curl \+ ca-certificates \+ libpq5 \+ libcurl4t64 \+ libssl3t64 && \apt-get clean && \rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*diff --git a/frontend/auth-redirect.html b/frontend/auth-redirect.htmlindex a52b3c8..90ced1a 100644--- a/frontend/auth-redirect.html+++ b/frontend/auth-redirect.html@@ -166,7 +166,7 @@<!-- i18n Configuration --><script src="js/i18n.js?v=20250119001"></script>- <script src="auth-redirect.js?v=20250119001"></script>+ <script src="auth-redirect.js?v=20260518001"></script><!-- Footer Width Fix --><script src="footer-fix.js?v=20251024001"></script>diff --git a/frontend/auth-redirect.js b/frontend/auth-redirect.jsindex da9fd43..ed78518 100644--- a/frontend/auth-redirect.js+++ b/frontend/auth-redirect.js@@ -17,15 +17,64 @@// Wait for DOM to be ready enough to execute scriptconst executeRedirect = () => {try {+ const currentPath = window.location.pathname;++ // Skip redirect logic on auth-redirect.html to allow token processing for OIDC SSO+ if (currentPath.includes('auth-redirect.html')) {+ console.log('On auth-redirect.html, skipping redirect logic to allow token processing');+ return;+ }+// Get current script elementconst currentScript = document.currentScript;// Check if isProtected attribute is set- const isProtected = currentScript.getAttribute('data-protected') === 'true';+ const isProtected = currentScript && currentScript.getAttribute('data-protected') === 'true';// Check authentication status- const isAuthenticated = !!localStorage.getItem('auth_token');- const currentPath = window.location.pathname;+ const token = localStorage.getItem('auth_token');+ let isAuthenticated = false;++ if (token) {+ try {+ const parts = token.split('.');+ if (parts.length === 3) {+ let base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');+ // Add padding if missing+ const pad = base64.length % 4;+ if (pad) {+ if (pad === 1) throw new Error('Invalid base64 string');+ base64 += new Array(5 - pad).join('=');+ }+ // Decode base64 to UTF-8 string safely+ const jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);+ }).join(''));+ const payload = JSON.parse(jsonPayload);++ if (payload.exp) {+ const currentTime = Math.floor(Date.now() / 1000);+ if (payload.exp > currentTime) {+ isAuthenticated = true;+ } else {+ console.log('Token expired, clearing auth data');+ localStorage.removeItem('auth_token');+ localStorage.removeItem('user_info');+ }+ } else {+ isAuthenticated = true;+ }+ } else {+ // Invalid token format+ localStorage.removeItem('auth_token');+ localStorage.removeItem('user_info');+ }+ } catch (e) {+ console.error('Error decoding token:', e);+ localStorage.removeItem('auth_token');+ localStorage.removeItem('user_info');+ }+ }console.log('Auth redirect check - Protected page:', isProtected);console.log('Auth redirect check - Is authenticated:', isAuthenticated);@@ -53,4 +102,4 @@// Execute immediatelyexecuteRedirect();-})();\ No newline at end of file+})();diff --git a/frontend/index.html b/frontend/index.htmlindex f67e0b3..4967d09 100644--- a/frontend/index.html+++ b/frontend/index.html@@ -2,7 +2,7 @@<html><head><!-- Authentication redirect script -->- <script src="auth-redirect.js?v=20250119001" data-protected="true"></script>+ <script src="auth-redirect.js?v=20260518001" data-protected="true"></script><!-- Include authentication script first to handle login state immediately --><script src="include-auth-new.js?v=20250119001"></script>@@ -545,7 +545,7 @@</div><div class="form-group">- <label data-i18n="warranties.invoice_receipt">Invoice/Receipt</label>+ <label data-i18n="warranties.invoice_receipt_short">Invoice</label><!-- Storage Selection --><div id="invoiceStorageSelection" class="storage-selection" style="display: none;"><div class="storage-options">@@ -733,7 +733,7 @@<span id="summary-product-photo" class="summary-value">-</span></div><div class="summary-item">- <span class="summary-label" data-i18n="warranties.invoice_receipt">Invoice/Receipt:</span>+ <span class="summary-label" data-i18n="warranties.invoice_receipt_short">Invoice:</span><span id="summary-invoice" class="summary-value">-</span></div><div class="summary-item">@@ -951,7 +951,7 @@</div><div class="form-group">- <label data-i18n="warranties.invoice_receipt">Invoice/Receipt</label>+ <label data-i18n="warranties.invoice_receipt_short">Invoice</label><!-- Storage Selection --><div id="editInvoiceStorageSelection" class="storage-selection" style="display: none;"><div class="storage-options">@@ -1325,9 +1325,9 @@<div class="loading-spinner"></div></div>- <script type="module" src="js/index.js?v=20250119001"></script>+ <script type="module" src="js/index.js?v=20260518004"></script><script src="auth.js?v=20250119001"></script>- <script src="script.js?v=20250119002"></script>+ <script src="script.js?v=20260518002"></script><script>// Lightweight UI logic for Filter/Sort popovers (no change to core logic)document.addEventListener('DOMContentLoaded', function () {diff --git a/frontend/js/components/addWarrantyForm.js b/frontend/js/components/addWarrantyForm.jsindex eab4333..1bf494a 100644--- a/frontend/js/components/addWarrantyForm.js+++ b/frontend/js/components/addWarrantyForm.js@@ -443,10 +443,10 @@ export function updateSummary() {}}- updateFileSummary(state.summary.productPhoto, state.fileInputs.productPhoto);- updateFileSummary(state.summary.invoice, state.fileInputs.invoice, getValue('invoiceUrl'));- updateFileSummary(state.summary.manual, state.fileInputs.manual, getValue('manualUrl'));- updateFileSummary(state.summary.otherDocument, state.fileInputs.other, getValue('otherDocumentUrl'));+ updateFileSummary(state.summary.productPhoto, state.fileInputs.productPhoto, '', 'selectedPaperlessProductPhoto');+ updateFileSummary(state.summary.invoice, state.fileInputs.invoice, getValue('invoiceUrl'), 'selectedPaperlessInvoice');+ updateFileSummary(state.summary.manual, state.fileInputs.manual, getValue('manualUrl'), 'selectedPaperlessManual');+ updateFileSummary(state.summary.otherDocument, state.fileInputs.other, getValue('otherDocumentUrl'), 'selectedPaperlessOtherDocument');renderSummaryTags();@@ -844,13 +844,20 @@ function pluralize(key, fallback, count) {return `${fallback}${count !== 1 ? 's' : ''}`;}-function updateFileSummary(summaryElement, entry, urlValue = '') {+function updateFileSummary(summaryElement, entry, urlValue = '', paperlessInputId = '') {if (!summaryElement) return;if (entry?.input?.files?.[0]) {summaryElement.textContent = entry.input.files[0].name;- } else if (urlValue) {+ } else if (paperlessInputId) {+ const hidden = document.getElementById(paperlessInputId);+ if (hidden && hidden.value) {+ summaryElement.textContent = `Paperless-ngx #${hidden.value}`;+ return;+ }+ }+ if (urlValue) {summaryElement.textContent = `URL: ${urlValue}`;- } else {+ } else if (!entry?.input?.files?.[0]) {summaryElement.textContent = window.i18next ? window.i18next.t('warranties.not_specified') : 'Not specified';}}diff --git a/frontend/js/components/editModal.js b/frontend/js/components/editModal.jsindex 17ec25b..1c9e768 100644--- a/frontend/js/components/editModal.js+++ b/frontend/js/components/editModal.js@@ -86,7 +86,7 @@ export function renderCurrentInvoice(element, deleteBtn, warranty, i18n = windowconst icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_invoice') : 'Current invoice') + ': ';const label = document.createTextNode(labelText);- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -100,7 +100,7 @@ export function renderCurrentInvoice(element, deleteBtn, warranty, i18n = windowconst span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_invoice') : 'Current invoice') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -126,7 +126,7 @@ export function renderCurrentManual(element, deleteBtn, warranty, i18n = window.const span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_manual') : 'Current manual') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -140,7 +140,7 @@ export function renderCurrentManual(element, deleteBtn, warranty, i18n = window.const span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_manual') : 'Current manual') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -185,7 +185,7 @@ export function renderCurrentPhoto(element, deleteBtn, warranty, i18n = window.iconst span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_photo') : 'Current photo') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -212,7 +212,7 @@ export function renderCurrentOther(element, deleteBtn, warranty, i18n = window.iconst span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_other_document') : 'Current files') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -226,7 +226,7 @@ export function renderCurrentOther(element, deleteBtn, warranty, i18n = window.iconst span = createElement('span', 'text-success');const icon = createElement('i', 'fas fa-check-circle');const labelText = (i18n ? i18n.t('warranties.current_other_document') : 'Current files') + ': ';- const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view') : 'View'));+ const a = createElement('a', 'view-document-link', (i18n ? i18n.t('actions.view', { defaultValue: 'View' }) : 'View'));a.href = '#';a.addEventListener('click', (e) => {e.preventDefault();@@ -647,6 +647,16 @@ export async function saveWarranty() {if (otherDocumentFile) formData.append('other_document', otherDocumentFile);if (productPhotoFile) formData.append('product_photo', productPhotoFile);+ // Paperless browse selections (linked existing documents)+ const paperlessFields = [+ ['selectedEditPaperlessInvoice', 'paperless_invoice_id'],+ ['selectedEditPaperlessManual', 'paperless_manual_id'],+ ];+ paperlessFields.forEach(([inputId, formKey]) => {+ const hidden = document.getElementById(inputId);+ if (hidden && hidden.value) formData.append(formKey, hidden.value);+ });+// Deletion flagsconst deleteInvoiceBtn = document.getElementById('deleteInvoiceBtn');if (deleteInvoiceBtn && deleteInvoiceBtn.dataset.delete === 'true') formData.append('delete_invoice', 'true');diff --git a/frontend/js/components/paperless.js b/frontend/js/components/paperless.jsindex 7847b13..fbc0c45 100644--- a/frontend/js/components/paperless.js+++ b/frontend/js/components/paperless.js@@ -417,14 +417,25 @@ export function openPaperlessBrowser(documentType) {const modal = document.getElementById('paperlessBrowserModal');if (modal) {modal.classList.add('active');+ const searchInput = document.getElementById('paperlessSearchInput');+ const typeFilter = document.getElementById('paperlessTypeFilter');+ const tagFilter = document.getElementById('paperlessTagFilter');+ if (searchInput) searchInput.value = '';+ if (typeFilter) typeFilter.value = '';+ if (tagFilter) tagFilter.value = '';+ const selectBtn = document.getElementById('selectPaperlessDocBtn');+ if (selectBtn) selectBtn.style.display = 'none';fetchPaperlessDocuments();+ loadPaperlessTags();}}function closePaperlessBrowser() {const modal = document.getElementById('paperlessBrowserModal');if (modal) modal.classList.remove('active');- browserState.documentType = null;+ browserState.selectedDocument = null;+ const selectBtn = document.getElementById('selectPaperlessDocBtn');+ if (selectBtn) selectBtn.style.display = 'none';}async function fetchPaperlessDocuments(page = 1, query = '') {@@ -432,19 +443,23 @@ async function fetchPaperlessDocuments(page = 1, query = '') {const token = getAuthToken();if (!token) throw new Error('Authentication required');showPaperlessLoading();- const params = new URLSearchParams({- page: page.toString(),- query,- document_type: browserState.documentType.replace('edit_', ''),- });- const response = await fetch(`/api/paperless/documents?${params.toString()}`, {- headers: { Authorization: `Bearer ${token}` },+ const PAGE_SIZE = 25;+ const offset = (page - 1) * PAGE_SIZE;+ const params = new URLSearchParams();+ params.append('limit', PAGE_SIZE.toString());+ params.append('offset', offset.toString());+ if (query) params.append('query', query);+ const response = await fetch(`/api/paperless/search?${params.toString()}`, {+ headers: {+ Authorization: `Bearer ${token}`,+ 'Content-Type': 'application/json',+ },});if (!response.ok) throw new Error('Failed to fetch documents');- const result = await response.json();- browserState.currentPage = result.page || page;- browserState.totalPages = result.total_pages || 1;- browserState.documents = result.documents || [];+ const data = await response.json();+ browserState.currentPage = page;+ browserState.totalPages = Math.ceil((data.count || 0) / PAGE_SIZE) || 1;+ browserState.documents = data.results || [];renderPaperlessDocuments();updatePaperlessPagination();} catch (error) {@@ -453,8 +468,36 @@ async function fetchPaperlessDocuments(page = 1, query = '') {}}+async function loadPaperlessTags() {+ try {+ const token = getAuthToken();+ if (!token) return;+ const response = await fetch('/api/paperless/tags', {+ headers: {+ Authorization: `Bearer ${token}`,+ 'Content-Type': 'application/json',+ },+ });+ if (!response.ok) return;+ const data = await response.json();+ const tagFilter = document.getElementById('paperlessTagFilter');+ if (!tagFilter) return;+ tagFilter.innerHTML = '<option value="">All Tags</option>';+ if (data.results) {+ data.results.forEach((tag) => {+ const option = document.createElement('option');+ option.value = tag.id;+ option.textContent = tag.name;+ tagFilter.appendChild(option);+ });+ }+ } catch (error) {+ console.error('[paperless] Failed to load tags', error);+ }+}+function renderPaperlessDocuments() {- const container = document.getElementById('paperlessDocumentsContainer');+ const container = document.getElementById('paperlessDocumentsList');if (!container) return;container.textContent = '';if (!browserState.documents.length) {@@ -483,25 +526,59 @@ function renderPaperlessDocuments() {}function selectPaperlessDocument(documentId) {- const doc = browserState.documents.find((d) => d.id === documentId);+ document.querySelectorAll('.paperless-document-item').forEach((item) => {+ item.classList.remove('selected');+ });+ const selectedItem = document.querySelector(`[data-id="${documentId}"]`);+ if (selectedItem) {+ selectedItem.classList.add('selected');+ const allDocs = browserState.documents.concat(window.currentPaperlessDocuments || []);+ const found = allDocs.find((d) => d.id === documentId);+ const titleEl = selectedItem.querySelector('.document-title');+ browserState.selectedDocument = found || { id: documentId, title: titleEl ? titleEl.textContent : `Document #${documentId}` };+ const selectBtn = document.getElementById('selectPaperlessDocBtn');+ if (selectBtn) {+ selectBtn.style.display = 'inline-block';+ selectBtn.onclick = () => confirmPaperlessSelection();+ }+ }+}++function confirmPaperlessSelection() {+ const doc = browserState.selectedDocument;if (!doc) return;const type = browserState.documentType;const inputId = getSelectionInputId(type);- const input = document.getElementById(inputId);- if (input) input.value = documentId;- updatePaperlessSelectionUI();+ const displayId = getSelectionDisplayId(type);+ let input = document.getElementById(inputId);+ if (!input) {+ input = document.createElement('input');+ input.type = 'hidden';+ input.id = inputId;+ input.name = inputId;+ document.body.appendChild(input);+ }+ input.value = doc.id;+ const display = document.getElementById(displayId);+ if (display) {+ display.style.display = 'flex';+ const nameEl = display.querySelector('.selected-doc-name');+ if (nameEl) nameEl.textContent = doc.title || `Document #${doc.id}`;+ }closePaperlessBrowser();}function updatePaperlessSelectionUI() {const types = ['invoice', 'manual', 'productPhoto', 'otherDocument', 'edit_invoice', 'edit_manual', 'edit_productPhoto', 'edit_otherDocument'];types.forEach((type) => {- const input = document.getElementById(getSelectionInputId(type));+ const inputId = getSelectionInputId(type);+ const input = document.getElementById(inputId);const display = document.getElementById(getSelectionDisplayId(type));- if (!input || !display) return;- if (input.value) {+ if (!display) return;+ if (input && input.value) {display.style.display = 'flex';- display.querySelector('.selected-doc-name').textContent = `${window.t ? window.t('paperless.document_selected') : 'Document selected'} (#${input.value})`;+ const nameEl = display.querySelector('.selected-doc-name');+ if (nameEl) nameEl.textContent = `${window.t ? window.t('paperless.document_selected') : 'Document selected'} (#${input.value})`;} else {display.style.display = 'none';}@@ -518,30 +595,38 @@ export function clearPaperlessSelection(documentType) {function changePage(direction) {const targetPage = browserState.currentPage + direction;if (targetPage < 1 || targetPage > browserState.totalPages) return;- fetchPaperlessDocuments(targetPage, browserState.searchQuery);+ browserState.currentPage = targetPage;+ const searchInput = document.getElementById('paperlessSearchInput');+ const query = searchInput ? searchInput.value.trim() : '';+ fetchPaperlessDocuments(targetPage, query);}function updatePaperlessPagination() {- const current = document.getElementById('paperlessCurrentPage');- const total = document.getElementById('paperlessTotalPages');- if (current) current.textContent = browserState.currentPage;- if (total) total.textContent = browserState.totalPages;- const prev = document.getElementById('paperlessPrevBtn');- const next = document.getElementById('paperlessNextBtn');- if (prev) prev.disabled = browserState.currentPage <= 1;- if (next) next.disabled = browserState.currentPage >= browserState.totalPages;+ const paginationDiv = document.getElementById('paperlessPagination');+ const prevBtn = document.getElementById('prevPageBtn');+ const nextBtn = document.getElementById('nextPageBtn');+ const pageInfo = document.getElementById('pageInfo');+ if (!paginationDiv) return;+ if (browserState.totalPages <= 1) {+ paginationDiv.style.display = 'none';+ return;+ }+ paginationDiv.style.display = 'flex';+ if (prevBtn) prevBtn.disabled = browserState.currentPage <= 1;+ if (nextBtn) nextBtn.disabled = browserState.currentPage >= browserState.totalPages;+ if (pageInfo) pageInfo.textContent = `Page ${browserState.currentPage} of ${browserState.totalPages}`;}function showPaperlessLoading() {- const container = document.getElementById('paperlessDocumentsContainer');+ const container = document.getElementById('paperlessDocumentsList');if (!container) return;- container.innerHTML = `<div class="loading-message">+ container.innerHTML = `<div class="loading-message" style="text-align: center; padding: 40px;"><i class="fas fa-spinner fa-spin"></i> ${window.t ? window.t('paperless.loading_documents') : 'Loading documents...'}</div>`;}function showPaperlessError(message) {- const container = document.getElementById('paperlessDocumentsContainer');+ const container = document.getElementById('paperlessDocumentsList');if (!container) return;container.innerHTML = `<div class="no-documents-message"><i class="fas fa-exclamation-triangle"></i>@@ -656,6 +741,8 @@ export function clearImageCache() {if (typeof window !== 'undefined') {window.openPaperlessDocument = openPaperlessDocument;window.openPaperlessBrowser = openPaperlessBrowser;+ window.selectPaperlessDocument = selectPaperlessDocument;+ window.confirmPaperlessSelection = confirmPaperlessSelection;window.clearPaperlessSelection = clearPaperlessSelection;window.autoLinkRecentDocuments = autoLinkRecentDocuments;window.loadSecureImages = loadSecureImages;diff --git a/frontend/js/components/warrantyRenderer.js b/frontend/js/components/warrantyRenderer.jsindex a83981e..8b887e2 100644--- a/frontend/js/components/warrantyRenderer.js+++ b/frontend/js/components/warrantyRenderer.js@@ -203,7 +203,7 @@ function generateDocumentLink(warranty, docType) {paperlessId: warranty.paperless_invoice_id,url: warranty.invoice_url,icon: 'fas fa-file-invoice',- label: t('warranties.invoice_receipt', 'Invoice'),+ label: t('warranties.invoice_receipt_short', 'Invoice'),className: 'invoice-link',},manual: {diff --git a/frontend/login.html b/frontend/login.htmlindex ea704fd..45c0aef 100644--- a/frontend/login.html+++ b/frontend/login.html@@ -1,7 +1,7 @@<!DOCTYPE html><html><head>- <script src="auth-redirect.js?v=20250119001" data-protected="false"></script>+ <script src="auth-redirect.js?v=20260518001" data-protected="false"></script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title data-i18n="auth.login_title">Login - Warracker</title>diff --git a/frontend/register.html b/frontend/register.htmlindex b67b39a..c5b0528 100644--- a/frontend/register.html+++ b/frontend/register.html@@ -2,7 +2,7 @@<html><head><!-- Authentication redirect script -->- <script src="auth-redirect.js?v=20250119001" data-protected="false"></script>+ <script src="auth-redirect.js?v=20260518001" data-protected="false"></script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">diff --git a/frontend/script.js b/frontend/script.jsindex 51327f8..58e1b37 100644--- a/frontend/script.js+++ b/frontend/script.js@@ -4050,7 +4050,7 @@ function generateDocumentLink(warranty, docType) {paperlessId: warranty.paperless_invoice_id,url: warranty.invoice_url,icon: 'fas fa-file-invoice',- label: 'Invoice',+ label: window.i18next ? window.i18next.t('warranties.invoice_receipt_short', 'Invoice') : 'Invoice',className: 'invoice-link'},manual: {@@ -4058,7 +4058,7 @@ function generateDocumentLink(warranty, docType) {paperlessId: warranty.paperless_manual_id,url: warranty.manual_url,icon: 'fas fa-book',- label: 'Manual',+ label: window.i18next ? window.i18next.t('warranties.product_manual', 'Manual') : 'Manual',className: 'manual-link'},other: {@@ -4066,15 +4066,15 @@ function generateDocumentLink(warranty, docType) {paperlessId: warranty.paperless_other_id,url: warranty.other_document_url,icon: 'fas fa-file-alt',- label: 'Files',+ label: window.i18next ? window.i18next.t('warranties.files', 'Files') : 'Files',className: 'other-document-link'},photo: {localPath: warranty.product_photo_path,paperlessId: warranty.paperless_photo_id,- url: null, // Photos don't have URLs+ url: null,icon: 'fas fa-image',- label: 'Photo',+ label: window.i18next ? window.i18next.t('warranties.product_photo', 'Photo') : 'Photo',className: 'photo-link'}};diff --git a/frontend/settings-new.html b/frontend/settings-new.htmlindex 04a4f1a..0bc57a6 100644--- a/frontend/settings-new.html+++ b/frontend/settings-new.html@@ -2,7 +2,7 @@<html><head><!-- Authentication redirect script -->- <script src="auth-redirect.js?v=20250119001" data-protected="true"></script>+ <script src="auth-redirect.js?v=20260518001" data-protected="true"></script><!-- Include authentication script first to handle login state immediately --><script src="include-auth-new.js?v=20250119001"></script>diff --git a/frontend/status.html b/frontend/status.htmlindex e909f48..aa13ae9 100644--- a/frontend/status.html+++ b/frontend/status.html@@ -2,7 +2,7 @@<html><head><!-- Authentication redirect script -->- <script src="auth-redirect.js?v=20250119001" data-protected="true"></script>+ <script src="auth-redirect.js?v=20260518001" data-protected="true"></script><!-- Include authentication script first to handle login state immediately --><script src="include-auth-new.js?v=20250119001"></script>@@ -37,7 +37,7 @@<script src="js/i18n.js?v=20250119001"></script><!-- Load fix for auth buttons --><script src="fix-auth-buttons-loader.js?v=20250119001"></script>- <script src="script.js?v=20250119002" defer></script> <!-- Added script.js -->+ <script src="script.js?v=20260518002" defer></script> <!-- Added script.js --><script src="status.js?v=20250119001" defer></script> <!-- Status page specific functionality --><style>.user-menu {@@ -678,7 +678,7 @@<button type="button" id="deleteProductPhotoBtn" class="btn btn-danger btn-sm mt-2" style="display:none;"><i class="fas fa-trash"></i> <span data-i18n="warranties.delete_photo">Delete Photo</span></button></div><div class="form-group">- <label data-i18n="warranties.invoice_receipt">Invoice/Receipt</label>+ <label data-i18n="warranties.invoice_receipt_short">Invoice</label><div class="file-input-wrapper"><label for="editInvoice" class="file-input-label"><i class="fas fa-upload"></i> <span data-i18n="warranties.choose_file">Choose File</span>diff --git a/frontend/sw.js b/frontend/sw.jsindex 97b932f..9f47cdb 100644--- a/frontend/sw.js+++ b/frontend/sw.js@@ -1,4 +1,4 @@-const CACHE_NAME = 'warracker-cache-v20251030001';+const CACHE_NAME = 'warracker-cache-v20260518005';const urlsToCache = [// HTML pages'./',@@ -21,7 +21,7 @@ const urlsToCache = ['./mobile-header.css?v=20250119002',// JavaScript (versioned)- './script.js?v=20250119002',+ './script.js?v=20260518002','./auth.js?v=20250119001','./settings-new.js?v=20250119001','./status.js?v=20250119001',@@ -31,7 +31,7 @@ const urlsToCache = ['./include-auth-new.js?v=20250119001','./file-utils.js?v=20250119001','./fix-auth-buttons-loader.js?v=20250119001',- './auth-redirect.js?v=20250119001',+ './auth-redirect.js?v=20260518001','./mobile-menu.js?v=20250119002','./version-checker.js?v=20250119001',@@ -70,14 +70,37 @@ self.addEventListener('fetch', event => {}const requestUrl = new URL(event.request.url);+ const isSameOrigin = requestUrl.origin === self.location.origin;+ // Network-first for scripts: always fetch fresh JS so code updates are+ // picked up immediately, falling back to cache only when offline.+ if (event.request.destination === 'script') {+ event.respondWith(+ fetch(event.request)+ .then(networkResponse => {+ if (isSameOrigin && networkResponse && networkResponse.status === 200) {+ const responseToCache = networkResponse.clone();+ caches.open(CACHE_NAME).then(cache => cache.put(event.request, responseToCache));+ }+ return networkResponse;+ })+ .catch(() => {+ return caches.match(event.request).then(cachedResponse => {+ if (cachedResponse) return cachedResponse;+ return Promise.reject(new Error('Network error and no cache.'));+ });+ })+ );+ return;+ }++ // Cache-first for everything else (images, fonts, CSS, HTML).event.respondWith(caches.match(event.request).then(cachedResponse => {const fetchPromise = fetch(event.request).then(networkResponse => {- const isSameOrigin = requestUrl.origin === self.location.origin;const okToCache = isSameOrigin && networkResponse && networkResponse.status === 200 &&- ['document', 'script', 'style', 'image', 'font'].includes(event.request.destination);+ ['document', 'style', 'image', 'font'].includes(event.request.destination);if (okToCache) {const responseToCache = networkResponse.clone();diff --git a/locales/ar/translation.json b/locales/ar/translation.jsonindex 48bfb8c..38b70c6 100644--- a/locales/ar/translation.json+++ b/locales/ar/translation.json@@ -401,7 +401,8 @@"download": "تنزيل","manage_tags": "إدارة العلامات","close": "إغلاق",- "save_changes": "حفظ التغييرات"+ "save_changes": "حفظ التغييرات",+ "view": "عرض"},"filters": {"all_status": "كل الحالات",diff --git a/locales/cs/translation.json b/locales/cs/translation.jsonindex 4b65534..a433360 100644--- a/locales/cs/translation.json+++ b/locales/cs/translation.json@@ -400,7 +400,8 @@"download": "Stáhnout","manage_tags": "Spravovat tagy","close": "Zavřít",- "save_changes": "Uložit změny"+ "save_changes": "Uložit změny",+ "view": "Zobrazit"},"filters": {"all_status": "Všechny stavy",diff --git a/locales/de/translation.json b/locales/de/translation.jsonindex 1e0a4fb..ebf428f 100644--- a/locales/de/translation.json+++ b/locales/de/translation.json@@ -393,7 +393,8 @@"download": "Herunterladen","manage_tags": "Tags verwalten","close": "Schließen",- "save_changes": "Änderungen speichern"+ "save_changes": "Änderungen speichern",+ "view": "Anzeigen"},"filters": {"all_status": "Alle Status",diff --git a/locales/en/translation.json b/locales/en/translation.jsonindex a100f8a..c98487f 100644--- a/locales/en/translation.json+++ b/locales/en/translation.json@@ -142,7 +142,7 @@"add_any_notes": "Add any notes about this warranty...","product_photo_optional": "Product Photo (Optional)","choose_photo": "Choose Photo",- "invoice_receipt": "Invoice/Receipt",+ "invoice_receipt": "Invoice","store_locally": "Store Locally","store_in_paperless": "Store in Paperless-ngx","choose_file": "Choose File",@@ -405,7 +405,8 @@"manage_tags": "Manage Tags","close": "Close","save_changes": "Save Changes",- "data": "Data"+ "data": "Data",+ "view": "View"},"filters": {"all_status": "All Status",diff --git a/locales/es/translation.json b/locales/es/translation.jsonindex 85ddefe..ad1dc46 100644--- a/locales/es/translation.json+++ b/locales/es/translation.json@@ -395,7 +395,8 @@"download": "Descargar","manage_tags": "Gestionar Etiquetas","close": "Cerrar",- "save_changes": "Guardar Cambios"+ "save_changes": "Guardar Cambios",+ "view": "Ver"},"filters": {"all_status": "Todos los Estados",diff --git a/locales/fa/translation.json b/locales/fa/translation.jsonindex 7a494dd..66795f0 100644--- a/locales/fa/translation.json+++ b/locales/fa/translation.json@@ -394,7 +394,8 @@"download": "دانلود","manage_tags": "مدیریت برچسبها","close": "بستن",- "save_changes": "ذخیره تغییرات"+ "save_changes": "ذخیره تغییرات",+ "view": "مشاهده"},"filters": {"all_status": "همه وضعیتها",diff --git a/locales/fr/translation.json b/locales/fr/translation.jsonindex 7c2e935..1f1cbbe 100644--- a/locales/fr/translation.json+++ b/locales/fr/translation.json@@ -395,7 +395,8 @@"download": "Télécharger","manage_tags": "Gérer les Étiquettes","close": "Fermer",- "save_changes": "Enregistrer les Modifications"+ "save_changes": "Enregistrer les Modifications",+ "view": "Voir"},"filters": {"all_status": "Tous les Statuts",diff --git a/locales/he/translation.json b/locales/he/translation.jsonindex 1f80d81..c3fde96 100644--- a/locales/he/translation.json+++ b/locales/he/translation.json@@ -404,7 +404,8 @@"download": "הורד","manage_tags": "נהל תגיות","close": "סגור",- "save_changes": "שמור שינויים"+ "save_changes": "שמור שינויים",+ "view": "הצג"},"filters": {"all_status": "כל המצבים",diff --git a/locales/hi/translation.json b/locales/hi/translation.jsonindex 0701a04..247306f 100644--- a/locales/hi/translation.json+++ b/locales/hi/translation.json@@ -392,7 +392,8 @@"download": "डाउनलोड","manage_tags": "टैग प्रबंधित करें","close": "बंद करें",- "save_changes": "परिवर्तन सहेजें"+ "save_changes": "परिवर्तन सहेजें",+ "view": "देखें"},"filters": {"all_status": "सभी स्थितियाँ",diff --git a/locales/it/translation.json b/locales/it/translation.jsonindex a21c666..47b2d6d 100644--- a/locales/it/translation.json+++ b/locales/it/translation.json@@ -449,7 +449,8 @@"download": "Scarica","manage_tags": "Gestisci Tag","close": "Chiudi",- "save_changes": "Salva Modifiche"+ "save_changes": "Salva Modifiche",+ "view": "Visualizza"},"filters": {"all_status": "Tutti gli Stati",diff --git a/locales/ja/translation.json b/locales/ja/translation.jsonindex 01f3f6e..5cc2c09 100644--- a/locales/ja/translation.json+++ b/locales/ja/translation.json@@ -394,7 +394,8 @@"download": "ダウンロード","manage_tags": "タグを管理","close": "閉じる",- "save_changes": "変更を保存"+ "save_changes": "変更を保存",+ "view": "表示"},"filters": {"all_status": "すべてのステータス",diff --git a/locales/ko/translation.json b/locales/ko/translation.jsonindex 778db65..ea3b8c1 100644--- a/locales/ko/translation.json+++ b/locales/ko/translation.json@@ -394,7 +394,8 @@"download": "다운로드","manage_tags": "태그 관리","close": "닫기",- "save_changes": "변경 사항 저장"+ "save_changes": "변경 사항 저장",+ "view": "보기"},"filters": {"all_status": "모든 상태",diff --git a/locales/nl/translation.json b/locales/nl/translation.jsonindex 25eb822..8ebd072 100644--- a/locales/nl/translation.json+++ b/locales/nl/translation.json@@ -393,7 +393,8 @@"download": "Downloaden","manage_tags": "Tags beheren","close": "Sluiten",- "save_changes": "Wijzigingen opslaan"+ "save_changes": "Wijzigingen opslaan",+ "view": "Bekijken"},"filters": {"all_status": "Alle statussen",diff --git a/locales/pl/translation.json b/locales/pl/translation.jsonindex 12571aa..cc1ac4c 100644--- a/locales/pl/translation.json+++ b/locales/pl/translation.json@@ -393,7 +393,8 @@"download": "Pobierz","manage_tags": "Zarządzaj tagami","close": "Zamknij",- "save_changes": "Zapisz zmiany"+ "save_changes": "Zapisz zmiany",+ "view": "Wyświetl"},"filters": {"all_status": "Wszystkie statusy",diff --git a/locales/pt/translation.json b/locales/pt/translation.jsonindex 495c69a..1c4c126 100644--- a/locales/pt/translation.json+++ b/locales/pt/translation.json@@ -425,7 +425,8 @@"download": "Baixar","manage_tags": "Gerenciar Etiquetas","close": "Fechar",- "save_changes": "Salvar Alterações"+ "save_changes": "Salvar Alterações",+ "view": "Ver"},"filters": {"all_status": "Todos os Status",diff --git a/locales/ru/translation.json b/locales/ru/translation.jsonindex 4db48cf..b09a141 100644--- a/locales/ru/translation.json+++ b/locales/ru/translation.json@@ -431,7 +431,8 @@"download": "Скачать","manage_tags": "Управление тегами","close": "Закрыть",- "save_changes": "Сохранить изменения"+ "save_changes": "Сохранить изменения",+ "view": "Просмотр"},"filters": {"all_status": "Все статусы",diff --git a/locales/tr/translation.json b/locales/tr/translation.jsonindex 67c2853..df98a38 100644--- a/locales/tr/translation.json+++ b/locales/tr/translation.json@@ -576,7 +576,8 @@"download": "İndir","manage_tags": "Etiketleri Yönet","close": "Kapat",- "save_changes": "Değişiklikleri Kaydet"+ "save_changes": "Değişiklikleri Kaydet",+ "view": "Görüntüle"},"filters": {"all_status": "Tüm Durumlar",diff --git a/locales/uk/translation.json b/locales/uk/translation.jsonindex 9ace896..4135d7b 100644--- a/locales/uk/translation.json+++ b/locales/uk/translation.json@@ -400,7 +400,8 @@"download": "Завантажити","manage_tags": "Керування тегами","close": "Закрити",- "save_changes": "Зберегти зміни"+ "save_changes": "Зберегти зміни",+ "view": "Переглянути"},"filters": {"all_status": "Всі статуси",diff --git a/locales/zh_CN/translation.json b/locales/zh_CN/translation.jsonindex 791737b..726b634 100644--- a/locales/zh_CN/translation.json+++ b/locales/zh_CN/translation.json@@ -403,7 +403,8 @@"manage_tags": "管理标签","close": "关闭","save_changes": "保存更改",- "data": "数据"+ "data": "数据",+ "view": "查看"},"filters": {"all_status": "所有状态",diff --git a/locales/zh_HK/translation.json b/locales/zh_HK/translation.jsonindex a4f807b..893da6d 100644--- a/locales/zh_HK/translation.json+++ b/locales/zh_HK/translation.json@@ -394,7 +394,8 @@"download": "下載","manage_tags": "管理標籤","close": "關閉",- "save_changes": "儲存變更"+ "save_changes": "儲存變更",+ "view": "查看"},"filters": {"all_status": "所有狀態",diff --git a/nginx.conf b/nginx.confindex 84da578..2d27b1a 100644--- a/nginx.conf+++ b/nginx.conf@@ -115,8 +115,15 @@ server {expires -1;}- # Static assets (CSS, JS, images)- location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {+ # JavaScript files - short cache with revalidation so module updates are picked up promptly+ location ~* \.js$ {+ try_files $uri =404;+ expires -1;+ add_header Cache-Control "no-cache, must-revalidate";+ }++ # Static assets (CSS, images) - long cache is fine since these change rarely+ location ~* \.(css|jpg|jpeg|png|gif|ico|svg)$ {try_files $uri =404;expires 7d;add_header Cache-Control "public, max-age=604800";