aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--all.json4
-rw-r--r--recipes/msteams/package.json2
-rw-r--r--recipes/msteams/webview.js57
-rw-r--r--recipes/skype/package.json2
-rw-r--r--recipes/skype/webview.js58
5 files changed, 5 insertions, 118 deletions
diff --git a/all.json b/all.json
index 206b356..6e06ffa 100644
--- a/all.json
+++ b/all.json
@@ -664,7 +664,7 @@
664 "featured": false, 664 "featured": false,
665 "id": "msteams", 665 "id": "msteams",
666 "name": "Microsoft Teams", 666 "name": "Microsoft Teams",
667 "version": "1.3.3", 667 "version": "2.0.0",
668 "icons": { 668 "icons": {
669 "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/msteams/icon.png", 669 "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/msteams/icon.png",
670 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/msteams/icon.svg" 670 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/msteams/icon.svg"
@@ -961,7 +961,7 @@
961 "featured": false, 961 "featured": false,
962 "id": "skype", 962 "id": "skype",
963 "name": "Skype", 963 "name": "Skype",
964 "version": "1.4.1", 964 "version": "2.0.0",
965 "icons": { 965 "icons": {
966 "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/skype/icon.png", 966 "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/skype/icon.png",
967 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/skype/icon.svg" 967 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/skype/icon.svg"
diff --git a/recipes/msteams/package.json b/recipes/msteams/package.json
index 4b3579a..e98fd49 100644
--- a/recipes/msteams/package.json
+++ b/recipes/msteams/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "msteams", 2 "id": "msteams",
3 "name": "Microsoft Teams", 3 "name": "Microsoft Teams",
4 "version": "1.3.3", 4 "version": "2.0.0",
5 "description": "Microsoft Teams", 5 "description": "Microsoft Teams",
6 "main": "index.js", 6 "main": "index.js",
7 "author": "Stefan Malzner <stefan@adlk.io>", 7 "author": "Stefan Malzner <stefan@adlk.io>",
diff --git a/recipes/msteams/webview.js b/recipes/msteams/webview.js
index 7823c63..6d499fb 100644
--- a/recipes/msteams/webview.js
+++ b/recipes/msteams/webview.js
@@ -1,64 +1,7 @@
1"use strict"; 1"use strict";
2 2
3const { desktopCapturer } = require('electron');
4const path = require('path'); 3const path = require('path');
5 4
6window.navigator.mediaDevices.getDisplayMedia = () => {
7 return new Promise(async (resolve, reject) => {
8 try {
9 const sources = await desktopCapturer.getSources({ types: ['screen', 'window'] });
10
11 const selectionElem = document.createElement('div');
12 selectionElem.classList = 'desktop-capturer-selection';
13 selectionElem.innerHTML = `
14 <div class="desktop-capturer-selection__scroller">
15 <ul class="desktop-capturer-selection__list">
16 ${sources.map(({ id, name, thumbnail, display_id, appIcon }) => `
17 <li class="desktop-capturer-selection__item">
18 <button class="desktop-capturer-selection__btn" data-id="${id}" title="${name}">
19 <img class="desktop-capturer-selection__thumbnail" src="${thumbnail.toDataURL()}" />
20 <span class="desktop-capturer-selection__name">${name}</span>
21 </button>
22 </li>
23 `).join('')}
24 </ul>
25 </div>
26 `;
27 document.body.appendChild(selectionElem);
28
29 document.querySelectorAll('.desktop-capturer-selection__btn')
30 .forEach(button => {
31 button.addEventListener('click', async () => {
32 try {
33 const id = button.getAttribute('data-id');
34 const source = sources.find(source => source.id === id);
35 if (!source) {
36 throw new Error(`Source with id ${id} does not exist`);
37 }
38
39 const stream = await window.navigator.mediaDevices.getUserMedia({
40 audio: false,
41 video: {
42 mandatory: {
43 chromeMediaSource: 'desktop',
44 chromeMediaSourceId: source.id
45 }
46 }
47 });
48 resolve(stream);
49
50 selectionElem.remove();
51 } catch (err) {
52 reject(err);
53 }
54 });
55 });
56 } catch (err) {
57 reject(err);
58 }
59 })
60}
61
62window.electronSafeIpc = { 5window.electronSafeIpc = {
63 send: () => null, 6 send: () => null,
64 on: () => null 7 on: () => null
diff --git a/recipes/skype/package.json b/recipes/skype/package.json
index 9b4e168..93043cc 100644
--- a/recipes/skype/package.json
+++ b/recipes/skype/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "skype", 2 "id": "skype",
3 "name": "Skype", 3 "name": "Skype",
4 "version": "1.4.1", 4 "version": "2.0.0",
5 "description": "Skype", 5 "description": "Skype",
6 "main": "index.js", 6 "main": "index.js",
7 "author": "Stefan Malzner <stefan@adlk.io>", 7 "author": "Stefan Malzner <stefan@adlk.io>",
diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js
index 93a3613..4d5292d 100644
--- a/recipes/skype/webview.js
+++ b/recipes/skype/webview.js
@@ -1,64 +1,8 @@
1"use strict"; 1"use strict";
2 2
3const { desktopCapturer, remote: { BrowserWindow } } = require("electron"); 3const { remote: { BrowserWindow } } = require("electron");
4const path = require('path'); 4const path = require('path');
5 5
6window.navigator.mediaDevices.getDisplayMedia = () => {
7 return new Promise(async (resolve, reject) => {
8 try {
9 const sources = await desktopCapturer.getSources({ types: ['screen', 'window'] });
10
11 const selectionElem = document.createElement('div');
12 selectionElem.classList = 'desktop-capturer-selection';
13 selectionElem.innerHTML = `
14 <div class="desktop-capturer-selection__scroller">
15 <ul class="desktop-capturer-selection__list">
16 ${sources.map(({ id, name, thumbnail, display_id, appIcon }) => `
17 <li class="desktop-capturer-selection__item">
18 <button class="desktop-capturer-selection__btn" data-id="${id}" title="${name}">
19 <img class="desktop-capturer-selection__thumbnail" src="${thumbnail.toDataURL()}" />
20 <span class="desktop-capturer-selection__name">${name}</span>
21 </button>
22 </li>
23 `).join('')}
24 </ul>
25 </div>
26 `;
27 document.body.appendChild(selectionElem);
28
29 document.querySelectorAll('.desktop-capturer-selection__btn')
30 .forEach(button => {
31 button.addEventListener('click', async () => {
32 try {
33 const id = button.getAttribute('data-id');
34 const source = sources.find(source => source.id === id);
35 if (!source) {
36 throw new Error(`Source with id ${id} does not exist`);
37 }
38
39 const stream = await window.navigator.mediaDevices.getUserMedia({
40 audio: false,
41 video: {
42 mandatory: {
43 chromeMediaSource: 'desktop',
44 chromeMediaSourceId: source.id
45 }
46 }
47 });
48 resolve(stream);
49
50 selectionElem.remove();
51 } catch (err) {
52 reject(err);
53 }
54 });
55 });
56 } catch (err) {
57 reject(err);
58 }
59 })
60}
61
62module.exports = (Franz, settings) => { 6module.exports = (Franz, settings) => {
63 const getMessages = function getMessages() { 7 const getMessages = function getMessages() {
64 let count = 0; 8 let count = 0;