GHE uses dotcom stealth host

For now at least

Co-Authored-By: Sergio Padrino <1083228+sergiou87@users.noreply.github.com>
This commit is contained in:
Markus Olsson 2023-12-13 15:51:59 +01:00
parent 33d197f822
commit 9035052e68

View file

@ -1,5 +1,3 @@
import * as URL from 'url'
import { IAPIEmail, getDotComAPIEndpoint } from './api'
import { Account } from '../models/account'
@ -54,9 +52,10 @@ function isEmailPublic(email: IAPIEmail): boolean {
* endpoint host.
*/
function getStealthEmailHostForEndpoint(endpoint: string) {
return getDotComAPIEndpoint() !== endpoint
? `users.noreply.${URL.parse(endpoint).hostname}`
: 'users.noreply.github.com'
const { hostname } = new URL(endpoint)
return endpoint === getDotComAPIEndpoint() || endpoint.endsWith(`.ghe.com`)
? 'users.noreply.github.com'
: `users.noreply.${hostname}`
}
/**