mirror of
https://github.com/Kong/insomnia.git
synced 2026-05-24 08:37:35 -04:00
Move auto-updater to use github releases (#165)
* Move auto-updater to use github releases * Adjust remoteReleases * Bump version * More reliable update notification * More reliable update notifications
This commit is contained in:
@@ -51,5 +51,4 @@ deploy:
|
||||
secure: Ffmgxn+wt5WSf/jgJ/L+/3mkUs4fn9Z5j4Dz73VATsgL14Rf/xUp2nOyE0ecow+1
|
||||
artifact: dist
|
||||
on:
|
||||
branch: master
|
||||
appveyor_repo_tag: true
|
||||
|
||||
@@ -3,10 +3,14 @@ import {CHECK_FOR_UPDATES_INTERVAL, getAppVersion, isDevelopment, isLinux} from
|
||||
|
||||
const {autoUpdater, BrowserWindow} = electron;
|
||||
|
||||
const UPDATE_URLS = {
|
||||
const UPDATE_URLS = isDevelopment() ? {
|
||||
darwin: `http://localhost:8000/builds/check/mac?v=${getAppVersion()}`,
|
||||
linux: `http://localhost:8000/builds/check/linux?v=${getAppVersion()}`,
|
||||
win32: `http://localhost:8000/updates/win?v=${getAppVersion()}`
|
||||
} : {
|
||||
darwin: `https://updates.insomnia.rest/builds/check/mac?v=${getAppVersion()}`,
|
||||
linux: `https://updates.insomnia.rest/builds/check/linux?v=${getAppVersion()}`,
|
||||
win32: `https://downloads.insomnia.rest/win`
|
||||
win32: `https://updates.insomnia.rest/updates/win?v=${getAppVersion()}`
|
||||
};
|
||||
|
||||
let hasPromptedForUpdates = false;
|
||||
@@ -44,12 +48,11 @@ function _showUpdateNotification () {
|
||||
return;
|
||||
}
|
||||
|
||||
const window = BrowserWindow.getFocusedWindow();
|
||||
if (!window || !window.webContents) {
|
||||
return;
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
if (windows.length && windows[0].webContents) {
|
||||
windows[0].webContents.send('update-available');
|
||||
}
|
||||
|
||||
window.webContents.send('update-available');
|
||||
hasPromptedForUpdates = true;
|
||||
}
|
||||
|
||||
@@ -59,19 +62,13 @@ function _checkForUpdates () {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDevelopment()) {
|
||||
console.log('-- Skipping update check in Development --');
|
||||
return;
|
||||
} else {
|
||||
console.log('-- Checking for Updates --');
|
||||
}
|
||||
|
||||
if (!isLinux()) {
|
||||
try {
|
||||
autoUpdater.setFeedURL(UPDATE_URLS[process.platform]);
|
||||
autoUpdater.checkForUpdates();
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
// This will fail in development
|
||||
console.warn('Failed to check for updates:', err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,12 +292,12 @@ function showUnresponsiveModal () {
|
||||
}
|
||||
|
||||
function trackEvent (...args) {
|
||||
const window = BrowserWindow.getFocusedWindow();
|
||||
if (!window || !window.webContents) {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
if (!windows.length || !windows[0].webContents) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.webContents.send('analytics-track-event', args);
|
||||
windows[0].webContents.send('analytics-track-event', args);
|
||||
}
|
||||
|
||||
function saveBounds () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "insomnia",
|
||||
"version": "5.0.16",
|
||||
"version": "5.0.19",
|
||||
"productName": "Insomnia",
|
||||
"longName": "Insomnia REST Client",
|
||||
"description": "Debug APIs like a human, not a robot",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"homepage": "https://insomnia.rest",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/gschier/insomnia"
|
||||
"url": "https://github.com/getinsomnia/insomnia"
|
||||
},
|
||||
"scripts": {
|
||||
"test:lint": "eslint \"**/*.js\" \"**/*.html\" \"**/*.json\"",
|
||||
@@ -81,7 +81,6 @@
|
||||
},
|
||||
"win": {
|
||||
"iconUrl": "https://insomnia.rest/images/icon.png",
|
||||
"remoteReleases": "https://s3.amazonaws.com/downloads.insomnia.rest/win",
|
||||
"target": "squirrel",
|
||||
"msi": false
|
||||
},
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = {
|
||||
new webpack.DefinePlugin({
|
||||
__DEV__: false,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
'process.env.INSOMNIA_ENV': JSON.stringify('production'),
|
||||
'process.env.HOT': JSON.stringify(null)
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user