mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-20 17:46:19 +00:00
Enhance and group device discovery settings in web UI (#169)
This commit is contained in:
@@ -86,7 +86,6 @@ func (s *Server) HandleTriggerDiscovery(w http.ResponseWriter, _ *http.Request)
|
||||
go s.DiscoverDevices(context.Background())
|
||||
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
_, _ = w.Write([]byte(`{"status": "Discovery started"}`))
|
||||
}
|
||||
|
||||
// HandleGetDiscoveryStatus returns the current discovery status.
|
||||
|
||||
@@ -152,9 +152,16 @@
|
||||
<span style="font-size: 0.8em; color: #666">(Standard services URL)</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 20px">
|
||||
<label for="discovery-interval">Discovery Interval:</label>
|
||||
<input type="text" id="discovery-interval" placeholder="5m" style="width: 100px"/>
|
||||
<label style="margin-left: 15px"><input type="checkbox" id="discovery-enabled"/> Enable Automated Discovery</label>
|
||||
<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
|
||||
</label>
|
||||
<div style="margin-left: 20px">
|
||||
<label for="discovery-interval">Discovery Interval:</label>
|
||||
<input type="text" id="discovery-interval" placeholder="5m" style="width: 100px"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-bottom: 20px">
|
||||
<strong>DNS Discovery:</strong>
|
||||
|
||||
@@ -1535,7 +1535,13 @@ async function triggerDiscovery() {
|
||||
const indicator = document.getElementById("discovery-indicator");
|
||||
if (indicator) indicator.style.display = "inline";
|
||||
try {
|
||||
await fetch("/setup/discover", {method: "POST"});
|
||||
const response = await fetch("/setup/discover", {method: "POST"});
|
||||
if (!response.ok) {
|
||||
const err = await response.text();
|
||||
alert("Failed to start discovery: " + err);
|
||||
if (indicator) indicator.style.display = "none";
|
||||
return;
|
||||
}
|
||||
pollDiscoveryStatus();
|
||||
} catch (error) {
|
||||
console.error("Failed to trigger discovery", error);
|
||||
|
||||
Reference in New Issue
Block a user