* Add GitHub OAuth authentication routes * Add GitHub API endpoints for repos and user data * Add session and crypto utilities * Add database schema and client setup * Add database migrations * Add GitHub utility functions and client * Add authentication components and hooks * Add repo info to chat context * Add GitHub token to sandbox API * Pass GitHub token to chat sandbox * Integrate repo selection and display in chat * Add dependencies for auth and database * Add branch selector API endpoint * Create branch selector component * Add UI component library base components * Add cmdk and popover dependencies * Replace input field with branch selector component * update repo selector to be combo box * fix scroll gutter bg * update branch selector component width * remove storage and update todos * fix cc comments * add caching * cc fixes
20 lines
379 B
TypeScript
20 lines
379 B
TypeScript
export function createAuthenticatedRepoUrl(
|
|
repoUrl: string,
|
|
githubToken?: string | null,
|
|
): string {
|
|
if (!githubToken) {
|
|
return repoUrl;
|
|
}
|
|
|
|
try {
|
|
const url = new URL(repoUrl);
|
|
if (url.hostname === "github.com") {
|
|
url.username = githubToken;
|
|
url.password = "x-oauth-basic";
|
|
}
|
|
return url.toString();
|
|
} catch {
|
|
return repoUrl;
|
|
}
|
|
}
|