Fix dashboard metadata source testing

- Point the dashboard Test Connection button at the active metadata source instead of hardcoded Spotify.
- Populate the response line from the current status payload so the card no longer stays at Response: --.
- Keep the existing Spotify-specific auth handling when Spotify is the configured source.
This commit is contained in:
Antti Kettunen 2026-05-02 10:17:05 +03:00
parent 5ef83cea72
commit 1d9d399a2f
No known key found for this signature in database
GPG key ID: C6B2A3D250359BD7
3 changed files with 19 additions and 1 deletions

View file

@ -626,7 +626,7 @@
<p class="service-card-response-time" id="spotify-response-time">Response: --</p>
<div class="service-card-footer">
<button class="service-card-button"
onclick="testDashboardConnection('spotify')">Test Connection</button>
onclick="testDashboardConnection(getActiveMetadataSource())">Test Connection</button>
</div>
</div>
<div class="service-card" id="media-server-service-card">

View file

@ -885,4 +885,8 @@ const API = {
let _lastServiceStatus = null;
let _isSoulsyncStandalone = false; // Global flag: true when no media server (sync buttons hidden)
function getActiveMetadataSource() {
return _lastServiceStatus?.spotify?.source || 'spotify';
}
// ===============================

View file

@ -3323,6 +3323,20 @@ function updateServiceStatus(service, statusData) {
}
syncPrimaryMetadataSourceAvailability(statusData);
const responseTimeElement = document.getElementById('spotify-response-time');
if (responseTimeElement) {
const responseTime = statusData.response_time;
responseTimeElement.textContent = responseTime !== undefined && responseTime !== null
? `Response: ${responseTime}ms`
: 'Response: --';
}
const testButton = document.querySelector('#spotify-service-card .service-card-button');
if (testButton) {
const source = statusData.source || 'spotify';
testButton.setAttribute('onclick', `testDashboardConnection('${source}')`);
}
}
// Update download source title on dashboard card