From 2e84c5a91e7a1d2a7dbfb881f5ffabb700f77f20 Mon Sep 17 00:00:00 2001 From: Arghya Ghosh <71373838+uiuxarghya@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:14:58 +0530 Subject: [PATCH 1/2] feat(site): Implement releases API to fetch GitHub releases with cache control --- src/app/api/releases/route.ts | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/app/api/releases/route.ts diff --git a/src/app/api/releases/route.ts b/src/app/api/releases/route.ts new file mode 100644 index 00000000..530f6101 --- /dev/null +++ b/src/app/api/releases/route.ts @@ -0,0 +1,43 @@ +import { fetchGitHubReleases } from "@/lib/github"; +import { NextResponse, NextRequest } from "next/server"; + +export const revalidate = 86400; // Revalidate every 24 hours + +export async function GET(request: NextRequest) { + try { + // Check if this is a cache-busting request from the client refresh button + const url = new URL(request.url); + const bypassCache = + url.searchParams.has("t") || + request.headers.get("cache-control") === "no-cache" || + request.headers.get("pragma") === "no-cache"; + + const releases = await fetchGitHubReleases(); + + // If cache bypass requested, return with no-cache headers + if (bypassCache) { + return NextResponse.json(releases, { + headers: { + "Cache-Control": "no-cache, no-store, must-revalidate", + Pragma: "no-cache", + Expires: "0", + "Content-Type": "application/json", + }, + }); + } + + // Otherwise use standard cache headers (24 hours) + return NextResponse.json(releases, { + headers: { + "Cache-Control": "public, max-age=86400, s-maxage=86400", // 24 hours + "Content-Type": "application/json", + }, + }); + } catch (error) { + console.error("Error in releases API:", error); + return NextResponse.json( + { error: "Failed to fetch releases" }, + { status: 500 }, + ); + } +} From 625bd6f49722171f9617362b84e15af1e0eca0a5 Mon Sep 17 00:00:00 2001 From: Arghya Ghosh Date: Fri, 24 Oct 2025 16:19:23 +0530 Subject: [PATCH 2/2] fix(site): Update license page link in footer --- src/components/footer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/footer.tsx b/src/components/footer.tsx index 68ddad2b..ef46ed22 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -30,7 +30,7 @@ const footerNav = { Legal: [ { title: "Privacy Policy", href: "/legal/privacy" }, { title: "Terms of Service", href: "/legal/terms" }, - { title: "License", href: "/license" }, + { title: "License", href: "/legal/license" }, { title: "Security", href: "/security" }, ], };