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:
1 parent
5a994e9564
commit
85290a54f6
3 files changed
+14
-10
No files matched your search
+4
-4
@@ -55,9 +55,6 @@
|
||||
<button class="hbtn" onclick="openSettings()" title="Einstellungen">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.07 4.93a10 10 0 0 1 0 14.14M14.24 9.76a4 4 0 0 1 0 4.48M4.93 4.93a10 10 0 0 0 0 14.14M9.76 9.76a4 4 0 0 0 0 4.48"/></svg>
|
||||
</button>
|
||||
<button class="hbtn danger" onclick="disconnect()" title="Trennen">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" y1="2" x2="12" y2="12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-wrap">
|
||||
@@ -518,10 +515,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sticky footer -->
|
||||
<div style="display:flex;gap:8px;padding:12px 24px 16px;border-top:1px solid var(--border);flex-shrink:0;background:var(--surface);border-radius:0 0 18px 18px">
|
||||
<div style="display:flex;flex-direction:column;gap:8px;padding:12px 24px 16px;border-top:1px solid var(--border);flex-shrink:0;background:var(--surface);border-radius:0 0 18px 18px">
|
||||
<div style="display:flex;gap:8px">
|
||||
<button style="flex:1;padding:12px;border-radius:9px;font-family:var(--font);font-size:14px;font-weight:600;cursor:pointer;border:none;background:var(--surface2);color:var(--text2)" onclick="closeSettings()">Abbrechen</button>
|
||||
<button style="flex:1;padding:12px;border-radius:9px;font-family:var(--font);font-size:14px;font-weight:600;cursor:pointer;border:none;background:linear-gradient(135deg,var(--accent),var(--accent-dark));color:#000" onclick="saveSettings()">Speichern</button>
|
||||
</div>
|
||||
<button style="width:100%;padding:10px;border-radius:9px;font-family:var(--font);font-size:13px;font-weight:600;cursor:pointer;background:none;border:1px solid rgba(224,85,85,0.3);color:var(--danger);transition:background .15s" onmouseover="this.style.background='rgba(224,85,85,0.1)'" onmouseout="this.style.background='none'" onclick="confirmDisconnect()">Abmelden</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+6
-6
@@ -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,
|
||||
|
||||
@@ -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(/\/$/,'');
|
||||
|
||||
Reference in new issue
Block a user