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; } } });