diff --git a/client/src/Pages/v1/Settings/index.jsx b/client/src/Pages/v1/Settings/index.jsx index b6137121b..2cb794b77 100644 --- a/client/src/Pages/v1/Settings/index.jsx +++ b/client/src/Pages/v1/Settings/index.jsx @@ -80,11 +80,6 @@ const Settings = () => { const handleChange = async (e) => { const { name, value, checked } = e.target; - // Special case for showURL until handled properly in the backend - if (name === "showURL") { - dispatch(setShowURL(value)); - return; - } let newValue; if ( name === "systemEmailIgnoreTLS" || @@ -167,6 +162,11 @@ const Settings = () => { } setSettingsData(newSettingsData); + + // Update Redux immediately for UI feedback + if (name === "showURL") { + dispatch(setShowURL(newValue ?? value)); + } }; const handleSave = () => { diff --git a/server/src/controllers/v1/settingsController.ts b/server/src/controllers/v1/settingsController.ts index 5d3f6ed0e..30b4cf8ea 100644 --- a/server/src/controllers/v1/settingsController.ts +++ b/server/src/controllers/v1/settingsController.ts @@ -57,6 +57,10 @@ class SettingsController { }; updateAppSettings = async (req: Request, res: Response, next: NextFunction) => { + // Diagnostics: capture inbound payload + // eslint-disable-next-line no-console + console.log("=== SETTINGS CONTROLLER REQUEST BODY ===", req.body); + await updateAppSettingsBodyValidation.validateAsync(req.body); const updatedSettings = await this.db.settingsModule.updateAppSettings(req.body); diff --git a/server/src/db/v1/modules/statusPageModule.js b/server/src/db/v1/modules/statusPageModule.js index c9027125a..48c46ad4c 100755 --- a/server/src/db/v1/modules/statusPageModule.js +++ b/server/src/db/v1/modules/statusPageModule.js @@ -217,7 +217,7 @@ class StatusPageModule { showUptimePercentage: 1, timezone: 1, showAdminLoginLink: 1, - url: { $cond: [{ $eq: ["$statusPage.showMonitorUrl", true] }, "$monitors.url", "$$REMOVE"] }, + url: 1, }, monitors: { _id: 1, @@ -261,12 +261,12 @@ class StatusPageModule { const { statusPage, monitors } = statusPageQuery[0]; const appSettings = await this.AppSettings.findOne({ singleton: true }).lean(); - const showURL = appSettings?.showURL === true; + const showURL = appSettings?.showURL === true || appSettings?.showURL === "true"; - const normalizedMonitors = monitors.map((monitor) => { - const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100); - if (showURL !== true) { - const { url, ...rest } = monitor; + const normalizedMonitors = monitors.map((monitor) => { + const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100); + if (showURL !== true) { + const { url, port, secret, notifications, ...rest } = monitor; return { ...rest, checks: normalizedChecks }; } return { ...monitor, checks: normalizedChecks }; diff --git a/server/src/service/v1/system/settingsService.js b/server/src/service/v1/system/settingsService.js index 70d8d192c..cea46f7ed 100755 --- a/server/src/service/v1/system/settingsService.js +++ b/server/src/service/v1/system/settingsService.js @@ -60,6 +60,7 @@ class SettingsService { await this.AppSettings.create({}); settings = await this.AppSettings.findOne({ singleton: true }).select("-__v -_id -createdAt -updatedAt -singleton").lean(); } + return settings; } } diff --git a/server/src/validation/joi.js b/server/src/validation/joi.js index b3342de83..d0e1aeeb3 100755 --- a/server/src/validation/joi.js +++ b/server/src/validation/joi.js @@ -413,7 +413,7 @@ const updateAppSettingsBodyValidation = joi.object({ pagespeedApiKey: joi.string().allow(""), language: joi.string().allow(""), timezone: joi.string().allow(""), - // showURL: joi.bool().required(), + showURL: joi.bool().optional(), systemEmailHost: joi.string().allow(""), systemEmailPort: joi.number().allow(""), systemEmailAddress: joi.string().allow(""),