diff --git a/index.html b/index.html index 1eeaf45..b835c27 100644 --- a/index.html +++ b/index.html @@ -55,9 +55,6 @@ -
@@ -518,9 +515,12 @@
-
- - +
+
+ + +
+
diff --git a/src/main.js b/src/main.js index 73d0b53..7299780 100644 --- a/src/main.js +++ b/src/main.js @@ -23,7 +23,7 @@ import { openNpMenu, closeNpMenu, } from './nowplaying.js'; import { - openSettings, closeSettings, saveSettings, + openSettings, closeSettings, saveSettings, confirmDisconnect, checkBackend, openSidebar, closeSidebar, switchNavMode, showCtxMenu, openPlModal, closePlModal, addSongsToPlaylist, createAndAddPlaylist, createPlaylistPrompt, showSongInfo, closeInfoModal, openDlModal, closeDlModal, @@ -40,10 +40,10 @@ async function doConnect() { const url = document.getElementById('srv-url').value.trim().replace(/\/$/,''); const user = document.getElementById('srv-user').value.trim(); const pass = document.getElementById('srv-pass').value; - const lfKey = document.getElementById('lastfm-key').value.trim(); - const backUrl = document.getElementById('backend-url').value.trim().replace(/\/$/,''); - const spId = document.getElementById('spotify-client-id').value.trim(); - const spSecret = document.getElementById('spotify-client-secret').value.trim(); + const lfKey = document.getElementById('lastfm-key')?.value.trim() ?? S.cfg.lastfmKey ?? ''; + const backUrl = (document.getElementById('backend-url')?.value.trim() ?? S.cfg.backendUrl ?? '').replace(/\/$/,''); + const spId = document.getElementById('spotify-client-id')?.value.trim() ?? S.cfg.spotifyClientId ?? ''; + const spSecret = document.getElementById('spotify-client-secret')?.value.trim() ?? S.cfg.spotifyClientSecret ?? ''; if(!url || !user || !pass) { _showSetupError('Bitte Server-URL, Benutzernamen und Passwort ausfüllen.'); return; } const btn = document.getElementById('btn-connect'); btn.disabled=true; btn.textContent='Verbinde…'; @@ -234,7 +234,7 @@ Object.assign(window, { openNpMenu, closeNpMenu, npSeek: () => {}, // UI / Modals - openSettings, closeSettings, saveSettings, checkBackend, + openSettings, closeSettings, saveSettings, confirmDisconnect, checkBackend, openSidebar, closeSidebar, switchNavMode, showCtxMenu, // Views loadRandom, loadSpotifyImporter, resolveSpotifyLink, clearSpotifyPreview, spotifyDlAll, diff --git a/src/ui.js b/src/ui.js index 94c3ccb..71b823b 100644 --- a/src/ui.js +++ b/src/ui.js @@ -83,6 +83,10 @@ export function _pickTheme(id) { _renderThemePicker(); } export function closeSettings() { document.getElementById('settings-modal').classList.remove('open'); } +export async function confirmDisconnect() { + const ok = await showConfirm('Abmelden', 'Wirklich abmelden? Alle lokalen Einstellungen werden gelöscht.', 'Abmelden'); + if (ok) { closeSettings(); window.disconnect(); } +} export function saveSettings() { const pass = document.getElementById('s-pass').value; S.cfg.url = document.getElementById('s-url').value.trim().replace(/\/$/,'');