From 526c603ecb1b0faef1d6c8e425bbc8c8bf8e5bda Mon Sep 17 00:00:00 2001 From: robertvoy Date: Sat, 19 Jul 2025 21:13:16 +1000 Subject: [PATCH] fixed cloudflare banner button not resetting host address --- web/main.js | 12 +++--------- web/ui.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/web/main.js b/web/main.js index f200ad4..4ae885c 100644 --- a/web/main.js +++ b/web/main.js @@ -990,15 +990,9 @@ class DistributedExtension { // Save the detected IP (pass true to suppress notification) await this.api.updateMaster({ host: data.recommended_ip }); - // Show a single combined notification - if (app.extensionManager?.toast) { - app.extensionManager.toast.add({ - severity: "info", - summary: "Master IP Auto-Detected", - detail: `Master IP set to ${data.recommended_ip} for remote worker communication`, - life: 5000 - }); - } + // Update local config immediately + if (!this.config.master) this.config.master = {}; + this.config.master.host = data.recommended_ip; } } catch (error) { this.log("Error detecting master IP: " + error.message, "error"); diff --git a/web/ui.js b/web/ui.js index 9bc0411..93b6274 100644 --- a/web/ui.js +++ b/web/ui.js @@ -419,12 +419,21 @@ export class DistributedUI { host: "" }); + // Clear the local config host so detectMasterIP() doesn't skip + if (extension.config?.master) { + extension.config.master.host = ""; + } + // The API call above doesn't trigger auto-detection, so we need to do it await extension.detectMasterIP(); // Reload config to get the new detected IP await extension.loadConfig(); + // Log the new master URL for debugging + const newMasterUrl = extension.getMasterUrl(); + extension.log(`Master host reset. New URL: ${newMasterUrl}`, "info"); + // Update UI if sidebar is open if (extension.panelElement) { const hostInput = document.getElementById('master-host'); @@ -433,11 +442,11 @@ export class DistributedUI { } } - // Show success message + // Show success message with the actual URL that will be used extension.app.extensionManager.toast.add({ severity: "success", summary: "Master Host Reset", - detail: `IP auto-detected: ${extension.config?.master?.host || 'detecting...'}`, + detail: `New address: ${newMasterUrl}`, life: 4000 });