From 8872a6a24a6d3dff6bc7974b75330394ad45b0da Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 11:30:05 +0100 Subject: [PATCH 1/7] Fix right click menu in electron Fixes https://github.com/vector-im/riot-web/issues/6762 --- electron_app/src/webcontents-handler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js index 37416ebe96..8e079718a3 100644 --- a/electron_app/src/webcontents-handler.js +++ b/electron_app/src/webcontents-handler.js @@ -61,7 +61,7 @@ function onLinkContextMenu(ev, params) { clipboard.writeText(url); }, })); - popupMenu.popup(); + popupMenu.popup({}); ev.preventDefault(); } @@ -88,7 +88,7 @@ function onSelectedContextMenu(ev, params) { const items = _CutCopyPasteSelectContextMenus(params); const popupMenu = Menu.buildFromTemplate(items); - popupMenu.popup(); + popupMenu.popup({}); ev.preventDefault(); } @@ -101,7 +101,7 @@ function onEditableContextMenu(ev, params) { const popupMenu = Menu.buildFromTemplate(items); - popupMenu.popup(); + popupMenu.popup({}); ev.preventDefault(); } From d353c13bf1c5c04ca168e23b22e3ebc2c8ab1583 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 11:42:40 +0100 Subject: [PATCH 2/7] Comment why we're passing empty objects in --- electron_app/src/webcontents-handler.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js index 8e079718a3..cd6833fdce 100644 --- a/electron_app/src/webcontents-handler.js +++ b/electron_app/src/webcontents-handler.js @@ -61,6 +61,7 @@ function onLinkContextMenu(ev, params) { clipboard.writeText(url); }, })); + // popup() requires an options object even for no options popupMenu.popup({}); ev.preventDefault(); } @@ -88,6 +89,7 @@ function onSelectedContextMenu(ev, params) { const items = _CutCopyPasteSelectContextMenus(params); const popupMenu = Menu.buildFromTemplate(items); + // popup() requires an options object even for no options popupMenu.popup({}); ev.preventDefault(); } @@ -101,6 +103,7 @@ function onEditableContextMenu(ev, params) { const popupMenu = Menu.buildFromTemplate(items); + // popup() requires an options object even for no options popupMenu.popup({}); ev.preventDefault(); } From b1f0f33204cf2cf5e6b48f039c0403fcb9e58da7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 11:32:59 +0100 Subject: [PATCH 3/7] Update to electron 2.0.1 It does have a security fix --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 38cbe8506f..45613d29db 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "build": { "appId": "im.riot.app", "category": "Network", - "electronVersion": "2.0.0", + "electronVersion": "2.0.1", "//asar=false": "https://github.com/electron-userland/electron-builder/issues/675", "asar": false, "dereference": true, From 4656d25590bb70dbe4b058cfee860a518e0b2164 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 12:00:55 +0100 Subject: [PATCH 4/7] Hide URL options for e2e blob: URL images These won't work outside of the electron app so there is zero point in trying to open them in an external browser or offerring to copy them to the clipboard --- electron_app/src/webcontents-handler.js | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js index cd6833fdce..d566de515a 100644 --- a/electron_app/src/webcontents-handler.js +++ b/electron_app/src/webcontents-handler.js @@ -35,12 +35,15 @@ function onLinkContextMenu(ev, params) { const url = params.linkURL || params.srcURL; const popupMenu = new Menu(); - popupMenu.append(new MenuItem({ - label: url, - click() { - safeOpenURL(url); - }, - })); + // No point trying to open blob: URLs in an external browser: it ain't gonna work. + if (!url.startsWith('blob:')) { + popupMenu.append(new MenuItem({ + label: url, + click() { + safeOpenURL(url); + }, + })); + } if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) { popupMenu.append(new MenuItem({ @@ -55,12 +58,15 @@ function onLinkContextMenu(ev, params) { })); } - popupMenu.append(new MenuItem({ - label: 'Copy Link Address', - click() { - clipboard.writeText(url); - }, - })); + // No point offerring to copy a blob: URL either + if (!url.startsWith('blob:')) { + popupMenu.append(new MenuItem({ + label: 'Copy Link Address', + click() { + clipboard.writeText(url); + }, + })); + } // popup() requires an options object even for no options popupMenu.popup({}); ev.preventDefault(); From d5b21021fb71639693f8b332185234a051ebe3d0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 12:36:22 +0100 Subject: [PATCH 5/7] v0.15.3 --- electron_app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron_app/package.json b/electron_app/package.json index 855c4f5cad..10cd933116 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "src/electron-main.js", - "version": "0.15.2", + "version": "0.15.3", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "dependencies": { From 3467ca5230b3f9ae641c6b2b96d1242c1db73fe5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 12:38:58 +0100 Subject: [PATCH 6/7] Prepare changelog for v0.15.3 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f076b76011..a6aa51f67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +Changes in [0.15.3](https://github.com/vector-im/riot-web/releases/tag/v0.15.3) (2018-05-18) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.15.2...v0.15.3) + + * Fix right click menu in electron + [\#6763](https://github.com/vector-im/riot-web/pull/6763) + * Update to electron 2.0.1 + [\#6764](https://github.com/vector-im/riot-web/pull/6764) + * Hide URL options for e2e blob: URL images + [\#6765](https://github.com/vector-im/riot-web/pull/6765) + Changes in [0.15.2](https://github.com/vector-im/riot-web/releases/tag/v0.15.2) (2018-05-17) ============================================================================================ [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.15.1...v0.15.2) From ec62b5f03ca30970c741258c83db729cb60a2e6a Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 May 2018 12:38:59 +0100 Subject: [PATCH 7/7] v0.15.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45613d29db..e78e45e28d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron_app/src/electron-main.js", - "version": "0.15.2", + "version": "0.15.3", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "repository": {