Skip to content

Commit a4c16b8

Browse files
committed
Merge remote-tracking branch 'origin/develop' into dbkr/build_vector_dir
2 parents d150ee0 + 7bf69d0 commit a4c16b8

5 files changed

Lines changed: 85 additions & 16 deletions

File tree

electron/build/install-spinner.gif

4.36 KB
Loading

electron/img/riot.ico

21.1 KB
Binary file not shown.

electron/src/electron-main.js

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ const url = require('url');
2828

2929
const VectorMenu = require('./vectormenu');
3030

31+
let vectorConfig = {};
32+
try {
33+
vectorConfig = require('../../vector/config.json');
34+
} catch (e) {
35+
// it would be nice to check the error code here and bail if the config
36+
// is unparseable, but we get MODULE_NOT_FOUND in the case of a missing
37+
// file or invalid json, so node is just very unhelpful.
38+
// Continue with the defaults (ie. an empty config)
39+
}
40+
3141
const PERMITTED_URL_SCHEMES = [
3242
'http:',
3343
'https:',
@@ -91,29 +101,20 @@ function pollForUpdates() {
91101
}
92102
}
93103

94-
// handle uncaught errors otherwise it displays
95-
// stack traces in popup dialogs, which is terrible (which
96-
// it will do any time the auto update poke fails, and there's
97-
// no other way to catch this error).
98-
// Assuming we generally run from the console when developing,
99-
// this is far preferable.
100-
process.on('uncaughtException', function (error) {
101-
console.log("Unhandled exception", error);
102-
});
103-
104-
electron.ipcMain.on('install_update', installUpdate);
105-
106-
electron.app.on('ready', () => {
104+
function startAutoUpdate(update_url) {
105+
if (update_url.slice(-1) !== '/') {
106+
update_url = update_url + '/';
107+
}
107108
try {
108109
// For reasons best known to Squirrel, the way it checks for updates
109110
// is completely different between macOS and windows. On macOS, it
110111
// hits a URL that either gives it a 200 with some json or
111112
// 204 No Content. On windows it takes a base path and looks for
112113
// files under that path.
113114
if (process.platform == 'darwin') {
114-
electron.autoUpdater.setFeedURL("https://riot.im/autoupdate/desktop/");
115+
electron.autoUpdater.setFeedURL(update_url);
115116
} else if (process.platform == 'win32') {
116-
electron.autoUpdater.setFeedURL("https://riot.im/download/desktop/win32/");
117+
electron.autoUpdater.setFeedURL(update_url + 'win32/');
117118
} else {
118119
// Squirrel / electron only supports auto-update on these two platforms.
119120
// 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', () => {
133134
// will fail if running in debug mode
134135
console.log("Couldn't enable update checking", err);
135136
}
137+
}
138+
139+
// handle uncaught errors otherwise it displays
140+
// stack traces in popup dialogs, which is terrible (which
141+
// it will do any time the auto update poke fails, and there's
142+
// no other way to catch this error).
143+
// Assuming we generally run from the console when developing,
144+
// this is far preferable.
145+
process.on('uncaughtException', function (error) {
146+
console.log("Unhandled exception", error);
147+
});
148+
149+
electron.ipcMain.on('install_update', installUpdate);
150+
151+
electron.app.on('ready', () => {
152+
if (vectorConfig.update_url) {
153+
console.log("Starting auto update with URL: " + vectorConfig.update_url);
154+
startAutoUpdate(vectorConfig.update_url);
155+
} else {
156+
console.log("No update_url is defined: auto update is disabled");
157+
}
136158

137159
mainWindow = new electron.BrowserWindow({
138160
icon: `${__dirname}/../img/riot.ico`,

electron/src/squirrelhooks.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const path = require('path');
2+
const spawn = require('child_process').spawn;
3+
const app = require('electron').app;
4+
5+
function run_update_exe(args, done) {
6+
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
7+
spawn(updateExe, args, {
8+
detached: true
9+
}).on('close', done);
10+
};
11+
12+
function check_squirrel_hooks() {
13+
if (process.platform != 'win32') return false;
14+
15+
const cmd = process.argv[1];
16+
const target = path.basename(process.execPath);
17+
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
18+
run_update_exe(['--createShortcut=' + target + ''], app.quit);
19+
return true;
20+
} else if (cmd === '--squirrel-uninstall') {
21+
run_update_exe(['--removeShortcut=' + target + ''], app.quit);
22+
return true;
23+
} else if (cmd === '--squirrel-obsolete') {
24+
app.quit();
25+
return true;
26+
}
27+
return false;
28+
}
29+
30+
module.exports = check_squirrel_hooks;

src/skins/vector/css/matrix-react-sdk/views/rooms/RoomSettings.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ limitations under the License.
2020
}
2121

2222
.mx_RoomSettings_leaveButton,
23-
.mx_RoomSettings_integrationsButton {
23+
.mx_RoomSettings_integrationsButton,
24+
.mx_RoomSettings_integrationsButton_error {
25+
position: relative;
2426
height: 36px;
2527
background-color: #76cfa6;
2628
border-radius: 36px;
@@ -33,6 +35,21 @@ limitations under the License.
3335
padding-left: 12px;
3436
padding-right: 12px;
3537
}
38+
.mx_RoomSettings_integrationsButton_error {
39+
pointer: not-allowed;
40+
}
41+
.mx_RoomSettings_integrationsButton_errorPopup {
42+
position: absolute;
43+
top: 110%;
44+
left: -26%;
45+
width: 150%;
46+
padding: 2%;
47+
font-size: 10pt;
48+
line-height: 1.5em;
49+
border-radius: 5px;
50+
background-color: #000;
51+
color: #fff;
52+
}
3653

3754
.mx_RoomSettings_e2eIcon {
3855
padding-left: 4px;

0 commit comments

Comments
 (0)