From 2f741dd468082ddc01834912dd0cc88fb6a15d3d Mon Sep 17 00:00:00 2001 From: Antoine Aumjaud Date: Fri, 28 Feb 2020 21:10:01 +0100 Subject: Add GitHub Entreprise --- uncompressed/github_entreprise/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 uncompressed/github_entreprise/index.js (limited to 'uncompressed/github_entreprise/index.js') diff --git a/uncompressed/github_entreprise/index.js b/uncompressed/github_entreprise/index.js new file mode 100644 index 0000000..76901cb --- /dev/null +++ b/uncompressed/github_entreprise/index.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = Franz => class GitHubEntreprise extends Franz { + 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; + } +}; \ No newline at end of file -- cgit v1.2.3-70-g09d2