diff options
Diffstat (limited to 'recipes/github')
-rw-r--r-- | recipes/github/index.js | 20 | ||||
-rw-r--r-- | recipes/github/package.json | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/recipes/github/index.js b/recipes/github/index.js index 23607bd..dfcd7d1 100644 --- a/recipes/github/index.js +++ b/recipes/github/index.js | |||
@@ -1 +1,19 @@ | |||
1 | module.exports = Ferdi => Ferdi; | 1 | module.exports = Ferdi => class GitHub extends Ferdi { |
2 | async validateUrl(url) { | ||
3 | try { | ||
4 | const resp = await window.fetch(`${url}/api/v3`, { | ||
5 | method: 'GET', | ||
6 | headers: { | ||
7 | 'Content-Type': 'application/json', | ||
8 | Accept: 'application/vnd.github.v3+json', | ||
9 | }, | ||
10 | }); | ||
11 | // doc: https://developer.github.com/enterprise/2.17/v3/#current-version | ||
12 | return resp.status.toString().startsWith('2'); | ||
13 | } catch (err) { | ||
14 | console.error(err); | ||
15 | } | ||
16 | |||
17 | return false; | ||
18 | } | ||
19 | }; | ||
diff --git a/recipes/github/package.json b/recipes/github/package.json index 2ed611e..573f743 100644 --- a/recipes/github/package.json +++ b/recipes/github/package.json | |||
@@ -1,10 +1,11 @@ | |||
1 | { | 1 | { |
2 | "id": "github", | 2 | "id": "github", |
3 | "name": "GitHub", | 3 | "name": "GitHub", |
4 | "version": "2.1.1", | 4 | "version": "2.2.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://github.com/notifications", | 7 | "serviceURL": "https://github.com/notifications", |
8 | "hasCustomUrl": true, | ||
8 | "hasIndirectMessages": true | 9 | "hasIndirectMessages": true |
9 | } | 10 | } |
10 | } | 11 | } |