diff options
Diffstat (limited to 'recipes/pleroma/index.js')
-rw-r--r-- | recipes/pleroma/index.js | 19 |
1 files changed, 19 insertions, 0 deletions
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 | }; | ||