Something went wrong. Try again.
mirror your GitHub repos to tangled.org automatically synchub.to
mirror sync tangled github git
Something went wrong. Try again.
850 B · 21 lines
TypeScript
12345678910111213141516171819202122import { installationAccountLogin } from '#server/utils/github-app'
export interface ConnectInfo { installationId: number login: string | null}
/** * Public lookup of an installation's account login for the connect page. * Returns only the login, which the App can already read; it is not a secret * and reveals nothing the install screen didn't. The actual ownership gate is * the GitHub user-OAuth step, not this endpoint. */export default defineEventHandler(async (event): Promise<ConnectInfo> => { const raw = getQuery(event).installationId if (typeof raw !== 'string' || !/^\d+$/.test(raw)) { throw createError({ statusCode: 400, statusMessage: 'installationId is required and must be numeric' }) } const installationId = Number(raw) return { installationId, login: await installationAccountLogin(installationId) }})