diff --git a/src/main/resources/static/js/cacheFormInputs.js b/src/main/resources/static/js/cacheFormInputs.js index 1cd504b7f..64760bf41 100644 --- a/src/main/resources/static/js/cacheFormInputs.js +++ b/src/main/resources/static/js/cacheFormInputs.js @@ -1,10 +1,10 @@ document.addEventListener("DOMContentLoaded", function() { - + var cacheInputs = localStorage.getItem("cacheInputs") || "disabled"; if (cacheInputs !== "enabled") { return; // Stop execution if caching is not enabled } - + // Function to generate a key based on the form's action attribute function generateStorageKey(form) { const action = form.getAttribute('action'); @@ -24,11 +24,11 @@ document.addEventListener("DOMContentLoaded", function() { for (let i = 0; i < elements.length; i++) { const element = elements[i]; // Skip elements without names, passwords, files, hidden fields, and submit/reset buttons - if (!element.name || - element.type === 'password' || - element.type === 'file' || - //element.type === 'hidden' || - element.type === 'submit' || + if (!element.name || + element.type === 'password' || + element.type === 'file' || + //element.type === 'hidden' || + element.type === 'submit' || element.type === 'reset') { continue; } diff --git a/src/main/resources/static/js/csrf.js b/src/main/resources/static/js/csrf.js index 2dc1c0ca2..20b8b00f1 100644 --- a/src/main/resources/static/js/csrf.js +++ b/src/main/resources/static/js/csrf.js @@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', function() { // Find all forms and add CSRF token const forms = document.querySelectorAll('form'); const csrfToken = decodeCsrfToken(getCsrfToken()); - + // Only proceed if we have a cookie-based token if (csrfToken) { forms.forEach(form => { @@ -34,4 +34,4 @@ document.addEventListener('DOMContentLoaded', function() { form.appendChild(csrfInput); }); } -}); \ No newline at end of file +}); diff --git a/src/main/resources/static/js/darkmode.js b/src/main/resources/static/js/darkmode.js index 08c0c380d..abfe737c9 100644 --- a/src/main/resources/static/js/darkmode.js +++ b/src/main/resources/static/js/darkmode.js @@ -102,4 +102,4 @@ document.addEventListener("DOMContentLoaded", function () { toggleDarkMode(); }); } -}); \ No newline at end of file +}); diff --git a/src/main/resources/static/js/fetch-utils.js b/src/main/resources/static/js/fetch-utils.js index d606d71ac..dfe2604a8 100644 --- a/src/main/resources/static/js/fetch-utils.js +++ b/src/main/resources/static/js/fetch-utils.js @@ -4,7 +4,7 @@ window.fetchWithCsrf = async function(url, options = {}) { .split('; ') .find(row => row.startsWith('XSRF-TOKEN=')) ?.split('=')[1]; - + if (cookieValue) { return cookieValue; } @@ -14,10 +14,10 @@ window.fetchWithCsrf = async function(url, options = {}) { // Create a new options object to avoid modifying the passed object const fetchOptions = { ...options }; - + // Ensure headers object exists fetchOptions.headers = { ...options.headers }; - + // Add CSRF token if available const csrfToken = getCsrfToken(); if (csrfToken) { @@ -25,4 +25,4 @@ window.fetchWithCsrf = async function(url, options = {}) { } return fetch(url, fetchOptions); -} \ No newline at end of file +} diff --git a/src/main/resources/static/js/game.js b/src/main/resources/static/js/game.js index 3746ef63d..df04c5dd5 100644 --- a/src/main/resources/static/js/game.js +++ b/src/main/resources/static/js/game.js @@ -32,8 +32,8 @@ function initializeGame() { const BASE_SPAWN_INTERVAL_MS = 1250; // milliseconds before a new enemy spawns const LEVEL_INCREASE_FACTOR_MS = 25; // milliseconds to decrease the spawn interval per level const MAX_SPAWN_RATE_REDUCTION_MS = 800; // Max milliseconds from the base spawn interval - - + + let keysPressed = {}; const pdfs = []; const projectiles = []; @@ -42,7 +42,7 @@ function initializeGame() { let pdfSpeed = BASE_PDF_SPEED; let gameOver = false; - + function handleKeys() { if (keysPressed["ArrowLeft"]) { playerX -= PLAYER_MOVE_SPEED; @@ -72,7 +72,7 @@ function initializeGame() { function onKeyUp(event) { keysPressed[event.key] = false; } - + document.removeEventListener("keydown", onKeydown); document.removeEventListener("keyup", onKeyUp); document.addEventListener("keydown", onKeydown); @@ -243,7 +243,7 @@ function initializeGame() { let spawnPdfTimeout; - + function spawnPdfInterval() { if (gameOver || paused) { diff --git a/src/main/resources/static/js/settings.js b/src/main/resources/static/js/settings.js index 8f6289af2..6954913c5 100644 --- a/src/main/resources/static/js/settings.js +++ b/src/main/resources/static/js/settings.js @@ -39,4 +39,3 @@ document.getElementById("cacheInputs").addEventListener("change", function () { cacheInputs = this.checked ? "enabled" : "disabled"; localStorage.setItem("cacheInputs", cacheInputs); }); - diff --git a/src/main/resources/templates/account.html b/src/main/resources/templates/account.html index c26b93d0c..0fa365043 100644 --- a/src/main/resources/templates/account.html +++ b/src/main/resources/templates/account.html @@ -308,37 +308,36 @@ document.getElementById('syncToAccount').addEventListener('click', async function() { /**/ - - let settings = {}; - for (let i = 0; i < localStorage.length; i++) { - const key = localStorage.key(i); - if(key !== 'debug' && key !== '0' && key !== '1' && !key.includes('pdfjs') && !key.includes('posthog') && !key.includes('pageViews')) { - settings[key] = localStorage.getItem(key); - } - } - - try { - const response = await window.fetchWithCsrf(urlUpdateUserSettings, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(settings) - }); - - if (response.ok) { - location.reload(); - } else { - alert('Error syncing settings to account'); - } - } catch (error) { - console.error('Error:', error); - alert('Error syncing settings to account'); - } - }); + const urlUpdateUserSettings = /*[[@{/api/v1/user/updateUserSettings}]]*/ "/api/v1/user/updateUserSettings"; + /*]]>*/ + let settings = {}; + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if(key !== 'debug' && key !== '0' && key !== '1' && !key.includes('pdfjs') && !key.includes('posthog') && !key.includes('pageViews')) { + settings[key] = localStorage.getItem(key); + } + } + + try { + const response = await window.fetchWithCsrf(urlUpdateUserSettings, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings) + }); + + if (response.ok) { + location.reload(); + } else { + alert('Error syncing settings to account'); + } + } catch (error) { + console.error('Error:', error); + alert('Error syncing settings to account'); + } + }); });
diff --git a/src/main/resources/templates/fragments/footer.html b/src/main/resources/templates/fragments/footer.html index d18516c3c..bcb6e74d1 100644 --- a/src/main/resources/templates/fragments/footer.html +++ b/src/main/resources/templates/fragments/footer.html @@ -16,8 +16,8 @@ + + Stirling PDF +
\ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index cee20450b..52ff60c62 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -12,87 +12,87 @@
favicon diff --git a/src/main/resources/templates/releases.html b/src/main/resources/templates/releases.html index 36c18d1e8..a00f4d4ef 100644 --- a/src/main/resources/templates/releases.html +++ b/src/main/resources/templates/releases.html @@ -16,15 +16,15 @@ update Release Notes
- + - +
@@ -51,42 +51,42 @@ .release-notes-container { margin-top: 2rem; } - + .release-card { border: 1px solid #dee2e6; border-radius: 0.25rem; margin-bottom: 1.5rem; padding: 1rem; } - + .release-card.current-version { border-color: #28a745; background-color: rgba(40, 167, 69, 0.05); } - + .release-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; } - + .release-header h3 { margin: 0; display: flex; gap: 1rem; align-items: center; } - + .version { font-weight: bold; } - + .release-date { color: #6c757d; font-size: 0.9em; } - + .release-body { font-size: 0.9rem; white-space: pre-wrap; @@ -105,17 +105,17 @@ diff --git a/src/main/resources/templates/security/validate-signature.html b/src/main/resources/templates/security/validate-signature.html index 015f41ee6..af4e92132 100644 --- a/src/main/resources/templates/security/validate-signature.html +++ b/src/main/resources/templates/security/validate-signature.html @@ -21,9 +21,9 @@
- -
-
+ +
+
diff --git a/src/test/java/stirling/software/SPDF/SPDFApplicationTest.java b/src/test/java/stirling/software/SPDF/SPDFApplicationTest.java index e155527b7..fe17cedac 100644 --- a/src/test/java/stirling/software/SPDF/SPDFApplicationTest.java +++ b/src/test/java/stirling/software/SPDF/SPDFApplicationTest.java @@ -29,7 +29,7 @@ public class SPDFApplicationTest { @Mock private ApplicationProperties applicationProperties; - + @InjectMocks private SPDFApplication SPDFApplication; diff --git a/src/test/java/stirling/software/SPDF/config/security/database/DatabaseConfigTest.java b/src/test/java/stirling/software/SPDF/config/security/database/DatabaseConfigTest.java index 2c61ce1a7..bcfdc563c 100644 --- a/src/test/java/stirling/software/SPDF/config/security/database/DatabaseConfigTest.java +++ b/src/test/java/stirling/software/SPDF/config/security/database/DatabaseConfigTest.java @@ -103,4 +103,4 @@ class DatabaseConfigTest { assertThrows(UnsupportedProviderException.class, () -> databaseConfig.dataSource()); } -} \ No newline at end of file +} diff --git a/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java b/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java index 03a6abb71..6c6852866 100644 --- a/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java +++ b/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java @@ -98,4 +98,4 @@ class RearrangePagesPDFControllerTest { assertNotNull(newPageOrder, "Returning null instead of page order list"); assertEquals(Arrays.stream(expectedPageOrder.split(",")).map(Integer::parseInt).toList(), newPageOrder, "Page order doesn't match"); } -} \ No newline at end of file +}