diff options
author | 2021-09-05 15:14:28 +0530 | |
---|---|---|
committer | 2021-09-05 18:00:26 +0530 | |
commit | a57a4edcb648d025254ede4d18d267b887ad0b8b (patch) | |
tree | c8b75e58cf108a55608f729218885abdb07fd42d /recipes/discord/webview.js | |
parent | Add ability to use self-hosted option for 'youtrack' service (fixes #671) (diff) | |
download | ferdium-recipes-a57a4edcb648d025254ede4d18d267b887ad0b8b.tar.gz ferdium-recipes-a57a4edcb648d025254ede4d18d267b887ad0b8b.tar.zst ferdium-recipes-a57a4edcb648d025254ede4d18d267b887ad0b8b.zip |
Remove dependency on 'require' of 'electron' and 'electron/remote' modules.
Instead, use the exposed content from the recipe model in main ferdi.
Diffstat (limited to 'recipes/discord/webview.js')
-rw-r--r-- | recipes/discord/webview.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 0559612..480329d 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js | |||
@@ -1,7 +1,5 @@ | |||
1 | // TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 | 1 | // TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 |
2 | 2 | ||
3 | const { desktopCapturer, remote: { BrowserWindow } } = require('electron'); | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | 3 | const _path = _interopRequireDefault(require('path')); |
6 | 4 | ||
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -9,7 +7,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de | |||
9 | window.navigator.mediaDevices.getDisplayMedia = () => { | 7 | window.navigator.mediaDevices.getDisplayMedia = () => { |
10 | return new Promise(async (resolve, reject) => { | 8 | return new Promise(async (resolve, reject) => { |
11 | try { | 9 | try { |
12 | const sources = await desktopCapturer.getSources({ types: ['screen', 'window'] }); | 10 | const sources = await Ferdi.desktopCapturer.getSources({ types: ['screen', 'window'] }); |
13 | 11 | ||
14 | const selectionElem = document.createElement('div'); | 12 | const selectionElem = document.createElement('div'); |
15 | selectionElem.classList = 'desktop-capturer-selection'; | 13 | selectionElem.classList = 'desktop-capturer-selection'; |
@@ -99,7 +97,7 @@ module.exports = (Ferdi, settings) => { | |||
99 | event.stopPropagation(); | 97 | event.stopPropagation(); |
100 | 98 | ||
101 | if (url.includes('views/imgpsh_fullsize_anim')) { | 99 | if (url.includes('views/imgpsh_fullsize_anim')) { |
102 | let win = new BrowserWindow({ | 100 | let win = new Ferdi.BrowserWindow({ |
103 | width: 800, | 101 | width: 800, |
104 | height: window.innerHeight, | 102 | height: window.innerHeight, |
105 | minWidth: 600, | 103 | minWidth: 600, |