Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: Add Public URL setting for email notifications

rcourtman6f794753ee78
diff --git a/frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx b/frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx
index 0e1a937929..0063beaf44 100644
--- a/frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx
@@ -31,6 +31,8 @@ interface NetworkSettingsPanelProps {
setAllowedEmbedOrigins: Setter<string>;
webhookAllowedPrivateCIDRs: Accessor<string>;
setWebhookAllowedPrivateCIDRs: Setter<string>;
+ publicURL: Accessor<string>;
+ setPublicURL: Setter<string>;
// Handlers
handleDiscoveryEnabledChange: (enabled: boolean) => Promise<boolean>;
@@ -417,6 +419,73 @@ export const NetworkSettingsPanel: Component<NetworkSettingsPanelProps> = (props
</Show>
</section>
+ {/* Public URL Setting */}
+ <section class="space-y-3">
+ <h4 class="flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300">
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ >
+ <path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"></path>
+ <path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"></path>
+ </svg>
+ Public URL
+ </h4>
+ <div class="space-y-2">
+ <label class="text-sm font-medium text-gray-900 dark:text-gray-100">
+ Dashboard URL for Notifications
+ </label>
+ <p class="text-xs text-gray-600 dark:text-gray-400">
+ The URL included in email alerts to link back to Pulse. Required for Docker deployments with custom ports.
+ </p>
+ <div class="relative">
+ <input
+ type="text"
+ value={props.publicURL()}
+ onChange={(e) => {
+ if (!props.envOverrides().publicURL) {
+ props.setPublicURL(e.currentTarget.value);
+ props.setHasUnsavedChanges(true);
+ }
+ }}
+ disabled={props.envOverrides().publicURL}
+ placeholder="http://192.168.1.100:8080"
+ class={`w-full px-3 py-1.5 text-sm border rounded-lg ${
+ props.envOverrides().publicURL
+ ? 'border-amber-300 dark:border-amber-600 bg-amber-50 dark:bg-amber-900/20 cursor-not-allowed opacity-75'
+ : 'border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800'
+ }`}
+ />
+ {props.envOverrides().publicURL && (
+ <div class="mt-2 p-2 bg-amber-100 dark:bg-amber-900/30 border border-amber-300 dark:border-amber-700 rounded text-xs text-amber-800 dark:text-amber-200">
+ <div class="flex items-center gap-1">
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
+ />
+ </svg>
+ <span>Overridden by PULSE_PUBLIC_URL environment variable</span>
+ </div>
+ <div class="mt-1 text-amber-700 dark:text-amber-300">
+ Remove the env var and restart to enable UI configuration
+ </div>
+ </div>
+ )}
+ </div>
+ <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
+ Example: If you access Pulse at <code>http://myserver:8080</code>, enter that URL here.
+ Leave empty to auto-detect (may not work correctly with Docker port mappings).
+ </p>
+ </div>
+ </section>
+
{/* CORS Settings Section */}
<section class="space-y-3">
<h4 class="flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300">
diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx
index 5d4c6afd71..b7e115f64a 100644
--- a/frontend-modern/src/components/Settings/Settings.tsx
+++ b/frontend-modern/src/components/Settings/Settings.tsx
@@ -747,6 +747,9 @@ const Settings: Component<SettingsProps> = (props) => {
// Webhook security settings
const [webhookAllowedPrivateCIDRs, setWebhookAllowedPrivateCIDRs] = createSignal('');
+ // Public URL for notifications
+ const [publicURL, setPublicURL] = createSignal('');
+
// Update settings
const [versionInfo, setVersionInfo] = createSignal<VersionInfo | null>(null);
const [updateInfo, setUpdateInfo] = createSignal<UpdateInfo | null>(null);
@@ -1764,6 +1767,8 @@ const Settings: Component<SettingsProps> = (props) => {
setAllowedEmbedOrigins(systemSettings.allowedEmbedOrigins || '');
// Load webhook security settings
setWebhookAllowedPrivateCIDRs(systemSettings.webhookAllowedPrivateCIDRs || '');
+ // Load public URL for notifications
+ setPublicURL(systemSettings.publicURL || '');
setTemperatureMonitoringEnabled(
typeof systemSettings.temperatureMonitoringEnabled === 'boolean'
? systemSettings.temperatureMonitoringEnabled
@@ -1903,6 +1908,7 @@ const Settings: Component<SettingsProps> = (props) => {
allowEmbedding: allowEmbedding(),
allowedEmbedOrigins: allowedEmbedOrigins(),
webhookAllowedPrivateCIDRs: webhookAllowedPrivateCIDRs(),
+ publicURL: publicURL(),
});
}
@@ -3385,6 +3391,8 @@ const Settings: Component<SettingsProps> = (props) => {
setAllowedEmbedOrigins={setAllowedEmbedOrigins}
webhookAllowedPrivateCIDRs={webhookAllowedPrivateCIDRs}
setWebhookAllowedPrivateCIDRs={setWebhookAllowedPrivateCIDRs}
+ publicURL={publicURL}
+ setPublicURL={setPublicURL}
handleDiscoveryEnabledChange={handleDiscoveryEnabledChange}
handleDiscoveryModeChange={handleDiscoveryModeChange}
setDiscoveryMode={setDiscoveryMode}
diff --git a/frontend-modern/src/types/config.ts b/frontend-modern/src/types/config.ts
index 438376cba6..9483e639a3 100644
--- a/frontend-modern/src/types/config.ts
+++ b/frontend-modern/src/types/config.ts
@@ -48,6 +48,7 @@ export interface SystemConfig {
allowedEmbedOrigins?: string; // Comma-separated list of allowed origins for embedding
webhookAllowedPrivateCIDRs?: string; // Comma-separated list of private CIDR ranges allowed for webhooks (e.g., "192.168.1.0/24,10.0.0.0/8")
hideLocalLogin?: boolean; // Hide local login form (username/password)
+ publicURL?: string; // Public URL for email notifications (e.g., http://192.168.1.100:8080)
}
/**
diff --git a/internal/api/system_settings.go b/internal/api/system_settings.go
index 2e5e288f6f..f022df31f7 100644
--- a/internal/api/system_settings.go
+++ b/internal/api/system_settings.go
@@ -582,6 +582,10 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWriter
if _, ok := rawRequest["webhookAllowedPrivateCIDRs"]; ok {
settings.WebhookAllowedPrivateCIDRs = updates.WebhookAllowedPrivateCIDRs
}
+ // Allow configuring public URL for notifications (used in email alerts)
+ if _, ok := rawRequest["publicURL"]; ok {
+ settings.PublicURL = updates.PublicURL
+ }
// Boolean fields need special handling since false is a valid value
if _, ok := rawRequest["autoUpdateEnabled"]; ok {
@@ -740,6 +744,17 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWriter
}
}
+ // Update public URL for notifications if changed
+ if _, ok := rawRequest["publicURL"]; ok {
+ h.config.PublicURL = settings.PublicURL
+ if h.monitor != nil {
+ if nm := h.monitor.GetNotificationManager(); nm != nil {
+ nm.SetPublicURL(settings.PublicURL)
+ log.Info().Str("publicURL", settings.PublicURL).Msg("Updated notification public URL from settings")
+ }
+ }
+ }
+
// Save to persistence
if err := h.persistence.SaveSystemSettings(settings); err != nil {
log.Error().Err(err).Msg("Failed to save system settings")
diff --git a/internal/config/config.go b/internal/config/config.go
index 94fb252b88..2207041c0b 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -689,6 +689,10 @@ func Load() (*Config, error) {
}
// Load HideLocalLogin
cfg.HideLocalLogin = systemSettings.HideLocalLogin
+ // Load PublicURL from settings (will be overridden by env var if set)
+ if systemSettings.PublicURL != "" {
+ cfg.PublicURL = systemSettings.PublicURL
+ }
// Load metrics retention settings (only override if explicitly set)
if systemSettings.MetricsRetentionRawHours > 0 {
diff --git a/internal/config/persistence.go b/internal/config/persistence.go
index 39313ac0e0..2258f5ab71 100644
--- a/internal/config/persistence.go
+++ b/internal/config/persistence.go
@@ -946,6 +946,7 @@ type SystemSettings struct {
SSHPort int `json:"sshPort,omitempty"` // Default SSH port for temperature monitoring (0 = use 22)
WebhookAllowedPrivateCIDRs string `json:"webhookAllowedPrivateCIDRs,omitempty"` // Comma-separated list of private CIDR ranges allowed for webhooks (e.g., "192.168.1.0/24,10.0.0.0/8")
HideLocalLogin bool `json:"hideLocalLogin"` // Hide local login form (username/password)
+ PublicURL string `json:"publicURL,omitempty"` // Public URL for email notifications (e.g., http://192.168.1.100:8080)
// Metrics retention configuration (in hours)
// These control how long historical metrics are stored at each aggregation tier.