MCPcopy Create free account
hub / github.com/gitify-app/gitify / getGitHubAuthBaseUrl

Function getGitHubAuthBaseUrl

src/renderer/utils/auth/utils.ts:185–204  ·  view source on GitHub ↗
(hostname: Hostname)

Source from the content-addressed store, hash-verified

183 * @returns The base URL to use for OAuth API requests.
184 */
185export function getGitHubAuthBaseUrl(hostname: Hostname): URL {
186 const platform = getPlatformFromHostname(hostname);
187 const url = new URL(APPLICATION.GITHUB_BASE_URL);
188
189 switch (platform) {
190 case 'GitHub Enterprise Server':
191 url.hostname = hostname;
192 url.pathname = '/api/v3/';
193 break;
194 case 'GitHub Enterprise Cloud with Data Residency':
195 url.hostname = `api.${hostname}`;
196 url.pathname = '/';
197 break;
198 default:
199 url.pathname = '/';
200 break;
201 }
202
203 return url;
204}
205
206/**
207 * Return the GitHub developer settings URL appropriate for the account's auth method.

Callers 4

utils.test.tsFile · 0.90
startGitHubDeviceFlowFunction · 0.90
pollGitHubDeviceFlowFunction · 0.90

Calls 1

getPlatformFromHostnameFunction · 0.90

Tested by

no test coverage detected