diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-09-19 01:19:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 01:19:11 +0200 |
commit | 6ec6fef9017ee9d8fc436e48448d47b1fda8a820 (patch) | |
tree | 1839f85efb4e45b441e509d2fc12a28a05877e47 /recipes/slack | |
parent | Fix images opening in browser instead of in Discord (#712) (diff) | |
parent | also fix privileged API access for googlemeet (diff) | |
download | ferdium-recipes-6ec6fef9017ee9d8fc436e48448d47b1fda8a820.tar.gz ferdium-recipes-6ec6fef9017ee9d8fc436e48448d47b1fda8a820.tar.zst ferdium-recipes-6ec6fef9017ee9d8fc436e48448d47b1fda8a820.zip |
Merge pull request #713 from kris7t/fix-api-access
fix: privileged API access
Diffstat (limited to 'recipes/slack')
-rw-r--r-- | recipes/slack/package.json | 2 | ||||
-rw-r--r-- | recipes/slack/webview.js | 62 |
2 files changed, 32 insertions, 32 deletions
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); |