Merge remote-tracking branch 'old-origin/develop' into dbkr/update_more_icons
This commit is contained in:
@@ -99,6 +99,13 @@ if (argv["help"]) {
|
||||
app.exit();
|
||||
}
|
||||
|
||||
// Electron creates the user data directory (with just an empty 'Dictionaries' directory...)
|
||||
// as soon as the app path is set, so pick a random path in it that must exist if it's a
|
||||
// real user data directory.
|
||||
function isRealUserDataDir(d) {
|
||||
return fs.existsSync(path.join(d, 'IndexedDB'));
|
||||
}
|
||||
|
||||
// check if we are passed a profile in the SSO callback url
|
||||
let userDataPath;
|
||||
|
||||
@@ -114,12 +121,6 @@ if (userDataPathInProtocol) {
|
||||
if (argv['profile']) {
|
||||
newUserDataPath += '-' + argv['profile'];
|
||||
}
|
||||
// Electron creates the user data directory (with just an empty 'Dictionaries' directory...)
|
||||
// as soon as the app path is set, so pick a random path in it that must exist if it's a
|
||||
// real user data directory.
|
||||
function isRealUserDataDir(d) {
|
||||
return fs.existsSync(path.join(d, 'IndexedDB'));
|
||||
}
|
||||
const newUserDataPathExists = isRealUserDataDir(newUserDataPath);
|
||||
const oldUserDataPath = path.join(app.getPath('appData'), 'Riot');
|
||||
const oldUserDataPathExists = isRealUserDataDir(oldUserDataPath);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const {clipboard, nativeImage, Menu, MenuItem, shell, dialog} = require('electron');
|
||||
const {clipboard, nativeImage, Menu, MenuItem, shell, dialog, ipcMain} = require('electron');
|
||||
const url = require('url');
|
||||
const fs = require('fs');
|
||||
const request = require('request');
|
||||
const path = require('path');
|
||||
|
||||
const MAILTO_PREFIX = "mailto:";
|
||||
|
||||
@@ -205,6 +206,9 @@ function onEditableContextMenu(ev, params) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
ipcMain.on('userDownloadOpen', function(ev, {path}) {
|
||||
shell.openPath(path);
|
||||
});
|
||||
|
||||
module.exports = (webContents) => {
|
||||
webContents.on('new-window', onWindowOrNavigate);
|
||||
@@ -222,4 +226,16 @@ module.exports = (webContents) => {
|
||||
onEditableContextMenu(ev, params);
|
||||
}
|
||||
});
|
||||
|
||||
webContents.session.on('will-download', (event, item) => {
|
||||
item.once('done', (event, state) => {
|
||||
if (state === 'completed') {
|
||||
const savePath = item.getSavePath();
|
||||
webContents.send('userDownloadCompleted', {
|
||||
path: savePath,
|
||||
name: path.basename(savePath),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user