mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Disables updates in development mode
This commit is contained in:
@@ -2,7 +2,8 @@ const electron = require('electron')
|
|||||||
const app = electron.app
|
const app = electron.app
|
||||||
const Menu = electron.Menu
|
const Menu = electron.Menu
|
||||||
const ipc = electron.ipcMain
|
const ipc = electron.ipcMain
|
||||||
const GhReleases = require('electron-gh-releases')
|
const GhReleases = require('electron-gh-releases')
|
||||||
|
const isDev = require('electron-is-dev') //isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1
|
||||||
// electron.crashReporter.start()
|
// electron.crashReporter.start()
|
||||||
var ipcServer = null
|
var ipcServer = null
|
||||||
|
|
||||||
@@ -35,6 +36,10 @@ const updater = new GhReleases(ghReleasesOpts)
|
|||||||
// Check for updates
|
// Check for updates
|
||||||
// `status` returns true if there is a new update available
|
// `status` returns true if there is a new update available
|
||||||
function checkUpdate () {
|
function checkUpdate () {
|
||||||
|
if (isDev){ //Prevents app from attempting to update when in dev mode.
|
||||||
|
console.log("Updates are disabled in Development mode, see main-app.js")
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (process.platform === 'linux' || isUpdateReady) {
|
if (process.platform === 'linux' || isUpdateReady) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -94,12 +99,12 @@ app.on('ready', function () {
|
|||||||
|
|
||||||
// Check update every day
|
// Check update every day
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
checkUpdate()
|
if(!isDev) checkUpdate()
|
||||||
}, 1000 * 60 * 60 * 24)
|
}, 1000 * 60 * 60 * 24)
|
||||||
|
|
||||||
// Check update after 10 secs to prevent file locking of Windows
|
// Check update after 10 secs to prevent file locking of Windows
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
checkUpdate()
|
if(!isDev) checkUpdate()
|
||||||
|
|
||||||
ipc.on('update-check', function (event, msg) {
|
ipc.on('update-check', function (event, msg) {
|
||||||
if (isUpdateReady) {
|
if (isUpdateReady) {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
"codemirror-mode-elixir": "^1.1.1",
|
"codemirror-mode-elixir": "^1.1.1",
|
||||||
"electron-config": "^1.0.0",
|
"electron-config": "^1.0.0",
|
||||||
"electron-gh-releases": "^2.0.4",
|
"electron-gh-releases": "^2.0.4",
|
||||||
|
"electron-is-dev": "^1.0.1",
|
||||||
"escape-string-regexp": "^1.0.5",
|
"escape-string-regexp": "^1.0.5",
|
||||||
"file-uri-to-path": "^1.0.0",
|
"file-uri-to-path": "^1.0.0",
|
||||||
"file-url": "^2.0.2",
|
"file-url": "^2.0.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user