From 8a61c43cfa897f3b074f42f371c251eed6630eec Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Mon, 11 May 2026 00:03:26 +0200 Subject: [PATCH] refactor(web): prune deprecated hosts-redirection-test markup and JS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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
(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) --- pkg/service/handlers/web/index.html | 48 --------------------------- pkg/service/handlers/web/js/script.js | 30 ----------------- 2 files changed, 78 deletions(-) diff --git a/pkg/service/handlers/web/index.html b/pkg/service/handlers/web/index.html index b687048..a8e3c34 100644 --- a/pkg/service/handlers/web/index.html +++ b/pkg/service/handlers/web/index.html @@ -673,54 +673,6 @@ >
-
- Preliminary /etc/hosts Test:
- Verify the device's /etc/hosts mechanism before - full migration. -
- Domain: custom-test-api.bose.fake -
-
- -
-
-
-
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 = [];