diff --git a/db/knex_migrations/2023-10-05-1200-add-disable-url-to-notification.js b/db/knex_migrations/2023-10-05-1200-add-disable-url-to-notification.js deleted file mode 100644 index 7121720cb..000000000 --- a/db/knex_migrations/2023-10-05-1200-add-disable-url-to-notification.js +++ /dev/null @@ -1,11 +0,0 @@ -exports.up = function (knex) { - return knex.schema.alterTable("notification", function (table) { - table.boolean("disable_url").defaultTo(false).notNullable().comment("Disable URL in Discord notifications"); - }); -}; - -exports.down = function (knex) { - return knex.schema.alterTable("notification", function (table) { - table.dropColumn("disable_url"); - }); -}; diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 5cd419608..9ea260410 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -46,10 +46,10 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - { + ...(!notification.disableUrl ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: notification.disableUrl ? "Hidden" : this.extractAddress(monitorJSON), - }, + value: this.extractAddress(monitorJSON), + }] : []), { name: `Time (${heartbeatJSON["timezone"]})`, value: heartbeatJSON["localDateTime"], @@ -83,10 +83,10 @@ class Discord extends NotificationProvider { name: "Service Name", value: monitorJSON["name"], }, - { + ...(!notification.disableUrl ? [{ name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: notification.disableUrl ? "Hidden" : this.extractAddress(monitorJSON), - }, + value: this.extractAddress(monitorJSON), + }] : []), { name: `Time (${heartbeatJSON["timezone"]})`, value: heartbeatJSON["localDateTime"], diff --git a/server/server.js b/server/server.js index 17c8f6375..ec5ad49f6 100644 --- a/server/server.js +++ b/server/server.js @@ -313,32 +313,6 @@ let needSetup = false; const statusPageRouter = require("./routers/status-page-router"); app.use(statusPageRouter); - // Update notification - app.put("/notification/:id", async (req, res) => { - try { - await R.exec("UPDATE notification SET disableUrl = ? WHERE id = ?", [ - req.body.disableUrl || false, - req.params.id, - ]); - - res.status(200).send({ message: "Notification updated successfully" }); - } catch (error) { - res.status(500).send({ error: "Failed to update notification" }); - } - }); - - // Get notification - app.get("/notification/:id", async (req, res) => { - try { - const notification = await R.findOne("notification", " id = ? ", [ req.params.id ]); - res.json({ - disableUrl: notification.disableUrl, - }); - } catch (error) { - res.status(500).send({ error: "Failed to retrieve notification" }); - } - }); - // Universal Route Handler, must be at the end of all express routes. app.get("*", async (_request, response) => { if (_request.originalUrl.startsWith("/upload/")) { diff --git a/src/components/notifications/Discord.vue b/src/components/notifications/Discord.vue index 2c8e7d2e7..40d2f204e 100644 --- a/src/components/notifications/Discord.vue +++ b/src/components/notifications/Discord.vue @@ -55,10 +55,9 @@
-
- - + +