From 9b2f2fa32900dd07dba50d8a15e826475f817fd5 Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Wed, 4 Jun 2025 19:10:47 +0100 Subject: [PATCH] fix: clean host URLs in additional PVE/PBS endpoints and improve placeholders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Apply URL cleaning logic to additional PVE/PBS server configurations - Extract ports from URLs and populate port fields automatically - Update placeholders to show clean hostnames instead of full URLs - Add consistent host/port guidance text for additional endpoints - Ensure all endpoint configurations follow same clean format 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/public/js/ui/settings.js | 54 +++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/src/public/js/ui/settings.js b/src/public/js/ui/settings.js index 1589cf30b..64de669e2 100644 --- a/src/public/js/ui/settings.js +++ b/src/public/js/ui/settings.js @@ -1157,13 +1157,15 @@ PulseApp.ui.settings = (() => {
- +

IP address or hostname only (without port number)

+

Default Proxmox VE web interface port

@@ -1236,13 +1238,15 @@ PulseApp.ui.settings = (() => {
- +

IP address or hostname only (without port number)

+

Default Proxmox Backup Server web interface port

@@ -1311,7 +1315,28 @@ PulseApp.ui.settings = (() => { if (input.type === 'checkbox') { input.checked = config[configKey] !== 'false'; } else { - input.value = config[configKey]; + let value = config[configKey]; + + // Clean host values that contain protocol or port + if (configKey.includes('PROXMOX_HOST_') && value) { + // Remove protocol (http:// or https://) + value = value.replace(/^https?:\/\//, ''); + // Extract port if it's included in the host + const portMatch = value.match(/^([^:]+)(:(\d+))?$/); + if (portMatch) { + value = portMatch[1]; + // If we extracted a port and there's no explicit port config, set it + if (portMatch[3]) { + const portKey = configKey.replace('HOST_', 'PORT_'); + const portInput = newEndpoint.querySelector(`[name="${portKey}"]`); + if (portInput && !config[portKey]) { + portInput.value = portMatch[3]; + } + } + } + } + + input.value = value; } } }); @@ -1347,7 +1372,28 @@ PulseApp.ui.settings = (() => { if (input.type === 'checkbox') { input.checked = config[configKey] !== 'false'; } else { - input.value = config[configKey]; + let value = config[configKey]; + + // Clean host values that contain protocol or port + if (configKey.includes('PBS_HOST_') && value) { + // Remove protocol (http:// or https://) + value = value.replace(/^https?:\/\//, ''); + // Extract port if it's included in the host + const portMatch = value.match(/^([^:]+)(:(\d+))?$/); + if (portMatch) { + value = portMatch[1]; + // If we extracted a port and there's no explicit port config, set it + if (portMatch[3]) { + const portKey = configKey.replace('HOST_', 'PORT_'); + const portInput = newEndpoint.querySelector(`[name="${portKey}"]`); + if (portInput && !config[portKey]) { + portInput.value = portMatch[3]; + } + } + } + } + + input.value = value; } } });