diff options
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/android-messages/package.json | 2 | ||||
-rw-r--r-- | recipes/android-messages/webview.js | 10 | ||||
-rw-r--r-- | recipes/devRant/package.json | 2 | ||||
-rw-r--r-- | recipes/devRant/webview.js | 10 | ||||
-rw-r--r-- | recipes/discord/package.json | 2 | ||||
-rw-r--r-- | recipes/discord/webview.js | 58 | ||||
-rw-r--r-- | recipes/googlemeet/package.json | 2 | ||||
-rw-r--r-- | recipes/googlemeet/webview.js | 8 | ||||
-rw-r--r-- | recipes/lastpass/package.json | 2 | ||||
-rw-r--r-- | recipes/lastpass/webview.js | 10 | ||||
-rw-r--r-- | recipes/msteams/package.json | 2 | ||||
-rw-r--r-- | recipes/msteams/webview.js | 10 | ||||
-rw-r--r-- | recipes/rocketchat/package.json | 2 | ||||
-rw-r--r-- | recipes/rocketchat/webview.js | 67 | ||||
-rw-r--r-- | recipes/slack/package.json | 2 | ||||
-rw-r--r-- | recipes/slack/webview.js | 62 | ||||
-rw-r--r-- | recipes/tweetdeck/package.json | 2 | ||||
-rw-r--r-- | recipes/tweetdeck/webview.js | 10 | ||||
-rw-r--r-- | recipes/whatsapp/package.json | 2 | ||||
-rw-r--r-- | recipes/whatsapp/webview.js | 10 |
20 files changed, 109 insertions, 166 deletions
diff --git a/recipes/android-messages/package.json b/recipes/android-messages/package.json index 354c21d..962eb2b 100644 --- a/recipes/android-messages/package.json +++ b/recipes/android-messages/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "android-messages", | 2 | "id": "android-messages", |
3 | "name": "Android Messages", | 3 | "name": "Android Messages", |
4 | "version": "2.2.1", | 4 | "version": "2.2.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://messages.google.com/web", | 7 | "serviceURL": "https://messages.google.com/web", |
diff --git a/recipes/android-messages/webview.js b/recipes/android-messages/webview.js index 6a73441..db65de6 100644 --- a/recipes/android-messages/webview.js +++ b/recipes/android-messages/webview.js | |||
@@ -7,17 +7,17 @@ setTimeout(() => { | |||
7 | } | 7 | } |
8 | }, 1000); | 8 | }, 1000); |
9 | 9 | ||
10 | window.addEventListener('beforeunload', async () => { | ||
11 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
12 | Ferdi.releaseServiceWorkers(); | ||
13 | }); | ||
14 | |||
15 | module.exports = (Ferdi, settings) => { | 10 | module.exports = (Ferdi, settings) => { |
16 | function getMessages() { | 11 | function getMessages() { |
17 | const messages = document.querySelectorAll('.text-content.unread').length; | 12 | const messages = document.querySelectorAll('.text-content.unread').length; |
18 | Ferdi.setBadge(messages); | 13 | Ferdi.setBadge(messages); |
19 | } | 14 | } |
20 | 15 | ||
16 | window.addEventListener('beforeunload', async () => { | ||
17 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
18 | Ferdi.releaseServiceWorkers(); | ||
19 | }); | ||
20 | |||
21 | Ferdi.loop(getMessages); | 21 | Ferdi.loop(getMessages); |
22 | 22 | ||
23 | if (settings.isDarkModeEnabled) { | 23 | if (settings.isDarkModeEnabled) { |
diff --git a/recipes/devRant/package.json b/recipes/devRant/package.json index 4aa3517..6dee2d6 100644 --- a/recipes/devRant/package.json +++ b/recipes/devRant/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "devRant", | 2 | "id": "devRant", |
3 | "name": "devRant", | 3 | "name": "devRant", |
4 | "version": "1.0.0", | 4 | "version": "1.0.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "repository": "https://github.com/emamut/recipe-devrant", | 6 | "repository": "https://github.com/emamut/recipe-devrant", |
7 | "config": { | 7 | "config": { |
diff --git a/recipes/devRant/webview.js b/recipes/devRant/webview.js index e7e41a5..62a47e6 100644 --- a/recipes/devRant/webview.js +++ b/recipes/devRant/webview.js | |||
@@ -9,11 +9,6 @@ setTimeout(() => { | |||
9 | } | 9 | } |
10 | }, 1000); | 10 | }, 1000); |
11 | 11 | ||
12 | window.addEventListener('beforeunload', async () => { | ||
13 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
14 | Ferdi.releaseServiceWorkers(); | ||
15 | }); | ||
16 | |||
17 | module.exports = (Ferdi) => { | 12 | module.exports = (Ferdi) => { |
18 | const getMessages = function getMessages() { | 13 | const getMessages = function getMessages() { |
19 | const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); | 14 | const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); |
@@ -27,6 +22,11 @@ module.exports = (Ferdi) => { | |||
27 | Ferdi.setBadge(count); | 22 | Ferdi.setBadge(count); |
28 | }; | 23 | }; |
29 | 24 | ||
25 | window.addEventListener('beforeunload', async () => { | ||
26 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
27 | Ferdi.releaseServiceWorkers(); | ||
28 | }); | ||
29 | |||
30 | Ferdi.loop(getMessages); | 30 | Ferdi.loop(getMessages); |
31 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 31 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
32 | }; | 32 | }; |
diff --git a/recipes/discord/package.json b/recipes/discord/package.json index c644d66..243e64b 100644 --- a/recipes/discord/package.json +++ b/recipes/discord/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "discord", | 2 | "id": "discord", |
3 | "name": "Discord", | 3 | "name": "Discord", |
4 | "version": "1.4.1", | 4 | "version": "1.4.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://discordapp.com/login", | 7 | "serviceURL": "https://discordapp.com/login", |
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 9c96f9f..3134221 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js | |||
@@ -1,65 +1,7 @@ | |||
1 | // TODO: Some/most of this is already present in https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.js#L5 | ||
2 | |||
3 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
4 | 2 | ||
5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
6 | 4 | ||
7 | window.navigator.mediaDevices.getDisplayMedia = () => { | ||
8 | return new Promise(async (resolve, reject) => { | ||
9 | try { | ||
10 | const sources = await Ferdi.desktopCapturer.getSources({ types: ['screen', 'window'] }); | ||
11 | |||
12 | const selectionElem = document.createElement('div'); | ||
13 | selectionElem.classList = 'desktop-capturer-selection'; | ||
14 | selectionElem.innerHTML = ` | ||
15 | <div class="desktop-capturer-selection__scroller"> | ||
16 | <ul class="desktop-capturer-selection__list"> | ||
17 | ${sources.map(({ id, name, thumbnail, display_id, appIcon }) => ` | ||
18 | <li class="desktop-capturer-selection__item"> | ||
19 | <button class="desktop-capturer-selection__btn" data-id="${id}" title="${name}"> | ||
20 | <img class="desktop-capturer-selection__thumbnail" src="${thumbnail.toDataURL()}" /> | ||
21 | <span class="desktop-capturer-selection__name">${name}</span> | ||
22 | </button> | ||
23 | </li> | ||
24 | `).join('')} | ||
25 | </ul> | ||
26 | </div> | ||
27 | `; | ||
28 | document.body.appendChild(selectionElem); | ||
29 | |||
30 | document.querySelectorAll('.desktop-capturer-selection__btn') | ||
31 | .forEach(button => { | ||
32 | button.addEventListener('click', async () => { | ||
33 | try { | ||
34 | const id = button.getAttribute('data-id'); | ||
35 | const source = sources.find(source => source.id === id); | ||
36 | if (!source) { | ||
37 | throw new Error(`Source with id ${id} does not exist`); | ||
38 | } | ||
39 | |||
40 | const stream = await window.navigator.mediaDevices.getUserMedia({ | ||
41 | audio: false, | ||
42 | video: { | ||
43 | mandatory: { | ||
44 | chromeMediaSource: 'desktop', | ||
45 | chromeMediaSourceId: source.id | ||
46 | } | ||
47 | } | ||
48 | }); | ||
49 | resolve(stream); | ||
50 | |||
51 | selectionElem.remove(); | ||
52 | } catch (err) { | ||
53 | reject(err); | ||
54 | } | ||
55 | }); | ||
56 | }); | ||
57 | } catch (err) { | ||
58 | reject(err); | ||
59 | } | ||
60 | }) | ||
61 | } | ||
62 | |||
63 | module.exports = (Ferdi, settings) => { | 5 | module.exports = (Ferdi, settings) => { |
64 | const getMessages = function getMessages() { | 6 | const getMessages = function getMessages() { |
65 | let count = 0; | 7 | let count = 0; |
diff --git a/recipes/googlemeet/package.json b/recipes/googlemeet/package.json index 55cc0b8..731de9d 100644 --- a/recipes/googlemeet/package.json +++ b/recipes/googlemeet/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "googlemeet", | 2 | "id": "googlemeet", |
3 | "name": "Google Meet", | 3 | "name": "Google Meet", |
4 | "version": "2.2.1", | 4 | "version": "2.2.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://meet.google.com", | 7 | "serviceURL": "https://meet.google.com", |
diff --git a/recipes/googlemeet/webview.js b/recipes/googlemeet/webview.js index 9d334ba..ac186ab 100644 --- a/recipes/googlemeet/webview.js +++ b/recipes/googlemeet/webview.js | |||
@@ -10,10 +10,6 @@ window.onload = () => { | |||
10 | } | 10 | } |
11 | }; | 11 | }; |
12 | 12 | ||
13 | window.addEventListener('beforeunload', async () => { | ||
14 | Ferdi.clearStorageData(['serviceworkers']); | ||
15 | }); | ||
16 | |||
17 | module.exports = Ferdi => { | 13 | module.exports = Ferdi => { |
18 | const getMessages = function getMessages() { | 14 | const getMessages = function getMessages() { |
19 | const elements = document.querySelectorAll('.CxUIE, .unread'); | 15 | const elements = document.querySelectorAll('.CxUIE, .unread'); |
@@ -30,5 +26,9 @@ module.exports = Ferdi => { | |||
30 | 26 | ||
31 | Ferdi.loop(getMessages); | 27 | Ferdi.loop(getMessages); |
32 | 28 | ||
29 | window.addEventListener('beforeunload', async () => { | ||
30 | Ferdi.clearStorageData(['serviceworkers']); | ||
31 | }); | ||
32 | |||
33 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 33 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
34 | }; | 34 | }; |
diff --git a/recipes/lastpass/package.json b/recipes/lastpass/package.json index 75632bd..eed8f9e 100644 --- a/recipes/lastpass/package.json +++ b/recipes/lastpass/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "lastpass", | 2 | "id": "lastpass", |
3 | "name": "LastPass", | 3 | "name": "LastPass", |
4 | "version": "2.2.1", | 4 | "version": "2.2.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://lastpass.com/?ac=1&lpnorefresh=1", | 7 | "serviceURL": "https://lastpass.com/?ac=1&lpnorefresh=1", |
diff --git a/recipes/lastpass/webview.js b/recipes/lastpass/webview.js index 4a92e0c..96e92ff 100644 --- a/recipes/lastpass/webview.js +++ b/recipes/lastpass/webview.js | |||
@@ -8,11 +8,6 @@ setTimeout(() => { | |||
8 | } | 8 | } |
9 | }, 1000); | 9 | }, 1000); |
10 | 10 | ||
11 | window.addEventListener('beforeunload', async () => { | ||
12 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
13 | Ferdi.releaseServiceWorkers(); | ||
14 | }); | ||
15 | |||
16 | module.exports = Ferdi => { | 11 | module.exports = Ferdi => { |
17 | const getMessages = function getMessages() { | 12 | const getMessages = function getMessages() { |
18 | const elements = document.querySelectorAll('.CxUIE, .unread'); | 13 | const elements = document.querySelectorAll('.CxUIE, .unread'); |
@@ -27,6 +22,11 @@ module.exports = Ferdi => { | |||
27 | Ferdi.setBadge(count); | 22 | Ferdi.setBadge(count); |
28 | }; | 23 | }; |
29 | 24 | ||
25 | window.addEventListener('beforeunload', async () => { | ||
26 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
27 | Ferdi.releaseServiceWorkers(); | ||
28 | }); | ||
29 | |||
30 | Ferdi.loop(getMessages); | 30 | Ferdi.loop(getMessages); |
31 | 31 | ||
32 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 32 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
diff --git a/recipes/msteams/package.json b/recipes/msteams/package.json index 10fb69b..17c0aa0 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": "3.1.4", | 4 | "version": "3.1.5", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "aliases": [ | 6 | "aliases": [ |
7 | "teamsChat" | 7 | "teamsChat" |
diff --git a/recipes/msteams/webview.js b/recipes/msteams/webview.js index 786cd9b..94f3ae8 100644 --- a/recipes/msteams/webview.js +++ b/recipes/msteams/webview.js | |||
@@ -2,11 +2,6 @@ const _path = _interopRequireDefault(require('path')); | |||
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | window.addEventListener('beforeunload', async () => { | ||
6 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
7 | Ferdi.releaseServiceWorkers(); | ||
8 | }); | ||
9 | |||
10 | module.exports = Ferdi => { | 5 | module.exports = Ferdi => { |
11 | const getMessages = () => { | 6 | const getMessages = () => { |
12 | let messages = 0; | 7 | let messages = 0; |
@@ -20,6 +15,11 @@ module.exports = Ferdi => { | |||
20 | Ferdi.setBadge(messages, indirectMessages); | 15 | Ferdi.setBadge(messages, indirectMessages); |
21 | }; | 16 | }; |
22 | 17 | ||
18 | window.addEventListener('beforeunload', async () => { | ||
19 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
20 | Ferdi.releaseServiceWorkers(); | ||
21 | }); | ||
22 | |||
23 | Ferdi.loop(getMessages); | 23 | Ferdi.loop(getMessages); |
24 | 24 | ||
25 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 25 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
diff --git a/recipes/rocketchat/package.json b/recipes/rocketchat/package.json index 3b807bf..f2c6374 100644 --- a/recipes/rocketchat/package.json +++ b/recipes/rocketchat/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "rocketchat", | 2 | "id": "rocketchat", |
3 | "name": "Rocket.Chat", | 3 | "name": "Rocket.Chat", |
4 | "version": "1.2.0", | 4 | "version": "1.2.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://{teamId}.rocket.chat", | 7 | "serviceURL": "https://{teamId}.rocket.chat", |
diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js index 4240935..159adea 100644 --- a/recipes/rocketchat/webview.js +++ b/recipes/rocketchat/webview.js | |||
@@ -1,36 +1,3 @@ | |||
1 | const getTeamIcon = function getTeamIcon() { | ||
2 | const manifestElement = document.querySelector('link[rel="manifest"]'); | ||
3 | |||
4 | if (manifestElement == null) { | ||
5 | return; | ||
6 | } | ||
7 | |||
8 | const manifestUrl = manifestElement.getAttribute('href'); | ||
9 | |||
10 | if (manifestUrl == null) { | ||
11 | return; | ||
12 | } | ||
13 | |||
14 | const xmlhttp = new XMLHttpRequest(); | ||
15 | |||
16 | xmlhttp.onreadystatechange = function () { | ||
17 | if (this.readyState != 4 || this.status != 200) { | ||
18 | return; | ||
19 | } | ||
20 | |||
21 | const response = JSON.parse(this.responseText); | ||
22 | |||
23 | if (response.icons.length >= 1) { | ||
24 | Ferdi.ipcRenderer.sendToHost( | ||
25 | 'avatar', | ||
26 | `${window.location.protocol}//${window.location.host}${response.icons[0].src}`, | ||
27 | ); | ||
28 | } | ||
29 | }; | ||
30 | |||
31 | xmlhttp.open('GET', manifestUrl, true); | ||
32 | xmlhttp.send(); | ||
33 | }; | ||
34 | 1 | ||
35 | module.exports = Ferdi => { | 2 | module.exports = Ferdi => { |
36 | const getMessages = function getMessages() { | 3 | const getMessages = function getMessages() { |
@@ -51,6 +18,40 @@ module.exports = Ferdi => { | |||
51 | 18 | ||
52 | Ferdi.loop(getMessages); | 19 | Ferdi.loop(getMessages); |
53 | 20 | ||
21 | const getTeamIcon = function getTeamIcon() { | ||
22 | const manifestElement = document.querySelector('link[rel="manifest"]'); | ||
23 | |||
24 | if (manifestElement == null) { | ||
25 | return; | ||
26 | } | ||
27 | |||
28 | const manifestUrl = manifestElement.getAttribute('href'); | ||
29 | |||
30 | if (manifestUrl == null) { | ||
31 | return; | ||
32 | } | ||
33 | |||
34 | const xmlhttp = new XMLHttpRequest(); | ||
35 | |||
36 | xmlhttp.onreadystatechange = function () { | ||
37 | if (this.readyState != 4 || this.status != 200) { | ||
38 | return; | ||
39 | } | ||
40 | |||
41 | const response = JSON.parse(this.responseText); | ||
42 | |||
43 | if (response.icons.length >= 1) { | ||
44 | Ferdi.ipcRenderer.sendToHost( | ||
45 | 'avatar', | ||
46 | `${window.location.protocol}//${window.location.host}${response.icons[0].src}`, | ||
47 | ); | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | xmlhttp.open('GET', manifestUrl, true); | ||
52 | xmlhttp.send(); | ||
53 | }; | ||
54 | |||
54 | setTimeout(() => { | 55 | setTimeout(() => { |
55 | getTeamIcon(); | 56 | getTeamIcon(); |
56 | }, 4000); | 57 | }, 4000); |
diff --git a/recipes/slack/package.json b/recipes/slack/package.json index 7c87e93..877bd8e 100644 --- a/recipes/slack/package.json +++ b/recipes/slack/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "slack", | 2 | "id": "slack", |
3 | "name": "Slack", | 3 | "name": "Slack", |
4 | "version": "1.3.0", | 4 | "version": "1.3.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://{teamId}.slack.com", | 7 | "serviceURL": "https://{teamId}.slack.com", |
diff --git a/recipes/slack/webview.js b/recipes/slack/webview.js index 1a12e80..3064e79 100644 --- a/recipes/slack/webview.js +++ b/recipes/slack/webview.js | |||
@@ -2,37 +2,6 @@ const _path = _interopRequireDefault(require('path')); | |||
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | const getTeamIcon = function getTeamIcon(count = 0) { | ||
6 | let countTeamIconCheck = count; | ||
7 | let bgUrl = null; | ||
8 | const teamMenu = document.querySelector('#team-menu-trigger, .p-ia__sidebar_header__team_name'); | ||
9 | |||
10 | if (teamMenu) { | ||
11 | teamMenu.click(); | ||
12 | const icon = document.querySelector('.c-team_icon'); | ||
13 | |||
14 | if (icon) { | ||
15 | bgUrl = window.getComputedStyle(icon, null).getPropertyValue('background-image'); | ||
16 | bgUrl = /^url\((['"]?)(.*)\1\)$/.exec(bgUrl); | ||
17 | bgUrl = bgUrl ? bgUrl[2] : ''; | ||
18 | } | ||
19 | |||
20 | setTimeout(() => { | ||
21 | document.querySelector('.ReactModal__Overlay').click(); | ||
22 | }, 10); | ||
23 | } | ||
24 | |||
25 | countTeamIconCheck += 1; | ||
26 | |||
27 | if (bgUrl) { | ||
28 | Ferdi.ipcRenderer.sendToHost('avatar', bgUrl); | ||
29 | } else if (countTeamIconCheck <= 5) { | ||
30 | setTimeout(() => { | ||
31 | getTeamIcon(countTeamIconCheck + 1); | ||
32 | }, 2000); | ||
33 | } | ||
34 | }; | ||
35 | |||
36 | const SELECTOR_CHANNELS_UNREAD = '.p-channel_sidebar__channel--unread:not(.p-channel_sidebar__channel--muted)'; | 5 | const SELECTOR_CHANNELS_UNREAD = '.p-channel_sidebar__channel--unread:not(.p-channel_sidebar__channel--muted)'; |
37 | 6 | ||
38 | module.exports = Ferdi => { | 7 | module.exports = Ferdi => { |
@@ -44,6 +13,37 @@ module.exports = Ferdi => { | |||
44 | 13 | ||
45 | Ferdi.loop(getMessages); | 14 | Ferdi.loop(getMessages); |
46 | 15 | ||
16 | const getTeamIcon = function getTeamIcon(count = 0) { | ||
17 | let countTeamIconCheck = count; | ||
18 | let bgUrl = null; | ||
19 | const teamMenu = document.querySelector('#team-menu-trigger, .p-ia__sidebar_header__team_name'); | ||
20 | |||
21 | if (teamMenu) { | ||
22 | teamMenu.click(); | ||
23 | const icon = document.querySelector('.c-team_icon'); | ||
24 | |||
25 | if (icon) { | ||
26 | bgUrl = window.getComputedStyle(icon, null).getPropertyValue('background-image'); | ||
27 | bgUrl = /^url\((['"]?)(.*)\1\)$/.exec(bgUrl); | ||
28 | bgUrl = bgUrl ? bgUrl[2] : ''; | ||
29 | } | ||
30 | |||
31 | setTimeout(() => { | ||
32 | document.querySelector('.ReactModal__Overlay').click(); | ||
33 | }, 10); | ||
34 | } | ||
35 | |||
36 | countTeamIconCheck += 1; | ||
37 | |||
38 | if (bgUrl) { | ||
39 | Ferdi.ipcRenderer.sendToHost('avatar', bgUrl); | ||
40 | } else if (countTeamIconCheck <= 5) { | ||
41 | setTimeout(() => { | ||
42 | getTeamIcon(countTeamIconCheck + 1); | ||
43 | }, 2000); | ||
44 | } | ||
45 | }; | ||
46 | |||
47 | setTimeout(() => { | 47 | setTimeout(() => { |
48 | getTeamIcon(); | 48 | getTeamIcon(); |
49 | }, 4000); | 49 | }, 4000); |
diff --git a/recipes/tweetdeck/package.json b/recipes/tweetdeck/package.json index a438716..5400bac 100644 --- a/recipes/tweetdeck/package.json +++ b/recipes/tweetdeck/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "tweetdeck", | 2 | "id": "tweetdeck", |
3 | "name": "Tweetdeck", | 3 | "name": "Tweetdeck", |
4 | "version": "1.2.0", | 4 | "version": "1.2.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://tweetdeck.twitter.com/", | 7 | "serviceURL": "https://tweetdeck.twitter.com/", |
diff --git a/recipes/tweetdeck/webview.js b/recipes/tweetdeck/webview.js index b60415d..54b7997 100644 --- a/recipes/tweetdeck/webview.js +++ b/recipes/tweetdeck/webview.js | |||
@@ -1,9 +1,9 @@ | |||
1 | // Tweetdeck redirect fix | ||
2 | Ferdi.ipcRenderer.on('redirect-url', (event, url) => { | ||
3 | window.location.assign(url); | ||
4 | }); | ||
5 | |||
6 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
2 | // Tweetdeck redirect fix | ||
3 | Ferdi.ipcRenderer.on('redirect-url', (event, url) => { | ||
4 | window.location.assign(url); | ||
5 | }); | ||
6 | |||
7 | const getMessages = function getMessages() { | 7 | const getMessages = function getMessages() { |
8 | const elements = document.querySelectorAll('.msg-unread-count'); | 8 | const elements = document.querySelectorAll('.msg-unread-count'); |
9 | let count = 0; | 9 | let count = 0; |
diff --git a/recipes/whatsapp/package.json b/recipes/whatsapp/package.json index 4e59177..a364a1f 100644 --- a/recipes/whatsapp/package.json +++ b/recipes/whatsapp/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "whatsapp", | 2 | "id": "whatsapp", |
3 | "name": "WhatsApp", | 3 | "name": "WhatsApp", |
4 | "version": "3.3.2", | 4 | "version": "3.3.3", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://web.whatsapp.com", | 7 | "serviceURL": "https://web.whatsapp.com", |
diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index 3df34e3..fb1a20b 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js | |||
@@ -2,11 +2,6 @@ const _path = _interopRequireDefault(require('path')); | |||
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | window.addEventListener('beforeunload', async () => { | ||
6 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
7 | Ferdi.releaseServiceWorkers(); | ||
8 | }); | ||
9 | |||
10 | module.exports = Ferdi => { | 5 | module.exports = Ferdi => { |
11 | const getMessages = function getMessages() { | 6 | const getMessages = function getMessages() { |
12 | let count = 0; | 7 | let count = 0; |
@@ -34,6 +29,11 @@ module.exports = Ferdi => { | |||
34 | Ferdi.setBadge(count, indirectCount); | 29 | Ferdi.setBadge(count, indirectCount); |
35 | }; | 30 | }; |
36 | 31 | ||
32 | window.addEventListener('beforeunload', async () => { | ||
33 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); | ||
34 | Ferdi.releaseServiceWorkers(); | ||
35 | }); | ||
36 | |||
37 | Ferdi.loop(getMessages); | 37 | Ferdi.loop(getMessages); |
38 | 38 | ||
39 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 39 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |