diff options
author | Simon Szustkowski <mail@simonszu.de> | 2022-02-16 12:43:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 12:43:41 +0100 |
commit | 18d91850bff013bd60cf9d95f4b981ea0ec4da65 (patch) | |
tree | 11085595fe2dc177c33cf02813a0a93946f14a41 /recipes | |
parent | Add Zoho Projects recipe (#830) (diff) | |
download | ferdium-recipes-18d91850bff013bd60cf9d95f4b981ea0ec4da65.tar.gz ferdium-recipes-18d91850bff013bd60cf9d95f4b981ea0ec4da65.tar.zst ferdium-recipes-18d91850bff013bd60cf9d95f4b981ea0ec4da65.zip |
Added recipe for FreshRSS (#825)
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/freshrss/README.md | 3 | ||||
-rw-r--r-- | recipes/freshrss/icon.svg | 13 | ||||
-rw-r--r-- | recipes/freshrss/index.js | 5 | ||||
-rw-r--r-- | recipes/freshrss/package.json | 9 | ||||
-rw-r--r-- | recipes/freshrss/webview.js | 25 |
5 files changed, 55 insertions, 0 deletions
diff --git a/recipes/freshrss/README.md b/recipes/freshrss/README.md new file mode 100644 index 0000000..4b9b17c --- /dev/null +++ b/recipes/freshrss/README.md | |||
@@ -0,0 +1,3 @@ | |||
1 | # FreshRSS for Ferdi | ||
2 | |||
3 | Unofficial Ferdi recipe for [FeshRSS](https://freshrss.org/) \ No newline at end of file | ||
diff --git a/recipes/freshrss/icon.svg b/recipes/freshrss/icon.svg new file mode 100644 index 0000000..a252050 --- /dev/null +++ b/recipes/freshrss/icon.svg | |||
@@ -0,0 +1,13 @@ | |||
1 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"> | ||
2 | <title>Logo FreshRSS</title> | ||
3 | <circle fill="#FFF" cx="128" cy="128" r="128"/> | ||
4 | <circle fill="#0062BE" cx="128" cy="128" r="33"/> | ||
5 | <g fill="none" stroke="#0062BE" stroke-width="24"> | ||
6 | <g stroke-opacity="0.3"> | ||
7 | <path d="M12,128 A116,116 0 1,1 128,244"/> | ||
8 | <path d="M54,128 A74,74 0 1,1 128,202"/> | ||
9 | </g> | ||
10 | <path d="M128,12 A116,116 0 0,1 244,128"/> | ||
11 | <path d="M128,54 A74,74 0 0,1 202,128"/> | ||
12 | </g> | ||
13 | </svg> | ||
diff --git a/recipes/freshrss/index.js b/recipes/freshrss/index.js new file mode 100644 index 0000000..f8a6e85 --- /dev/null +++ b/recipes/freshrss/index.js | |||
@@ -0,0 +1,5 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | // just pass through ferdi | ||
4 | |||
5 | module.exports = Ferdi => Ferdi; \ No newline at end of file | ||
diff --git a/recipes/freshrss/package.json b/recipes/freshrss/package.json new file mode 100644 index 0000000..64d44db --- /dev/null +++ b/recipes/freshrss/package.json | |||
@@ -0,0 +1,9 @@ | |||
1 | { | ||
2 | "id": "freshrss", | ||
3 | "name": "FreshRSS", | ||
4 | "version": "1.0.1", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "hasCustomUrl": true | ||
8 | } | ||
9 | } | ||
diff --git a/recipes/freshrss/webview.js b/recipes/freshrss/webview.js new file mode 100644 index 0000000..75da933 --- /dev/null +++ b/recipes/freshrss/webview.js | |||
@@ -0,0 +1,25 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Ferdi => { | ||
4 | const getMessages = function getMessages() { | ||
5 | // Initialize empty vars | ||
6 | var unread = 0; | ||
7 | var match = []; | ||
8 | // Define RegExp to replace occasionally   | ||
9 | var re = new RegExp(String.fromCodePoint(160), "g"); | ||
10 | // Get value of <title> tag where in case of new feed elements the number of elements appear | ||
11 | const titleValue = document.querySelector('title').text.replace(re, ""); | ||
12 | // Extract the number from the tag | ||
13 | match = titleValue.match(/[\d\s]+/); | ||
14 | // Some logic to handle the match groups | ||
15 | unread = match != null && match.length > 0 ? match[0] : 0; | ||
16 | // Set unread msgs badge | ||
17 | Ferdi.setBadge(Number.parseInt(unread, 10)); | ||
18 | }; | ||
19 | |||
20 | const loopFunc = () => { | ||
21 | getMessages(); | ||
22 | }; | ||
23 | |||
24 | Ferdi.loop(loopFunc); | ||
25 | }; | ||