feat: adapt pullfrog for gitea + ollama

This commit is contained in:
2026-05-31 01:01:00 -05:00
parent 36ac64a5b6
commit 2aca1a3aa3
183 changed files with 1419 additions and 28292 deletions
+4 -13
View File
@@ -44,18 +44,9 @@ export type GitAuthServer = {
[Symbol.asyncDispose]: () => Promise<void>;
};
function revokeGitHubToken(token: string): void {
fetch("https://api.github.com/installation/token", {
method: "DELETE",
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github+json",
"User-Agent": "pullfrog",
},
}).then(
(r) => log.info(`token revocation response: ${r.status}`),
() => log.warning("token revocation request failed")
);
function revokeToken(_token: string): void {
// For Gitea personal access tokens / bot tokens, revocation is not needed.
log.debug("token revocation skipped (Gitea tokens don't require explicit revocation)");
}
export async function startGitAuthServer(tmpdir: string): Promise<GitAuthServer> {
@@ -91,7 +82,7 @@ export async function startGitAuthServer(tmpdir: string): Promise<GitAuthServer>
// request for a revoked code — the $git() window has closed, so this
// is an agent replaying the code. revoke the token as a precaution.
log.info("askpass code used after revoke — revoking token");
revokeGitHubToken(entry.token);
revokeToken(entry.token);
if (entry.timeout) clearTimeout(entry.timeout);
codes.delete(code);
res.writeHead(409, { "Content-Type": "text/plain" });