blob: 14168a35d9f4ca02d8a3957ef0137558b8d03196 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module.exports = Ferdium =>
class Misskey extends Ferdium {
constructor(...args) {
let _temp;
// eslint-disable-next-line constructor-super
return (_temp = super(...args)), (this.events = {}), _temp;
}
async validateUrl(url) {
try {
const res = await window.fetch(`${url}/api/stats`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const data = await res.json();
// check any field in API response
return [
'originalUsersCount',
'usersCount',
'notesCount',
'originalNotesCount',
].reduce(r => r && Object.hasOwnProperty.call(data, 'uri'), true);
} catch (error) {
console.error(error);
}
return false;
}
};
|