From 9054016ff218991d2035c8ba9192b89f095167d7 Mon Sep 17 00:00:00 2001 From: edidealt Date: Mon, 2 Mar 2026 23:32:51 +0000 Subject: [PATCH] settings import + export --- index.html | 18 +++++++++++++++++ js/app.js | 25 +++++++++++++++++++----- js/settings.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index cbeb65b..56e27bd 100644 --- a/index.html +++ b/index.html @@ -5076,6 +5076,24 @@ /> +
+
+ Export All Settings + Export all app settings as JSON +
+
+ + + +
+
ADVANCED: Custom Database/Auth diff --git a/js/app.js b/js/app.js index f9e49a6..33cdd82 100644 --- a/js/app.js +++ b/js/app.js @@ -2562,12 +2562,27 @@ document.addEventListener('DOMContentLoaded', async () => { const headerAccountImg = document.getElementById('header-account-img'); const headerAccountIcon = document.getElementById('header-account-icon'); + // Temporarily disable accounts - show popup + const isAccountsDisabled = true; + if (headerAccountBtn && headerAccountDropdown) { - headerAccountBtn.addEventListener('click', (e) => { - e.stopPropagation(); - headerAccountDropdown.classList.toggle('active'); - updateAccountDropdown(); - }); + if (isAccountsDisabled) { + headerAccountBtn.style.opacity = '0.5'; + headerAccountBtn.style.cursor = 'not-allowed'; + headerAccountBtn.title = 'Accounts temporarily unavailable'; + headerAccountBtn.addEventListener('click', (e) => { + e.stopPropagation(); + alert( + "We're moving authentication and data storing systems.\n\nAccounts, profiles, playlists, and community themes will not work during this period (approximately 2 days).\n\nYou will need to re-login after the migration is complete." + ); + }); + } else { + headerAccountBtn.addEventListener('click', (e) => { + e.stopPropagation(); + headerAccountDropdown.classList.toggle('active'); + updateAccountDropdown(); + }); + } document.addEventListener('click', (e) => { if (!headerAccountBtn.contains(e.target) && !headerAccountDropdown.contains(e.target)) { diff --git a/js/settings.js b/js/settings.js index adc9e41..b6c21b0 100644 --- a/js/settings.js +++ b/js/settings.js @@ -2750,6 +2750,59 @@ export function initializeSettings(scrobbler, player, api, ui) { reader.readAsText(file); }); + // Export All Settings + document.getElementById('export-settings-btn')?.addEventListener('click', () => { + const settingsToExport = {}; + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key && key.startsWith('monochrome-')) { + try { + settingsToExport[key] = JSON.parse(localStorage.getItem(key)); + } catch { + settingsToExport[key] = localStorage.getItem(key); + } + } + } + const blob = new Blob([JSON.stringify(settingsToExport, null, 2)], { + type: 'application/json', + }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `monochrome-settings-${new Date().toISOString().split('T')[0]}.json`; + a.click(); + URL.revokeObjectURL(url); + }); + + // Import All Settings + const settingsImportInput = document.getElementById('import-settings-input'); + document.getElementById('import-settings-btn')?.addEventListener('click', () => { + settingsImportInput.click(); + }); + + settingsImportInput?.addEventListener('change', async (e) => { + const file = e.target.files[0]; + if (!file) return; + + const reader = new FileReader(); + reader.onload = async (event) => { + try { + const settingsToImport = JSON.parse(event.target.result); + for (const [key, value] of Object.entries(settingsToImport)) { + if (key.startsWith('monochrome-')) { + localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value)); + } + } + alert('Settings imported successfully! Please reload the app.'); + window.location.reload(); + } catch (err) { + console.error('Import failed:', err); + alert('Failed to import settings. Please check the file format.'); + } + }; + reader.readAsText(file); + }); + const customDbBtn = document.getElementById('custom-db-btn'); const customDbModal = document.getElementById('custom-db-modal'); const customPbUrlInput = document.getElementById('custom-pb-url');