aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/mattermost
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-26 06:29:03 -0600
committerLibravatar GitHub <noreply@github.com>2023-07-26 17:59:03 +0530
commit9b8f01716774a960073e944823ab727cc867a8f6 (patch)
tree732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/mattermost
parentAdd Excalidraw recipe (#393) (diff)
downloadferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.gz
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.zst
ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.zip
chore: improve lint setup (#397)
- update eslint config to closely mirror the ones from ferdium-app - add .eslintignore - opt in to eslint `reportUnusedDisableDirectives` config option - remove `trailingComma: all` from `prettier` config which is default in `prettier` v3 - autofix or disable a lot of lint issues throughout codebase - add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions - upgrade all `eslint` and `prettier` related dependencies to latest - update lint:fix npm script - reformat touched files with prettier - bumped up minor version for all recipes that have changes - introduced injection of 'service.css' where it was missing in many recipes --------- Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'recipes/mattermost')
-rw-r--r--recipes/mattermost/index.js33
-rw-r--r--recipes/mattermost/package.json2
-rw-r--r--recipes/mattermost/webview.js37
3 files changed, 48 insertions, 24 deletions
diff --git a/recipes/mattermost/index.js b/recipes/mattermost/index.js
index fca10e1..74ab2ee 100644
--- a/recipes/mattermost/index.js
+++ b/recipes/mattermost/index.js
@@ -1,17 +1,18 @@
1module.exports = Ferdium => class Mattermost extends Ferdium { 1module.exports = Ferdium =>
2 async validateUrl(url) { 2 class Mattermost extends Ferdium {
3 try { 3 async validateUrl(url) {
4 const resp = await window.fetch(url, { 4 try {
5 method: 'GET', 5 const resp = await window.fetch(url, {
6 headers: { 6 method: 'GET',
7 'Content-Type': 'application/json', 7 headers: {
8 }, 8 'Content-Type': 'application/json',
9 }); 9 },
10 return resp.status.toString().startsWith('2'); 10 });
11 } catch (error) { 11 return resp.status.toString().startsWith('2');
12 console.error(error); 12 } catch (error) {
13 } 13 console.error(error);
14 }
14 15
15 return false; 16 return false;
16 } 17 }
17}; 18 };
diff --git a/recipes/mattermost/package.json b/recipes/mattermost/package.json
index 457973d..cbdcbda 100644
--- a/recipes/mattermost/package.json
+++ b/recipes/mattermost/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "mattermost", 2 "id": "mattermost",
3 "name": "Mattermost", 3 "name": "Mattermost",
4 "version": "1.4.0", 4 "version": "1.5.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "hasNotificationSound": true, 7 "hasNotificationSound": true,
diff --git a/recipes/mattermost/webview.js b/recipes/mattermost/webview.js
index 32e990e..716848e 100644
--- a/recipes/mattermost/webview.js
+++ b/recipes/mattermost/webview.js
@@ -1,22 +1,45 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
1module.exports = Ferdium => { 7module.exports = Ferdium => {
2 const DIRECT_MESSAGES_INDIVIDUAL = '#sidebar-left .unread-title .DirectChannel__profile-picture'; 8 const DIRECT_MESSAGES_INDIVIDUAL =
9 '#sidebar-left .unread-title .DirectChannel__profile-picture';
3 const DIRECT_MESSAGES_GROUP = '#sidebar-left .unread-title .status--group'; 10 const DIRECT_MESSAGES_GROUP = '#sidebar-left .unread-title .status--group';
4 const DIRECT_MESSAGES_LEGACY = '.sidebar--left .has-badge .badge'; 11 const DIRECT_MESSAGES_LEGACY = '.sidebar--left .has-badge .badge';
5 const ALL_MESSAGES = '#sidebar-left .unread-title'; 12 const ALL_MESSAGES = '#sidebar-left .unread-title';
6 const ALL_MESSAGES_LEGACY = '#sidebar-left .unread-title'; 13 const ALL_MESSAGES_LEGACY = '#sidebar-left .unread-title';
7 14
8 const getMessages = () => { 15 const getMessages = () => {
9 const directMessagesSelector = [DIRECT_MESSAGES_LEGACY, DIRECT_MESSAGES_INDIVIDUAL, DIRECT_MESSAGES_GROUP].join(', '); 16 const directMessagesSelector = [
10 const directMessages = document.querySelectorAll(directMessagesSelector).length; 17 DIRECT_MESSAGES_LEGACY,
18 DIRECT_MESSAGES_INDIVIDUAL,
19 DIRECT_MESSAGES_GROUP,
20 ].join(', ');
21 const directMessages = document.querySelectorAll(
22 directMessagesSelector,
23 ).length;
11 24
12 const allMessagesSelector = [ALL_MESSAGES, ALL_MESSAGES_LEGACY].join(', '); 25 const allMessagesSelector = [ALL_MESSAGES, ALL_MESSAGES_LEGACY].join(', ');
13 const allMessages = document.querySelectorAll(allMessagesSelector).length - directMessages; 26 const allMessages =
27 document.querySelectorAll(allMessagesSelector).length - directMessages;
14 28
15 const teamDirectMessages = document.querySelectorAll('.team-wrapper .team-container .badge').length; 29 const teamDirectMessages = document.querySelectorAll(
16 const teamMessages = document.querySelectorAll('.team-wrapper .unread').length - teamDirectMessages; 30 '.team-wrapper .team-container .badge',
31 ).length;
32 const teamMessages =
33 document.querySelectorAll('.team-wrapper .unread').length -
34 teamDirectMessages;
17 35
18 Ferdium.setBadge(directMessages + teamDirectMessages, allMessages + teamMessages); 36 Ferdium.setBadge(
37 directMessages + teamDirectMessages,
38 allMessages + teamMessages,
39 );
19 }; 40 };
20 41
21 Ferdium.loop(getMessages); 42 Ferdium.loop(getMessages);
43
44 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
22}; 45};