mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 08:36:13 +00:00
fix(web): skip auto-discovery on page load when periodic discovery is disabled
When `discovery_enabled` is false the page no longer fires a discovery scan on load. Both DOMContentLoaded handlers now await fetchSettings() and gate triggerDiscovery() on the returned flag — default true keeps existing behaviour for installations that never touched the setting. Also renames the UI label from "Enable Automated Discovery" to "Enable Periodic Discovery" to make clear the checkbox controls the background timer, not the manual trigger button or IP-entry form. Relates to #269 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1eb1fefc1d
commit
38c771ad75
@@ -216,7 +216,7 @@
|
||||
<strong>Device Discovery:</strong>
|
||||
<div style="margin-top: 5px">
|
||||
<label style="display: block; margin-bottom: 5px">
|
||||
<input type="checkbox" id="discovery-enabled"/> Enable Automated Discovery
|
||||
<input type="checkbox" id="discovery-enabled"/> Enable Periodic Discovery
|
||||
</label>
|
||||
<div style="margin-left: 20px">
|
||||
<label for="discovery-interval">Discovery Interval:</label>
|
||||
|
||||
@@ -382,6 +382,7 @@ async function fetchSettings() {
|
||||
|
||||
fetchLoggingSettings();
|
||||
fetchSpotifyStatus();
|
||||
return settings;
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch settings", error);
|
||||
}
|
||||
@@ -1665,8 +1666,10 @@ function formatXML(xml) {
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
fetchSettings();
|
||||
triggerDiscovery();
|
||||
const cfg = await fetchSettings();
|
||||
if (cfg?.discovery_enabled !== false) {
|
||||
triggerDiscovery();
|
||||
}
|
||||
fetchVersion();
|
||||
await fetchDevices();
|
||||
|
||||
@@ -4051,10 +4054,12 @@ async function applyCustomPlan() {
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
fetchDevices();
|
||||
fetchSettings();
|
||||
triggerDiscovery();
|
||||
const cfg = await fetchSettings();
|
||||
if (cfg?.discovery_enabled !== false) {
|
||||
triggerDiscovery();
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user