diff options
Diffstat (limited to 'recipes/pleroma/index.js')
-rw-r--r-- | recipes/pleroma/index.js | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/recipes/pleroma/index.js b/recipes/pleroma/index.js index 67a0e19..2050059 100644 --- a/recipes/pleroma/index.js +++ b/recipes/pleroma/index.js | |||
@@ -1,19 +1,21 @@ | |||
1 | module.exports = Ferdium => class Pleroma extends Ferdium { | 1 | module.exports = Ferdium => |
2 | async validateUrl(url) { | 2 | class Pleroma extends Ferdium { |
3 | try { | 3 | async validateUrl(url) { |
4 | const resp = await window.fetch(`${url}/api/v1/instance`, { | 4 | try { |
5 | Accept: 'application/json', | 5 | const resp = await window.fetch(`${url}/api/v1/instance`, { |
6 | }); | 6 | Accept: 'application/json', |
7 | const data = await resp.json(); | 7 | }); |
8 | const version = data.version; | 8 | const data = await resp.json(); |
9 | return typeof (version) === 'string' && version.includes('Pleroma'); | 9 | const version = data.version; |
10 | } catch (error) { | 10 | return typeof version === 'string' && version.includes('Pleroma'); |
11 | console.log('Pleroma server validation error', error); | 11 | } catch (error) { |
12 | // eslint-disable-next-line no-console | ||
13 | console.log('Pleroma server validation error', error); | ||
14 | } | ||
15 | return false; | ||
12 | } | 16 | } |
13 | return false; | ||
14 | } | ||
15 | 17 | ||
16 | buildUrl(url) { | 18 | buildUrl(url) { |
17 | return `${url}/main/friends`; | 19 | return `${url}/main/friends`; |
18 | } | 20 | } |
19 | }; | 21 | }; |