add condition URL for dev and prod

This commit is contained in:
Abhinav-grd 2021-04-01 13:23:44 +05:30
parent b7561db05f
commit 182602dfa3
3 changed files with 16 additions and 6 deletions

View file

@ -32,5 +32,7 @@
"promise-fs": "^2.1.1",
"typescript": "^4.2.3"
},
"dependencies": {}
"dependencies": {
"electron-is-dev": "^2.0.0"
}
}

View file

@ -9,6 +9,7 @@ import {
ipcMain,
} from 'electron';
import * as path from 'path';
import * as isDev from 'electron-is-dev';
let appIsQuitting = false;
let tray: Tray;
@ -24,11 +25,13 @@ function createWindow() {
});
mainWindow.setMenu(buildMenuBar());
// and load the index.html of the app.
mainWindow.loadURL('http://localhost:3000');
// Open the DevTools.
mainWindow.webContents.openDevTools();
if (isDev) {
mainWindow.loadURL('http://localhost:3000');
// Open the DevTools.
mainWindow.webContents.openDevTools();
} else {
mainWindow.loadURL('http://photos.ente.io');
}
mainWindow.on('minimize', function (event: any) {
event.preventDefault();
mainWindow.hide();

View file

@ -900,6 +900,11 @@ electron-builder@^22.10.5:
update-notifier "^5.1.0"
yargs "^16.2.0"
electron-is-dev@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-2.0.0.tgz#833487a069b8dad21425c67a19847d9064ab19bd"
integrity sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA==
electron-publish@22.10.5:
version "22.10.5"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-22.10.5.tgz#9cbe46266b6c79d8c6e99840755682e2262d3543"