mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 00:56:16 +00:00
refactor(web): prune deprecated hosts-redirection-test markup and JS
The /etc/hosts migration method has been hidden from the UI since
before the wizard refactor — the Customize three-axis form doesn't
expose it, the suggested-plan engine never picks it, and
onCustomizeChange explicitly force-hides the legacy
#hosts-redirection-test pane. The pane was sitting in the DOM doing
nothing.
Removed:
- The hosts-redirection-test <div> (button, result pane, header)
- test-hosts-btn.onclick wiring in showSummary
- The testHostsRedirection() function (orphaned once the button is
gone)
- The show("hosts-redirection-test", false) toggle in
onCustomizeChange (orphaned once the pane is gone)
Backend untouched:
- /setup/test-hosts/{deviceId} and HandleTestHostsRedirection still
exist for API back-compat. Same pattern we used when retiring the
XML method's self/proxied/original dropdowns — only the UI
surface moves; the manager-level entry points stay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
441632b642
commit
8a61c43cfa
@@ -673,54 +673,6 @@
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="hosts-redirection-test"
|
||||
style="
|
||||
margin: 15px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fff4e6;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
<strong>Preliminary /etc/hosts Test:</strong><br/>
|
||||
<span style="font-size: 0.85em; color: #555"
|
||||
>Verify the device's /etc/hosts mechanism before
|
||||
full migration.</span
|
||||
>
|
||||
<div style="margin-top: 10px">
|
||||
Domain: <code>custom-test-api.bose.fake</code>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<button
|
||||
id="test-hosts-btn"
|
||||
style="
|
||||
background-color: #ff9800;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 5px 10px;
|
||||
font-size: 0.9em;
|
||||
"
|
||||
>
|
||||
Test Hosts Redirection
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
id="hosts-test-result"
|
||||
style="
|
||||
margin-top: 10px;
|
||||
display: none;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
font-family: monospace;
|
||||
white-space: pre-wrap;
|
||||
font-size: 0.85em;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="dns-redirection-test"
|
||||
style="
|
||||
|
||||
@@ -1848,7 +1848,6 @@ async function showSummary(deviceId) {
|
||||
|
||||
document.getElementById("test-connection-explicit-btn").onclick = () => testConnection(deviceId, true);
|
||||
document.getElementById("test-connection-trusted-btn").onclick = () => testConnection(deviceId, false);
|
||||
document.getElementById("test-hosts-btn").onclick = () => testHostsRedirection(deviceId);
|
||||
document.getElementById("test-dns-btn").onclick = () => testDNSRedirection(deviceId);
|
||||
|
||||
renderCustomizeForm(summary);
|
||||
@@ -2404,34 +2403,6 @@ async function testConnection(deviceId, useExplicitCA) {
|
||||
}
|
||||
}
|
||||
|
||||
async function testHostsRedirection(deviceId) {
|
||||
const targetUrl = document.getElementById("target-domain").value;
|
||||
const testResultDiv = document.getElementById("hosts-test-result");
|
||||
const display = getDeviceDisplayName(deviceId);
|
||||
|
||||
testResultDiv.style.display = "block";
|
||||
testResultDiv.style.backgroundColor = "#f0f0f0";
|
||||
testResultDiv.style.color = "black";
|
||||
testResultDiv.innerText = "Running hosts redirection test from " + display + "...\n(This may take a few seconds)";
|
||||
|
||||
try {
|
||||
const query = `?target_url=${encodeURIComponent(targetUrl)}`;
|
||||
const response = await fetch(`/setup/test-hosts/${encodeURIComponent(deviceId)}${query}`, {method: "POST"},);
|
||||
const result = await response.json();
|
||||
|
||||
if (result.ok) {
|
||||
testResultDiv.style.backgroundColor = "#ccffcc";
|
||||
testResultDiv.innerText = "✅ " + result.message + "\n\nOutput:\n" + result.output;
|
||||
} else {
|
||||
testResultDiv.style.backgroundColor = "#ffcccc";
|
||||
testResultDiv.innerText = "❌ Test failed: " + result.message + "\n\nOutput:\n" + result.output;
|
||||
}
|
||||
} catch (error) {
|
||||
testResultDiv.style.backgroundColor = "#ffcccc";
|
||||
testResultDiv.innerText = "❌ Error triggering test: " + error;
|
||||
}
|
||||
}
|
||||
|
||||
async function testDNSRedirection(deviceId) {
|
||||
const targetUrl = document.getElementById("target-domain").value;
|
||||
const testResultDiv = document.getElementById("dns-test-result");
|
||||
@@ -3662,7 +3633,6 @@ function onCustomizeChange() {
|
||||
show("resolv-diff-row", dns === "resolv");
|
||||
show("telnet-method-pane", flip === "telnet");
|
||||
show("dns-redirection-test", dns === "resolv");
|
||||
show("hosts-redirection-test", false);
|
||||
|
||||
// Validate the combination and toggle the Apply button.
|
||||
const errors = [];
|
||||
|
||||
Reference in New Issue
Block a user