From 7337c3c428a67005944286d817826e15fe51fbf1 Mon Sep 17 00:00:00 2001 From: Celedhrim Date: Wed, 16 Mar 2022 22:41:05 +0100 Subject: Add Tiny Tiny RSS recipe (#845) --- recipes/tt-rss/README.md | 3 +++ recipes/tt-rss/icon.svg | 27 +++++++++++++++++++++++++++ recipes/tt-rss/index.js | 3 +++ recipes/tt-rss/package.json | 9 +++++++++ recipes/tt-rss/webview.js | 21 +++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 recipes/tt-rss/README.md create mode 100644 recipes/tt-rss/icon.svg create mode 100644 recipes/tt-rss/index.js create mode 100644 recipes/tt-rss/package.json create mode 100644 recipes/tt-rss/webview.js diff --git a/recipes/tt-rss/README.md b/recipes/tt-rss/README.md new file mode 100644 index 0000000..a6620e5 --- /dev/null +++ b/recipes/tt-rss/README.md @@ -0,0 +1,3 @@ +# Tiny Tiny RSS for Ferdi + +Support for [Tiny Tiny RSS](https://tt-rss.org/) diff --git a/recipes/tt-rss/icon.svg b/recipes/tt-rss/icon.svg new file mode 100644 index 0000000..e79dd54 --- /dev/null +++ b/recipes/tt-rss/icon.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipes/tt-rss/index.js b/recipes/tt-rss/index.js new file mode 100644 index 0000000..cd5b37c --- /dev/null +++ b/recipes/tt-rss/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Ferdi => Ferdi; diff --git a/recipes/tt-rss/package.json b/recipes/tt-rss/package.json new file mode 100644 index 0000000..bcfa970 --- /dev/null +++ b/recipes/tt-rss/package.json @@ -0,0 +1,9 @@ +{ + "id": "tt-rss", + "name": "Tiny Tiny RSS", + "version": "1.0.0", + "license": "MIT", + "config": { + "hasCustomUrl": true + } +} diff --git a/recipes/tt-rss/webview.js b/recipes/tt-rss/webview.js new file mode 100644 index 0000000..1bb700a --- /dev/null +++ b/recipes/tt-rss/webview.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = Ferdi => { + const getMessages = function getMessages() { + // Initialize empty vars + var unread = 0; + var match = []; + // Extract the number from the title + match = document.title.match(/^\((\d+)\) Tiny Tiny RSS$/); + // Some logic to handle the match groups + unread = match != null && match.length > 0 ? match[1] : 0; + // Set unread msgs badge + Ferdi.setBadge(Number.parseInt(unread, 10)); + }; + + const loopFunc = () => { + getMessages(); + }; + + Ferdi.loop(loopFunc); +}; -- cgit v1.2.3-54-g00ecf