aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat
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/rocketchat
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/rocketchat')
-rw-r--r--recipes/rocketchat/index.js35
-rw-r--r--recipes/rocketchat/package.json2
-rw-r--r--recipes/rocketchat/webview.js17
3 files changed, 32 insertions, 22 deletions
diff --git a/recipes/rocketchat/index.js b/recipes/rocketchat/index.js
index a7fee29..a89bd61 100644
--- a/recipes/rocketchat/index.js
+++ b/recipes/rocketchat/index.js
@@ -1,18 +1,19 @@
1module.exports = Ferdium => class RocketChat extends Ferdium { 1module.exports = Ferdium =>
2 async validateUrl(url) { 2 class RocketChat 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 const status = resp.status.toString(); 10 });
11 return status.startsWith('2') || status.startsWith('3'); 11 const status = resp.status.toString();
12 } catch (error) { 12 return status.startsWith('2') || status.startsWith('3');
13 console.error(error); 13 } catch (error) {
14 } 14 console.error(error);
15 }
15 16
16 return false; 17 return false;
17 } 18 }
18}; 19 };
diff --git a/recipes/rocketchat/package.json b/recipes/rocketchat/package.json
index 17719ed..164cd5f 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.3.0", 4 "version": "1.4.0",
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 85b0c32..74556de 100644
--- a/recipes/rocketchat/webview.js
+++ b/recipes/rocketchat/webview.js
@@ -1,3 +1,8 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
1 6
2module.exports = Ferdium => { 7module.exports = Ferdium => {
3 const getMessages = () => { 8 const getMessages = () => {
@@ -18,30 +23,34 @@ module.exports = Ferdium => {
18 23
19 Ferdium.loop(getMessages); 24 Ferdium.loop(getMessages);
20 25
26 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
27
21 const getTeamIcon = function getTeamIcon() { 28 const getTeamIcon = function getTeamIcon() {
22 const manifestElement = document.querySelector('link[rel="manifest"]'); 29 const manifestElement = document.querySelector('link[rel="manifest"]');
23 30
24 if (manifestElement == null) { 31 if (manifestElement === null) {
25 return; 32 return;
26 } 33 }
27 34
28 const manifestUrl = manifestElement.getAttribute('href'); 35 const manifestUrl = manifestElement.getAttribute('href');
29 36
30 if (manifestUrl == null) { 37 if (manifestUrl === null) {
31 return; 38 return;
32 } 39 }
33 40
34 const xmlhttp = new XMLHttpRequest(); 41 const xmlhttp = new XMLHttpRequest();
35 42
36 xmlhttp.addEventListener('readystatechange', function () { 43 xmlhttp.addEventListener('readystatechange', function () {
37 if (this.readyState != 4 || this.status != 200) { 44 if (this.readyState !== 4 || this.status !== 200) {
38 return; 45 return;
39 } 46 }
40 47
41 const response = JSON.parse(this.responseText); 48 const response = JSON.parse(this.responseText);
42 49
43 if (response.icons.length > 0) { 50 if (response.icons.length > 0) {
44 Ferdium.setAvatarImage(`${window.location.protocol}//${window.location.host}${response.icons[0].src}`); 51 Ferdium.setAvatarImage(
52 `${window.location.protocol}//${window.location.host}${response.icons[0].src}`,
53 );
45 } 54 }
46 }); 55 });
47 56