Merge remote-tracking branch 'origin/develop' into dbkr/build_vector_dir

This commit is contained in:
David Baker 2016-11-08 15:44:27 +00:00
commit a4c16b896b
5 changed files with 85 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
electron/img/riot.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -28,6 +28,16 @@ const url = require('url');
const VectorMenu = require('./vectormenu'); const VectorMenu = require('./vectormenu');
let vectorConfig = {};
try {
vectorConfig = require('../../vector/config.json');
} catch (e) {
// it would be nice to check the error code here and bail if the config
// is unparseable, but we get MODULE_NOT_FOUND in the case of a missing
// file or invalid json, so node is just very unhelpful.
// Continue with the defaults (ie. an empty config)
}
const PERMITTED_URL_SCHEMES = [ const PERMITTED_URL_SCHEMES = [
'http:', 'http:',
'https:', 'https:',
@ -91,19 +101,10 @@ function pollForUpdates() {
} }
} }
// handle uncaught errors otherwise it displays function startAutoUpdate(update_url) {
// stack traces in popup dialogs, which is terrible (which if (update_url.slice(-1) !== '/') {
// it will do any time the auto update poke fails, and there's update_url = update_url + '/';
// no other way to catch this error). }
// Assuming we generally run from the console when developing,
// this is far preferable.
process.on('uncaughtException', function (error) {
console.log("Unhandled exception", error);
});
electron.ipcMain.on('install_update', installUpdate);
electron.app.on('ready', () => {
try { try {
// For reasons best known to Squirrel, the way it checks for updates // For reasons best known to Squirrel, the way it checks for updates
// is completely different between macOS and windows. On macOS, it // is completely different between macOS and windows. On macOS, it
@ -111,9 +112,9 @@ electron.app.on('ready', () => {
// 204 No Content. On windows it takes a base path and looks for // 204 No Content. On windows it takes a base path and looks for
// files under that path. // files under that path.
if (process.platform == 'darwin') { if (process.platform == 'darwin') {
electron.autoUpdater.setFeedURL("https://riot.im/autoupdate/desktop/"); electron.autoUpdater.setFeedURL(update_url);
} else if (process.platform == 'win32') { } else if (process.platform == 'win32') {
electron.autoUpdater.setFeedURL("https://riot.im/download/desktop/win32/"); electron.autoUpdater.setFeedURL(update_url + 'win32/');
} else { } else {
// Squirrel / electron only supports auto-update on these two platforms. // Squirrel / electron only supports auto-update on these two platforms.
// I'm not even going to try to guess which feed style they'd use if they // I'm not even going to try to guess which feed style they'd use if they
@ -133,6 +134,27 @@ electron.app.on('ready', () => {
// will fail if running in debug mode // will fail if running in debug mode
console.log("Couldn't enable update checking", err); console.log("Couldn't enable update checking", err);
} }
}
// handle uncaught errors otherwise it displays
// stack traces in popup dialogs, which is terrible (which
// it will do any time the auto update poke fails, and there's
// no other way to catch this error).
// Assuming we generally run from the console when developing,
// this is far preferable.
process.on('uncaughtException', function (error) {
console.log("Unhandled exception", error);
});
electron.ipcMain.on('install_update', installUpdate);
electron.app.on('ready', () => {
if (vectorConfig.update_url) {
console.log("Starting auto update with URL: " + vectorConfig.update_url);
startAutoUpdate(vectorConfig.update_url);
} else {
console.log("No update_url is defined: auto update is disabled");
}
mainWindow = new electron.BrowserWindow({ mainWindow = new electron.BrowserWindow({
icon: `${__dirname}/../img/riot.ico`, icon: `${__dirname}/../img/riot.ico`,

View File

@ -0,0 +1,30 @@
const path = require('path');
const spawn = require('child_process').spawn;
const app = require('electron').app;
function run_update_exe(args, done) {
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
spawn(updateExe, args, {
detached: true
}).on('close', done);
};
function check_squirrel_hooks() {
if (process.platform != 'win32') return false;
const cmd = process.argv[1];
const target = path.basename(process.execPath);
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
run_update_exe(['--createShortcut=' + target + ''], app.quit);
return true;
} else if (cmd === '--squirrel-uninstall') {
run_update_exe(['--removeShortcut=' + target + ''], app.quit);
return true;
} else if (cmd === '--squirrel-obsolete') {
app.quit();
return true;
}
return false;
}
module.exports = check_squirrel_hooks;

View File

@ -20,7 +20,9 @@ limitations under the License.
} }
.mx_RoomSettings_leaveButton, .mx_RoomSettings_leaveButton,
.mx_RoomSettings_integrationsButton { .mx_RoomSettings_integrationsButton,
.mx_RoomSettings_integrationsButton_error {
position: relative;
height: 36px; height: 36px;
background-color: #76cfa6; background-color: #76cfa6;
border-radius: 36px; border-radius: 36px;
@ -33,6 +35,21 @@ limitations under the License.
padding-left: 12px; padding-left: 12px;
padding-right: 12px; padding-right: 12px;
} }
.mx_RoomSettings_integrationsButton_error {
pointer: not-allowed;
}
.mx_RoomSettings_integrationsButton_errorPopup {
position: absolute;
top: 110%;
left: -26%;
width: 150%;
padding: 2%;
font-size: 10pt;
line-height: 1.5em;
border-radius: 5px;
background-color: #000;
color: #fff;
}
.mx_RoomSettings_e2eIcon { .mx_RoomSettings_e2eIcon {
padding-left: 4px; padding-left: 4px;