diff --git a/public/app/toast.js b/public/app/toast.js index b8caf078..6033917d 100644 --- a/public/app/toast.js +++ b/public/app/toast.js @@ -1,9 +1,20 @@ +const fs = require('fs'); +const path = require('path'); const { Notification } = require('electron'); const NOTIFICATION_TITLE = 'LedFx Client - by Blade'; const NOTIFICATION_BODY = 'Testing Notification from the Main process'; +function getConfig() { + const configPath = path.join(path.dirname(__dirname), isDev ? '../' : '../../', 'frontend_config.json') + const configData = fs.readFileSync(configPath); + return JSON.parse(configData); +} + function showNotification(title = NOTIFICATION_TITLE, body = NOTIFICATION_BODY) { + const config = getConfig(); + const updateUrl = config.updateUrl; + new Notification({ toastXml: ` @@ -13,10 +24,10 @@ function showNotification(title = NOTIFICATION_TITLE, body = NOTIFICATION_BODY) - + `, - }).show(); + }).show(); } -module.exports = { showNotification }; \ No newline at end of file +module.exports = { showNotification }; diff --git a/public/frontend_config.json b/public/frontend_config.json new file mode 100644 index 00000000..684fd11e --- /dev/null +++ b/public/frontend_config.json @@ -0,0 +1,3 @@ +{ + "updateUrl": "https://api.github.com/repos/YeonV/LedFx-Builds/releases/latest" +} \ No newline at end of file