aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dustin <dustin.steiner@gmail.com>2020-10-27 18:20:38 +0000
committerLibravatar GitHub <noreply@github.com>2020-10-27 19:20:38 +0100
commit34471638f12398f8b474c45ed8609299935f769a (patch)
tree1f1ba217ff6d12001bb3104254c189677b266ad0
parentMerge pull request #341 from marcolussetti/clarify-docs-square-svg (diff)
downloadferdium-recipes-34471638f12398f8b474c45ed8609299935f769a.tar.gz
ferdium-recipes-34471638f12398f8b474c45ed8609299935f769a.tar.zst
ferdium-recipes-34471638f12398f8b474c45ed8609299935f769a.zip
Add recipe for Wire (#344)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
-rw-r--r--recipes/wire/LICENSE21
-rw-r--r--recipes/wire/README.md3
-rw-r--r--recipes/wire/icon.pngbin0 -> 35371 bytes
-rw-r--r--recipes/wire/icon.svg10
-rw-r--r--recipes/wire/index.js1
-rw-r--r--recipes/wire/package.json18
-rw-r--r--recipes/wire/webview.js38
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 @@
1MIT License
2
3Copyright (c) 2020 Dustin Steiner
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
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
3This 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 @@
1module.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};