(hostname: Hostname)
| 183 | * @returns The base URL to use for OAuth API requests. |
| 184 | */ |
| 185 | export 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. |
no test coverage detected