blob: dfcd7d12af4f1177a08082324b3b897fd60b3c55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module.exports = Ferdi => class GitHub extends Ferdi {
async validateUrl(url) {
try {
const resp = await window.fetch(`${url}/api/v3`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.github.v3+json',
},
});
// doc: https://developer.github.com/enterprise/2.17/v3/#current-version
return resp.status.toString().startsWith('2');
} catch (err) {
console.error(err);
}
return false;
}
};
|