diff options
Diffstat (limited to 'recipes/rocketchat')
-rw-r--r-- | recipes/rocketchat/index.js | 9 | ||||
-rw-r--r-- | recipes/rocketchat/webview.js | 6 |
2 files changed, 5 insertions, 10 deletions
diff --git a/recipes/rocketchat/index.js b/recipes/rocketchat/index.js index 54450ce..499053a 100644 --- a/recipes/rocketchat/index.js +++ b/recipes/rocketchat/index.js | |||
@@ -1,13 +1,11 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => class RocketChat extends Franz { | 1 | module.exports = Franz => class RocketChat extends Franz { |
4 | async validateUrl(url) { | 2 | async validateUrl(url) { |
5 | try { | 3 | try { |
6 | const resp = await window.fetch(url, { | 4 | const resp = await window.fetch(url, { |
7 | method: 'GET', | 5 | method: 'GET', |
8 | headers: { | 6 | headers: { |
9 | 'Content-Type': 'application/json' | 7 | 'Content-Type': 'application/json', |
10 | } | 8 | }, |
11 | }); | 9 | }); |
12 | const status = resp.status.toString(); | 10 | const status = resp.status.toString(); |
13 | return status.startsWith('2') || status.startsWith('3'); | 11 | return status.startsWith('2') || status.startsWith('3'); |
@@ -17,5 +15,4 @@ module.exports = Franz => class RocketChat extends Franz { | |||
17 | 15 | ||
18 | return false; | 16 | return false; |
19 | } | 17 | } |
20 | 18 | }; | |
21 | }; \ No newline at end of file | ||
diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js index 447b19b..1702c74 100644 --- a/recipes/rocketchat/webview.js +++ b/recipes/rocketchat/webview.js | |||
@@ -1,5 +1,3 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | const { ipcRenderer } = require('electron'); | 1 | const { ipcRenderer } = require('electron'); |
4 | 2 | ||
5 | const getTeamIcon = function getTeamIcon() { | 3 | const getTeamIcon = function getTeamIcon() { |
@@ -27,7 +25,7 @@ const getTeamIcon = function getTeamIcon() { | |||
27 | if (response.icons.length >= 1) { | 25 | if (response.icons.length >= 1) { |
28 | ipcRenderer.sendToHost( | 26 | ipcRenderer.sendToHost( |
29 | 'avatar', | 27 | 'avatar', |
30 | `${window.location.protocol}//${window.location.host}${response.icons[0].src}` | 28 | `${window.location.protocol}//${window.location.host}${response.icons[0].src}`, |
31 | ); | 29 | ); |
32 | } | 30 | } |
33 | }; | 31 | }; |
@@ -47,7 +45,7 @@ module.exports = Ferdi => { | |||
47 | } | 45 | } |
48 | 46 | ||
49 | const indirectMessagesCount = Math.round( | 47 | const indirectMessagesCount = Math.round( |
50 | document.querySelectorAll('.rcx-sidebar-item--highlighted').length | 48 | document.querySelectorAll('.rcx-sidebar-item--highlighted').length, |
51 | ); | 49 | ); |
52 | 50 | ||
53 | Ferdi.setBadge(directMessagesCount, indirectMessagesCount); | 51 | Ferdi.setBadge(directMessagesCount, indirectMessagesCount); |