aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/misskey/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/misskey/index.js')
-rw-r--r--recipes/misskey/index.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/recipes/misskey/index.js b/recipes/misskey/index.js
new file mode 100644
index 0000000..3f51bf9
--- /dev/null
+++ b/recipes/misskey/index.js
@@ -0,0 +1,28 @@
1module.exports = Ferdi => class Misskey extends Ferdi {
2 constructor(...args) {
3 let _temp;
4 return _temp = super(...args), this.events = {
5 }, _temp;
6 }
7
8 async validateUrl(url) {
9 try {
10 const res = await window.fetch(`${url}/api/stats`, {
11 method: 'POST',
12 headers: {
13 'Content-Type': 'application/json',
14 },
15 });
16 const data = await res.json();
17 // check any field in API response
18 return [
19 'originalUsersCount', 'usersCount', 'notesCount', 'originalNotesCount'
20 ].reduce((r, key) => (
21 r && Object.hasOwnProperty.call(data, 'uri')
22 ), true);
23 } catch (err) {
24 console.error(err);
25 }
26 return false;
27 }
28};