From 40bea35286c5d3c58e7bc6d4d309077047a85b68 Mon Sep 17 00:00:00 2001
From: MasterAcnolo <68693319+MasterAcnolo@users.noreply.github.com>
Date: Mon, 13 Apr 2026 20:39:23 +0200
Subject: [PATCH] Feat: Implement notification feature for download completion
---
app/ipcHandlers.js | 3 ++-
public/index.html | 4 ++--
public/script/downloadstatus.js | 7 +++++--
server/controller/download.controller.js | 3 ++-
server/helpers/notify.helpers.js | 4 +++-
5 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/app/ipcHandlers.js b/app/ipcHandlers.js
index 25490d0..bd04fe6 100644
--- a/app/ipcHandlers.js
+++ b/app/ipcHandlers.js
@@ -18,7 +18,8 @@ const FEATURE_WHITELIST = new Set([
"autoDownloadPlaylist",
"customCodec",
"theme",
- "createPlaylistFolders"
+ "createPlaylistFolders",
+ "notifySystem"
]);
const configFolderPath = featuresPath;
diff --git a/public/index.html b/public/index.html
index c27cd5e..c684b4a 100644
--- a/public/index.html
+++ b/public/index.html
@@ -97,13 +97,13 @@
-
+
diff --git a/public/script/downloadstatus.js b/public/script/downloadstatus.js
index 140d217..b6362ec 100644
--- a/public/script/downloadstatus.js
+++ b/public/script/downloadstatus.js
@@ -44,8 +44,11 @@ form.addEventListener("submit", async (e) => {
return;
}
- // Download successful
- window.showSuccess("Download completed!");
+ // Download successful - check if notifications are enabled
+ const features = await window.electronAPI.getFeatures();
+ if (features.notifySystem) {
+ window.showSuccess("Download completed!");
+ }
} catch (err) {
if (!isDownloading && !userStoppedDownload) {
diff --git a/server/controller/download.controller.js b/server/controller/download.controller.js
index c586e21..f8f84c8 100644
--- a/server/controller/download.controller.js
+++ b/server/controller/download.controller.js
@@ -2,6 +2,7 @@ const { fetchDownload, cancelDownload } = require("../services/download.services
const { logger } = require("../logger");
const { isValidUrl, isSafePath } = require("../helpers/validation.helpers");
const { notifyDownloadFinished } = require("../helpers/notify.helpers");
+const { configFeatures } = require("../../config");
const listeners = [];
const speedListeners = [];
@@ -26,7 +27,7 @@ async function downloadController(req, res) {
// Get output folder when the download is finished
const outputFolder = await fetchDownload(options, listeners, speedListeners, stageListeners, playlistInfoListeners);
- notifyDownloadFinished(outputFolder);
+ notifyDownloadFinished(outputFolder, configFeatures.notifySystem);
res.send("Download Done !");
} catch (err) {
diff --git a/server/helpers/notify.helpers.js b/server/helpers/notify.helpers.js
index 16268b1..20ef59e 100644
--- a/server/helpers/notify.helpers.js
+++ b/server/helpers/notify.helpers.js
@@ -1,7 +1,9 @@
const { Notification, shell } = require("electron");
const { iconPaths } = require("./path.helpers");
-function notifyDownloadFinished(folder) {
+function notifyDownloadFinished(folder, notifyEnabled = true) {
+ if (!notifyEnabled) return;
+
const notif = new Notification({
title: "Freedom Loader",
body: "Your download is complete, click here to open it.",