fix: null-safe doConnect for removed setup fields; move logout to settings with confirm; clean sidebar buttons

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-04-28 13:24:27 +02:00
1 parent 5a994e9564
commit 85290a54f6
3 files changed
+16 -12

No files matched your search

+6 -6
View File
@@ -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,