diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-05 16:46:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 16:46:55 +0200 |
commit | 2484c63d77e05fff384cc08b6ea46a29a22a62ec (patch) | |
tree | 21b8b74f1788407a4cfb13052160398f13424ac6 /recipes/misskey/index.js | |
parent | Add check to ensure that generated file 'user.js' is not present in default p... (diff) | |
download | ferdium-recipes-2484c63d77e05fff384cc08b6ea46a29a22a62ec.tar.gz ferdium-recipes-2484c63d77e05fff384cc08b6ea46a29a22a62ec.tar.zst ferdium-recipes-2484c63d77e05fff384cc08b6ea46a29a22a62ec.zip |
chore: repo maintenance (#732)
Diffstat (limited to 'recipes/misskey/index.js')
-rw-r--r-- | recipes/misskey/index.js | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/recipes/misskey/index.js b/recipes/misskey/index.js index 3f51bf9..5805c37 100644 --- a/recipes/misskey/index.js +++ b/recipes/misskey/index.js | |||
@@ -1,28 +1,30 @@ | |||
1 | module.exports = Ferdi => class Misskey extends Ferdi { | 1 | module.exports = Ferdi => |
2 | constructor(...args) { | 2 | class Misskey extends Ferdi { |
3 | let _temp; | 3 | constructor(...args) { |
4 | return _temp = super(...args), this.events = { | 4 | let _temp; |
5 | }, _temp; | 5 | // eslint-disable-next-line constructor-super |
6 | } | 6 | return (_temp = super(...args)), (this.events = {}), _temp; |
7 | } | ||
7 | 8 | ||
8 | async validateUrl(url) { | 9 | async validateUrl(url) { |
9 | try { | 10 | try { |
10 | const res = await window.fetch(`${url}/api/stats`, { | 11 | const res = await window.fetch(`${url}/api/stats`, { |
11 | method: 'POST', | 12 | method: 'POST', |
12 | headers: { | 13 | headers: { |
13 | 'Content-Type': 'application/json', | 14 | 'Content-Type': 'application/json', |
14 | }, | 15 | }, |
15 | }); | 16 | }); |
16 | const data = await res.json(); | 17 | const data = await res.json(); |
17 | // check any field in API response | 18 | // check any field in API response |
18 | return [ | 19 | return [ |
19 | 'originalUsersCount', 'usersCount', 'notesCount', 'originalNotesCount' | 20 | 'originalUsersCount', |
20 | ].reduce((r, key) => ( | 21 | 'usersCount', |
21 | r && Object.hasOwnProperty.call(data, 'uri') | 22 | 'notesCount', |
22 | ), true); | 23 | 'originalNotesCount', |
23 | } catch (err) { | 24 | ].reduce(r => r && Object.hasOwnProperty.call(data, 'uri'), true); |
24 | console.error(err); | 25 | } catch (err) { |
26 | console.error(err); | ||
27 | } | ||
28 | return false; | ||
25 | } | 29 | } |
26 | return false; | 30 | }; |
27 | } | ||
28 | }; | ||