diff options
Diffstat (limited to 'recipes/pleroma')
-rw-r--r-- | recipes/pleroma/README.md | 2 | ||||
-rw-r--r-- | recipes/pleroma/icon.png | bin | 0 -> 4548 bytes | |||
-rw-r--r-- | recipes/pleroma/icon.svg | 1 | ||||
-rw-r--r-- | recipes/pleroma/index.js | 19 | ||||
-rw-r--r-- | recipes/pleroma/package.json | 14 | ||||
-rw-r--r-- | recipes/pleroma/webview.js | 14 |
6 files changed, 50 insertions, 0 deletions
diff --git a/recipes/pleroma/README.md b/recipes/pleroma/README.md new file mode 100644 index 0000000..0fac78e --- /dev/null +++ b/recipes/pleroma/README.md | |||
@@ -0,0 +1,2 @@ | |||
1 | # Pleroma for Ferdi | ||
2 | This is a Ferdi recipe for Pleroma | ||
diff --git a/recipes/pleroma/icon.png b/recipes/pleroma/icon.png new file mode 100644 index 0000000..90681bf --- /dev/null +++ b/recipes/pleroma/icon.png | |||
Binary files differ | |||
diff --git a/recipes/pleroma/icon.svg b/recipes/pleroma/icon.svg new file mode 100644 index 0000000..46afe81 --- /dev/null +++ b/recipes/pleroma/icon.svg | |||
@@ -0,0 +1 @@ | |||
<svg width="334" height="334" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-89.5 -89)"><path d="M235 89v334h-83V115l26-26z" style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.175879"/><circle r="26" cx="178" cy="115" style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.175879"/><circle r="26" cx="335" cy="230" style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.175879"/><path d="M277 256V89h84v141l-26 26z" style="fill:#fba457;fill-opacity:1;stroke:#000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle r="26" cx="335" cy="397" style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.175879"/><path d="M277 423v-83h84v57l-26 26z" style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g></svg> \ No newline at end of file | |||
diff --git a/recipes/pleroma/index.js b/recipes/pleroma/index.js new file mode 100644 index 0000000..c6cf368 --- /dev/null +++ b/recipes/pleroma/index.js | |||
@@ -0,0 +1,19 @@ | |||
1 | module.exports = Ferdi => class Pleroma extends Ferdi { | ||
2 | async validateUrl(url) { | ||
3 | try { | ||
4 | const resp = await window.fetch(`${url}/api/v1/instance`, { | ||
5 | Accept: 'application/json', | ||
6 | }); | ||
7 | const data = await resp.json(); | ||
8 | const version = data.version; | ||
9 | return typeof (version) === 'string' && version.indexOf('Pleroma') >= 0; | ||
10 | } catch (err) { | ||
11 | console.log('Pleroma server validation error', err); | ||
12 | } | ||
13 | return false; | ||
14 | } | ||
15 | |||
16 | buildUrl(url) { | ||
17 | return `${url}/main/friends`; | ||
18 | } | ||
19 | }; | ||
diff --git a/recipes/pleroma/package.json b/recipes/pleroma/package.json new file mode 100644 index 0000000..31fa06f --- /dev/null +++ b/recipes/pleroma/package.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "id": "pleroma", | ||
3 | "name": "Pleroma", | ||
4 | "version": "1.0.0", | ||
5 | "description": "Pleroma — a lightweight fediverse server", | ||
6 | "main": "index.js", | ||
7 | "author": "Ferdi <hello@getferdi.com>", | ||
8 | "license": "MIT", | ||
9 | "config": { | ||
10 | "serviceURL": "", | ||
11 | "serviceName": "Pleroma", | ||
12 | "hasCustomUrl": true | ||
13 | } | ||
14 | } | ||
diff --git a/recipes/pleroma/webview.js b/recipes/pleroma/webview.js new file mode 100644 index 0000000..d08216d --- /dev/null +++ b/recipes/pleroma/webview.js | |||
@@ -0,0 +1,14 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | const titleRegex = /^\((\d+)\)/; | ||
3 | |||
4 | const getMessages = () => { | ||
5 | let directCount = 0; | ||
6 | const matchArr = document.title.match(titleRegex); | ||
7 | if (matchArr) { | ||
8 | directCount = parseInt(matchArr[1], 10); | ||
9 | } | ||
10 | Ferdi.setBadge(directCount, 0); | ||
11 | }; | ||
12 | |||
13 | Ferdi.loop(getMessages); | ||
14 | }; | ||