caching fix

This commit is contained in:
2026-07-12 19:33:08 -04:00
parent a0039e711f
commit 6c5050c4ce
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -465,6 +465,9 @@ function AdminPage({ user }: Props) {
<button onClick={() => setTab("assets")} style={{ flex: 1, padding: "10px 0", fontSize: 16, fontWeight: 700, background: tab === "assets" ? "#424e88" : "none", color: tab === "assets" ? "#fff" : textClr, border: `1px solid ${borderClr}`, cursor: "pointer", transition: "background 0.2s ease" }}>Assets ({assets.length})</button>
<button onClick={() => setTab("updates")} style={{ flex: 1, padding: "10px 0", fontSize: 16, fontWeight: 700, background: tab === "updates" ? "#424e88" : "none", color: tab === "updates" ? "#fff" : textClr, border: `1px solid ${borderClr}`, cursor: "pointer", transition: "background 0.2s ease" }}>Updates ({siteUpdates.length})</button>
</div>
<div style={{ marginBottom: 20 }}>
<button onClick={async () => { await fetch(ua("/api/admin/rebuild-cache"), { method: "POST" }); }} style={{ padding: "8px 16px", fontSize: 13, fontWeight: 700, background: "#424e88", color: "#fff", border: "none", cursor: "pointer" }}>Rebuild Cache</button>
</div>
{tab === "ratings" ? (
<>
+6
View File
@@ -571,6 +571,12 @@ app.post("/api/reports", async (req, res) => {
res.json(report);
});
app.post("/api/admin/rebuild-cache", async (req, res) => {
if (!(await requireAdmin(req, res))) return;
await rebuildCache();
res.json({ ok: true });
});
app.get("/api/admin/reports", async (req, res) => {
if (!(await requireAdmin(req, res))) return;
const reports = await prisma.report.findMany({