Logic to take value of protocol from electron-builder.json to be able to whitelabel in an easy manner.
This commit is contained in:
parent
150b829a67
commit
7a3552dfdc
14
src/main.js
14
src/main.js
|
@ -14,6 +14,8 @@ const isDev = require('electron-is-dev');
|
|||
const installExtension = require('electron-devtools-installer');
|
||||
const squirrelStartup = require('./main/squirrelStartup');
|
||||
|
||||
const protocols = require('../electron-builder.json').protocols;
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
@ -330,10 +332,18 @@ ipcMain.on('download-url', (event, URL) => {
|
|||
});
|
||||
});
|
||||
|
||||
app.setAsDefaultProtocolClient('mattermost');
|
||||
let scheme;
|
||||
if (protocols && protocols[0] &&
|
||||
protocols[0].schemes && protocols[0].schemes[0]
|
||||
) {
|
||||
scheme = protocols[0].schemes[0];
|
||||
app.setAsDefaultProtocolClient(scheme);
|
||||
}
|
||||
|
||||
function setDeeplinkingUrl(url) {
|
||||
deeplinkingUrl = url.replace('mattermost', 'https');
|
||||
if (scheme) {
|
||||
deeplinkingUrl = url.replace(scheme, 'https');
|
||||
}
|
||||
}
|
||||
|
||||
// Protocol handler for osx
|
||||
|
|
Loading…
Reference in a new issue