mirror of
https://gitbruv.vercel.app/api/git/bruv/gitbruv.git
synced 2025-12-20 23:24:09 +01:00
caching
This commit is contained in:
parent
d589bad9d5
commit
bdcdfc7450
2 changed files with 48 additions and 34 deletions
|
|
@ -6,6 +6,8 @@ import git from "isomorphic-git";
|
|||
import { createR2Fs, getRepoPrefix } from "@/lib/r2-fs";
|
||||
import { scryptAsync } from "@noble/hashes/scrypt.js";
|
||||
import { hexToBytes } from "@noble/hashes/utils.js";
|
||||
import { revalidateTag } from "next/cache";
|
||||
import { getRepoCacheTag } from "@/actions/repositories";
|
||||
|
||||
function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean {
|
||||
if (a.length !== b.length) return false;
|
||||
|
|
@ -437,6 +439,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
|
|||
response = await handleUploadPack(fs, "/", body);
|
||||
} else {
|
||||
response = await handleReceivePack(fs, "/", body);
|
||||
revalidateTag(getRepoCacheTag(username, repoName), { expire: 0 });
|
||||
}
|
||||
|
||||
return new NextResponse(new Uint8Array(response), {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue