From 93738624ed1dd4473fb4e6cdfb859e6250437104 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sun, 12 Sep 2021 15:58:12 +0530 Subject: Merged 'github_enterprise' recipe into 'github' with the extra bits. --- recipes/github/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'recipes/github/index.js') 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 @@ -module.exports = Ferdi => Ferdi; +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; + } +}; -- cgit v1.2.3-70-g09d2