blob: 13c94b7e6e4be866ad0a11f1e5090a754e6cd23a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module.exports = Ferdium => class Zulip extends Ferdium {
async validateUrl(url) {
const baseUrl = new window.URL(url);
const apiVersion = 'api/v1';
try {
const resp = await window.fetch(`${baseUrl.origin}/${apiVersion}/server_settings`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
const data = await resp.json();
return Object.hasOwnProperty.call(data, 'realm_uri');
} catch (error) {
console.error(error);
}
return false;
}
};
|