Allow deep-linking protocol when opening a link

This commit is contained in:
Yuya Ochiai 2018-01-19 00:24:08 +09:00
parent 71989b9c37
commit 92489aea30

View file

@ -8,6 +8,8 @@ const {findDOMNode} = require('react-dom');
const {ipcRenderer, remote, shell} = require('electron');
const url = require('url');
const contextMenu = require('../js/contextMenu');
const {protocols} = require('../../../electron-builder.json');
const scheme = protocols[0].schemes[0];
const ErrorView = require('./ErrorView.jsx');
@ -72,7 +74,7 @@ const MattermostView = createReactClass({
webview.addEventListener('new-window', (e) => {
var currentURL = url.parse(webview.getURL());
var destURL = url.parse(e.url);
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:') {
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:' && destURL.protocol !== `${scheme}:`) {
ipcRenderer.send('confirm-protocol', destURL.protocol, e.url);
return;
}