diff options
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/wire/LICENSE | 21 | ||||
-rw-r--r-- | recipes/wire/README.md | 3 | ||||
-rw-r--r-- | recipes/wire/icon.png | bin | 0 -> 35371 bytes | |||
-rw-r--r-- | recipes/wire/icon.svg | 10 | ||||
-rw-r--r-- | recipes/wire/index.js | 1 | ||||
-rw-r--r-- | recipes/wire/package.json | 18 | ||||
-rw-r--r-- | recipes/wire/webview.js | 38 |
7 files changed, 91 insertions, 0 deletions
diff --git a/recipes/wire/LICENSE b/recipes/wire/LICENSE new file mode 100644 index 0000000..fd3ae1e --- /dev/null +++ b/recipes/wire/LICENSE | |||
@@ -0,0 +1,21 @@ | |||
1 | MIT License | ||
2 | |||
3 | Copyright (c) 2020 Dustin Steiner | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in all | ||
13 | copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | SOFTWARE. | ||
diff --git a/recipes/wire/README.md b/recipes/wire/README.md new file mode 100644 index 0000000..1aa662b --- /dev/null +++ b/recipes/wire/README.md | |||
@@ -0,0 +1,3 @@ | |||
1 | # Wire for Ferdi | ||
2 | |||
3 | This is a Ferdi recipe/plugin for the messenger Wire (https://wire.com) | ||
diff --git a/recipes/wire/icon.png b/recipes/wire/icon.png new file mode 100644 index 0000000..5b5cf6e --- /dev/null +++ b/recipes/wire/icon.png | |||
Binary files differ | |||
diff --git a/recipes/wire/icon.svg b/recipes/wire/icon.svg new file mode 100644 index 0000000..3b5c25a --- /dev/null +++ b/recipes/wire/icon.svg | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <svg width="512px" height="512px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
3 | <title>Untitled</title> | ||
4 | <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> | ||
5 | <g id="icon"> | ||
6 | <rect id="Rectangle" fill="#FFFFFF" fill-rule="nonzero" x="0" y="0" width="512" height="512"></rect> | ||
7 | <path d="M99,127 L99,290 C99,341.362482 140.637518,383 192,383 C243.362482,383 285,341.362482 285,290 L285,157 C285,140.983742 272.016258,128 256,128 C239.983742,128 227,140.983742 227,157 L227,290 C227,341.362482 268.637518,383 320,383 C371.362482,383 413,341.362482 413,290 L413,127" id="Path" stroke="#000000" stroke-width="19"></path> | ||
8 | </g> | ||
9 | </g> | ||
10 | </svg> \ No newline at end of file | ||
diff --git a/recipes/wire/index.js b/recipes/wire/index.js new file mode 100644 index 0000000..653b54c --- /dev/null +++ b/recipes/wire/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = (Ferdi) => Ferdi; | |||
diff --git a/recipes/wire/package.json b/recipes/wire/package.json new file mode 100644 index 0000000..7849162 --- /dev/null +++ b/recipes/wire/package.json | |||
@@ -0,0 +1,18 @@ | |||
1 | { | ||
2 | "id": "wire", | ||
3 | "name": "Wire", | ||
4 | "version": "1.0.0", | ||
5 | "description": "Modern day collaboration meets the most advanced security and superior user experience.", | ||
6 | "main": "index.js", | ||
7 | "author": "Dustin Steiner <dustin.steiner@gmail.com>", | ||
8 | "license": "MIT", | ||
9 | "repository": { | ||
10 | "type": "git", | ||
11 | "url": "https://github.com/getferdi/", | ||
12 | "directory": "recipes/wire" | ||
13 | }, | ||
14 | "config": { | ||
15 | "serviceURL": "https://app.wire.com/", | ||
16 | "hasIndirectMessages": true | ||
17 | } | ||
18 | } | ||
diff --git a/recipes/wire/webview.js b/recipes/wire/webview.js new file mode 100644 index 0000000..57baadc --- /dev/null +++ b/recipes/wire/webview.js | |||
@@ -0,0 +1,38 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | function getMessages() { | ||
3 | let direct = 0; | ||
4 | let indirect = 0; | ||
5 | |||
6 | // Count how many people/groups have texted you | ||
7 | const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); | ||
8 | if (conversationElems) { | ||
9 | for (const conversationElem of conversationElems) { | ||
10 | const count = parseInt(conversationElem.innerText); | ||
11 | if (count) { | ||
12 | direct += count; | ||
13 | } | ||
14 | } | ||
15 | } | ||
16 | |||
17 | // Count unread pending user requests | ||
18 | const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); | ||
19 | if (pendingElem) { | ||
20 | const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); | ||
21 | if (matches && matches.length > 0) { | ||
22 | indirect += parseInt(matches[1]); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | // Alternative would be to count all messages (unread conversation count + pending) from the header | ||
27 | // const titleElem = document.querySelector('head title'); | ||
28 | // const matches = titleElem.innerText.match(/^\(([1-9][0-9]*)\)/); | ||
29 | // if (matches) { | ||
30 | // direct = matches[1]; | ||
31 | // } | ||
32 | |||
33 | Ferdi.setBadge(direct, indirect); | ||
34 | } | ||
35 | |||
36 | Ferdi.loop(getMessages); | ||
37 | |||
38 | }; | ||