From 2d9914c45807d558250550e413b58d44ec25b953 Mon Sep 17 00:00:00 2001 From: lllllllillllllillll Date: Sat, 4 May 2024 01:18:51 -0700 Subject: [PATCH] Added Install Alerts --- controllers/dashboard.js | 26 +++++++++++++++----------- router/index.js | 2 +- views/dashboard.html | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/controllers/dashboard.js b/controllers/dashboard.js index 28e94a6..925f491 100644 --- a/controllers/dashboard.js +++ b/controllers/dashboard.js @@ -120,6 +120,10 @@ export const DashboardAction = async (req, res) => { await Permission.update({ hide: false }, { where: { user: req.session.user } }); res.send("ok"); return; + case 'alert': + req.session.alert = ''; + res.send(''); + return; } function status (state) { @@ -331,17 +335,17 @@ export const Stats = async (req, res) => { // Imported by utils/install.js export async function addAlert (session, name) { - session.alert = ``; + session.alert = ``; } export const UpdatePermissions = async (req, res) => { diff --git a/router/index.js b/router/index.js index 0bcf10e..b5b8f01 100644 --- a/router/index.js +++ b/router/index.js @@ -36,7 +36,7 @@ const permissionCheck = async (req, res, next) => { let action = req.path.split("/")[2]; let trigger = req.header('hx-trigger-name'); const userAction = ['start', 'stop', 'restart', 'pause', 'uninstall', 'upgrade', 'edit', 'logs', 'view']; - const userPaths = ['card', 'updates', 'hide', 'reset']; + const userPaths = ['card', 'updates', 'hide', 'reset', 'alert']; if (userAction.includes(action)) { let permission = await Permission.findOne({ where: { containerName: trigger, user: user }, attributes: [`${action}`] }); if (permission) { diff --git a/views/dashboard.html b/views/dashboard.html index a8772b0..de2b065 100644 --- a/views/dashboard.html +++ b/views/dashboard.html @@ -7,8 +7,8 @@ DweebUI - Dashboard - - + +