fix: video side can configure server connections again, without changing music

The previous hard guard blocked saveSettings entirely on the video side — which
also blocked entering/saving Plex/Jellyfin connection creds (shared, legit). Now
the save runs, but on the video side it PRESERVES the persisted active_media_
server (window._persistedActiveServer) instead of reading the toggle — so video
can set up a connection without ever switching the music server. Auto-save stays
suppressed on the video side (no heavy music re-init from video field edits).
This commit is contained in:
BoulderBadgeDad 2026-06-15 14:59:36 -07:00
parent 5f1ad517c2
commit f93c211de3

View file

@ -1034,6 +1034,10 @@ async function loadSettingsData() {
// Set active server and toggle visibility
const activeServer = settings.active_media_server || 'plex';
// Remember the persisted music server so a save from the VIDEO side keeps
// it unchanged (the toggle there is for opening a config panel, not picking
// the music server).
window._persistedActiveServer = activeServer;
toggleServer(activeServer);
// Load Plex music libraries if Plex is the active server
@ -2867,11 +2871,6 @@ function _getTagConfig(path) {
}
async function saveSettings(quiet = false) {
// ISOLATION: this saves MUSIC settings (and persists active_media_server from
// the shared server toggle). The video side reuses this page but must never
// write music config — it saves via /api/video/* only. So never run here while
// on the video side, no matter what triggered it (auto-save OR manual).
if (document.body.getAttribute('data-side') === 'video') return;
// Validate file organization templates before saving
const validationErrors = validateFileOrganizationTemplates();
if (validationErrors.length > 0) {
@ -2888,6 +2887,14 @@ async function saveSettings(quiet = false) {
} else if (document.getElementById('soulsync-toggle')?.classList.contains('active')) {
activeServer = 'soulsync';
}
// ISOLATION: this page is reused on the video side. Connection details (Plex/
// Jellyfin creds) ARE shared and save fine — but the video side must NEVER
// change the MUSIC active server. So when saving from the video side, keep
// active_media_server exactly as it was persisted (the toggle there only opens
// a config panel; it does not pick the music server).
if (document.body.getAttribute('data-side') === 'video' && window._persistedActiveServer) {
activeServer = window._persistedActiveServer;
}
const metadataSourceSelect = document.getElementById('metadata-fallback-source');
const discogsTokenInput = document.getElementById('discogs-token');