Skip to content

Commit

Permalink
Merge pull request #686 from cozy-labs/electron-updater
Browse files Browse the repository at this point in the history
Electron updater
  • Loading branch information
sebn authored May 11, 2017
2 parents c22c788 + 7ea3b22 commit 5f45ef5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
10 changes: 2 additions & 8 deletions gui/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const os = require('os')
const path = require('path')
const {spawn} = require('child_process')

const {app, autoUpdater, BrowserWindow, dialog, ipcMain, Menu, shell, session} = electron
const {app, BrowserWindow, dialog, ipcMain, Menu, shell, session} = electron
const autoUpdater = require('electron-updater').autoUpdater
const autoLauncher = new AutoLaunch({
name: 'Cozy-Desktop',
isHidden: true
Expand Down Expand Up @@ -50,10 +51,6 @@ const platformName = () => {
}
}

// This server is used for checking if a new release is available
// and installing the updates
const nutsServer = 'https://nuts.cozycloud.cc'

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
Expand Down Expand Up @@ -168,9 +165,7 @@ const setTrayIcon = (state) => {
}

const checkForNewRelease = () => {
const arch = os.arch()
const platform = os.platform()
const version = app.getVersion()
if (platform !== 'darwin' && platform !== 'win32') {
return
}
Expand All @@ -181,7 +176,6 @@ const checkForNewRelease = () => {
sendToMainWindow('new-release-available', releaseNotes || '', releaseName || '')
})
autoUpdater.addListener('error', (err) => console.error(err))
autoUpdater.setFeedURL(`${nutsServer}/update/${platform}_${arch}/${version}`)
autoUpdater.checkForUpdates()
setInterval(() => {
autoUpdater.checkForUpdates()
Expand Down
1 change: 1 addition & 0 deletions gui/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"auto-launch-patched": "5.0.2",
"cozy-desktop": "file:../../",
"electron-main-notification": "1.0.1",
"electron-updater": "1.15.0",
"lodash.debounce": "4.0.8"
}
}
5 changes: 1 addition & 4 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"appId": "io.cozy.desktop",
"productName": "Cozy Desktop",
"win": {
"certificateSubjectName": "Cozy Cloud SAS",
"target": [
"squirrel"
]
"certificateSubjectName": "Cozy Cloud SAS"
},
"linux": {
"target": [
Expand Down

0 comments on commit 5f45ef5

Please sign in to comment.