Commit 4637a17c authored by akiraohgaki's avatar akiraohgaki

Cancel ocs protocol navigation

parent eb2005dc
......@@ -184,6 +184,17 @@ app.on('activate', () => {
}
});
app.on('web-contents-created', (event, webContents) => {
if (webContents.getType() === 'webview') {
webContents.on('will-navigate', (event, url) => {
if (url.startsWith('ocs://') || url.startsWith('ocss://')) {
// Cancel ocs protocol navigation
event.preventDefault();
}
});
}
});
ipcMain.on('app', (event, key) => {
const data = {
package: appPackage,
......
......@@ -124,6 +124,7 @@ export default class WebviewComponent extends BaseComponent {
});
this._webviewElement.addEventListener('will-navigate', (event) => {
// See also "will-navigate" event handling in main.js
if (event.url.startsWith('ocs://') || event.url.startsWith('ocss://')) {
const info = this._detectOcsApiInfo(this._webviewElement.getURL());
this.dispatch('ocsManager_getItemByOcsUrl', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment