diff --git a/package.json b/package.json index 1beee2b..64881cb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Raindrop.io", "productName": "Raindrop.io", - "version": "5.1.8", + "version": "5.1.9", "description": "Crossplatform bookmarking app", "main": "src/index.js", "repository": { diff --git a/src/webView.js b/src/webView.js index 49095d3..f49a9c9 100644 --- a/src/webView.js +++ b/src/webView.js @@ -20,7 +20,7 @@ app.on('web-contents-created', (e, contents) => { if (disposition == 'new-window') return shell.openExternal(url) - }) + }) } contents.on('will-attach-webview', (e, webPreferences, params) => { @@ -33,4 +33,13 @@ app.on('web-contents-created', (e, contents) => { // Disable Node.js integration webPreferences.nodeIntegration = false }) +}) + +app.on('session-created', (session) => { + session.on('will-download', (e, item, contents) => { + if (item.getMimeType() == 'application/pdf' && item.getURL().includes('up.raindrop.io')){ + e.preventDefault() + contents.executeJavaScript(`document.querySelector('iframe[src="${item.getURL()}"]').setAttribute('src', 'https://up.raindrop.io/pdfjs/web/viewer.html?file=${item.getURL()}')`) + } + }) }) \ No newline at end of file