SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
878 B · 20 lines typescript
Raw Blame History
1import { withUser, json, ApiError } from "@/lib/api";2import { listShares, revokeShareById } from "@/lib/conversations/service";3import { LIMITS } from "@/lib/rate-limit";45export const dynamic = "force-dynamic";67/** GET /api/shares → `{ shares: ShareLinkItem[] }` — every active public link of the user (Settings → Data). */8export const GET = withUser(async ({ user }) => json({ shares: await listShares(user.id) }), { limit: { ...LIMITS.search, key: "shares-list" } });910/** DELETE /api/shares?id=<shareId> → `{ ok: true }` — revoke one link. */11export const DELETE = withUser(12  async ({ req, user }) => {13    const id = new URL(req.url).searchParams.get("id")?.trim();14    if (!id) throw new ApiError(400, "Missing share id");15    await revokeShareById(user.id, id);16    return json({ ok: true });17  },18  { limit: { ...LIMITS.share, key: "shares-revoke" } },19);20