aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/msteams
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-09-22 20:56:48 +0200
committerLibravatar GitHub <noreply@github.com>2020-09-22 19:56:48 +0100
commit6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch)
tree9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /recipes/msteams
parentUpdated logos for Outlook/OWA (diff)
downloadferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz
ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst
ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'recipes/msteams')
-rw-r--r--recipes/msteams/icon.pngbin0 -> 36329 bytes
-rw-r--r--recipes/msteams/icon.svg1
-rw-r--r--recipes/msteams/index.js7
-rw-r--r--recipes/msteams/package.json15
-rw-r--r--recipes/msteams/service.css63
-rw-r--r--recipes/msteams/webview.js87
6 files changed, 173 insertions, 0 deletions
diff --git a/recipes/msteams/icon.png b/recipes/msteams/icon.png
new file mode 100644
index 0000000..f136dc4
--- /dev/null
+++ b/recipes/msteams/icon.png
Binary files differ
diff --git a/recipes/msteams/icon.svg b/recipes/msteams/icon.svg
new file mode 100644
index 0000000..6279612
--- /dev/null
+++ b/recipes/msteams/icon.svg
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>OfficeCore10_32x_24x_20x_16x_01-22-2019</title><g id="STYLE_COLOR" data-name="STYLE = COLOR"><circle id="Head" cx="17.00001" cy="6.00001" r="4.66666" fill="#7b83eb"/><path d="M16.66663,7H12.4411q.01017.04669.0213.09326l.00189.00781c.00684.02857.0141.05707.02143.08551A4.671,4.671,0,0,0,18,10.55884V8.33331A1.33727,1.33727,0,0,0,16.66663,7Z" opacity="0.1"/><path d="M15.66663,8H12.78271A4.667,4.667,0,0,0,17,10.66663V9.33331A1.33727,1.33727,0,0,0,15.66663,8Z" opacity="0.2"/><circle id="Head-2" data-name="Head" cx="27.5" cy="7.50001" r="3.5" fill="#5059c9"/><path d="M30.49976,12H22.63882a.63906.63906,0,0,0-.63906.63906v8.11026A5.12132,5.12132,0,0,0,25.966,25.8339a5.00551,5.00551,0,0,0,6.03372-4.89636V13.5A1.5,1.5,0,0,0,30.49976,12Z" fill="#5059c9"/><path d="M25,13.5V23a7.99479,7.99479,0,0,1-14.92,4,7.17277,7.17277,0,0,1-.5-1,8.36694,8.36694,0,0,1-.33-1A8.24022,8.24022,0,0,1,9,23V13.5A1.498,1.498,0,0,1,10.5,12h13A1.498,1.498,0,0,1,25,13.5Z" fill="#7b83eb"/><path d="M15.66663,8H12.78271A4.667,4.667,0,0,0,17,10.66663V9.33331A1.33727,1.33727,0,0,0,15.66663,8Z" opacity="0.2"/><path d="M18,12V24.67a1.32024,1.32024,0,0,1-1.04,1.29.966.966,0,0,1-.29.04H9.58a8.36694,8.36694,0,0,1-.33-1A8.24022,8.24022,0,0,1,9,23V13.5A1.498,1.498,0,0,1,10.5,12Z" opacity="0.1"/><path d="M17,12V25.67a.96746.96746,0,0,1-.04.29A1.3203,1.3203,0,0,1,15.67,27H10.08a7.17277,7.17277,0,0,1-.5-1,8.36694,8.36694,0,0,1-.33-1A8.24022,8.24022,0,0,1,9,23V13.5A1.498,1.498,0,0,1,10.5,12Z" opacity="0.2"/><path d="M17,12V23.67A1.33588,1.33588,0,0,1,15.67,25H9.25A8.24022,8.24022,0,0,1,9,23V13.5A1.498,1.498,0,0,1,10.5,12Z" opacity="0.2"/><path d="M10.5,12A1.498,1.498,0,0,0,9,13.5V23a8.24022,8.24022,0,0,0,.25,2h5.42A1.33588,1.33588,0,0,0,16,23.67V12Z" opacity="0.2"/><path id="Back_Plate" data-name="Back Plate" d="M1.33334,8H14.6667A1.33333,1.33333,0,0,1,16,9.33333V22.66666A1.33333,1.33333,0,0,1,14.6667,24H1.33334A1.33334,1.33334,0,0,1,0,22.66666V9.33334A1.33334,1.33334,0,0,1,1.33334,8Z" fill="#4b53bc"/><path d="M11.97961,12.975H8.99081v8.0203H7.02654V12.975H4.02042V11.00466h7.95919Z" fill="#fff"/><rect width="32" height="32" fill="none"/></g></svg> \ No newline at end of file
diff --git a/recipes/msteams/index.js b/recipes/msteams/index.js
new file mode 100644
index 0000000..918b7b3
--- /dev/null
+++ b/recipes/msteams/index.js
@@ -0,0 +1,7 @@
1"use strict";
2
3module.exports = Franz => class MicrosoftTeams extends Franz {
4 overrideUserAgent() {
5 return window.navigator.userAgent.replace(/(Ferdi|Electron)\/\S+ \([^)]+\)/g, '');
6 }
7}; \ No newline at end of file
diff --git a/recipes/msteams/package.json b/recipes/msteams/package.json
new file mode 100644
index 0000000..4b3579a
--- /dev/null
+++ b/recipes/msteams/package.json
@@ -0,0 +1,15 @@
1{
2 "id": "msteams",
3 "name": "Microsoft Teams",
4 "version": "1.3.3",
5 "description": "Microsoft Teams",
6 "main": "index.js",
7 "author": "Stefan Malzner <stefan@adlk.io>",
8 "license": "MIT",
9 "config": {
10 "serviceURL": "https://teams.microsoft.com",
11 "hasNotificationSound": true,
12 "hasDirectMessages": true,
13 "hasIndirectMessages": true
14 }
15}
diff --git a/recipes/msteams/service.css b/recipes/msteams/service.css
new file mode 100644
index 0000000..fdaeac6
--- /dev/null
+++ b/recipes/msteams/service.css
@@ -0,0 +1,63 @@
1notification-banner {
2 display: none !important;
3}
4.desktop-capturer-selection {
5 position: fixed;
6 top: 0;
7 left: 0;
8 width: 100%;
9 height: 100vh;
10 background: rgba(30,30,30,.75);
11 color: #fff;
12 z-index: 10000000;
13 display: flex;
14 align-items: center;
15 justify-content: center;
16}
17.desktop-capturer-selection__scroller {
18 width: 100%;
19 max-height: 100vh;
20 overflow-y: auto;
21}
22.desktop-capturer-selection__list {
23 max-width: calc(100% - 100px);
24 margin: 50px;
25 padding: 0;
26 display: flex;
27 flex-wrap: wrap;
28 list-style: none;
29 overflow: hidden;
30 justify-content: center;
31}
32.desktop-capturer-selection__item {
33 display: flex;
34 margin: 4px;
35}
36.desktop-capturer-selection__btn {
37 display: flex;
38 flex-direction: column;
39 align-items: stretch;
40 width: 145px;
41 margin: 0;
42 border: 0;
43 border-radius: 3px;
44 padding: 4px;
45 background: #252626;
46 text-align: left;
47 transition: background-color .15s, box-shadow .15s;
48}
49.desktop-capturer-selection__btn:hover,
50.desktop-capturer-selection__btn:focus {
51 background: rgba(98,100,167,.8);
52}
53.desktop-capturer-selection__thumbnail {
54 width: 100%;
55 height: 81px;
56 object-fit: cover;
57}
58.desktop-capturer-selection__name {
59 margin: 6px 0 6px;
60 white-space: nowrap;
61 text-overflow: ellipsis;
62 overflow: hidden;
63} \ No newline at end of file
diff --git a/recipes/msteams/webview.js b/recipes/msteams/webview.js
new file mode 100644
index 0000000..7823c63
--- /dev/null
+++ b/recipes/msteams/webview.js
@@ -0,0 +1,87 @@
1"use strict";
2
3const { desktopCapturer } = require('electron');
4const path = require('path');
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
62window.electronSafeIpc = {
63 send: () => null,
64 on: () => null
65};
66window.desktop = undefined;
67
68module.exports = Franz => {
69 const getMessages = () => {
70 let messages = 0;
71 const badge = document.querySelector('.activity-badge.dot-activity-badge .activity-badge');
72
73 if (badge) {
74 const value = parseInt(badge.innerHTML, 10);
75
76 if (!isNaN(value)) {
77 messages = value;
78 }
79 }
80 const indirectMessages = document.querySelectorAll("[class*=channel-anchor][class*=ts-unread-channel]").length;
81
82 Franz.setBadge(messages, indirectMessages);
83 };
84
85 Franz.injectCSS(path.join(__dirname, 'service.css'));
86 Franz.loop(getMessages);
87};