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);