From 0bfacbff80c3eb74f1e722332b6a23d9d66d3040 Mon Sep 17 00:00:00 2001 From: KorbsStudio Date: Sun, 12 Feb 2023 12:35:24 -0500 Subject: [PATCH] Use a ENV file --- .env | 1 + electron/index.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..9c0cbc5 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +PushyAppId="YourAppIdHere" \ No newline at end of file diff --git a/electron/index.js b/electron/index.js index 0267447..3e8814a 100644 --- a/electron/index.js +++ b/electron/index.js @@ -6,6 +6,9 @@ const isDev = require('electron-is-dev') const path = require('path') let mainWindow +require('dotenv').config() +console.log(process.env.PushyAppId); + // Use the correct icon depending on the operating system if /* If macOS */ (process.platform == 'darwin') {global.AppIcon = 'public/images/icons/app/macOS.icns' } else if /* If Windows */ (process.platform == 'win32') {global.AppIcon = 'public/images/icons/app/Windows.png' } @@ -42,12 +45,12 @@ function createWindow () { // Pushy - Pushy Notification System (PNS) mainWindow.webContents.on('did-finish-load', () => {Pushy.listen()}) - Pushy.register({ appId: 'YourAppIdHere' }).then((deviceToken) => {}).catch((error) => {console.log('Pushy registration error: ' + error.message)}) + Pushy.register({ appId: process.env.PushyAppId }).then((deviceToken) => {}).catch((error) => {console.log('Pushy registration error: ' + error.message)}) setTimeout(() => { Pushy.setNotificationListener((data) => { mainWindow.webContents.executeJavaScript(` - document.querySelector("body > div > div.sidebar > div.sidebar-bottom").insertAdjacentHTML("afterBegin",'
  • ${data.title}

    ${data.message}

  • ') + document.querySelector("body > div > div.sidebar > div.sidebar-bottom").insertAdjacentHTML("afterBegin",'
  • ${data.title}

    ${data.message}

  • ') `) }) }, 10000);