Start every Rule private, with a rotating link and files that follow its readers.

New Rules stay off lists until the person who holds the pen turns on a share link, or the team features one. Uploaded files are readable only by those readers, stripped of location metadata, and deleted with the Rule, draft, or account.
This commit is contained in:
adilallo committed 2026-11-09 19:54:04 -07:00
1 parent 642551064c
commit 5cbda35e32
50 files changed
+2429 -219

No files matched your search

+10
View File
@@ -11,6 +11,7 @@ import { getSessionUser } from "../../../lib/server/session";
import { apiRoute } from "../../../lib/server/apiRoute";
import { rateLimitKey } from "../../../lib/server/rateLimit";
import { saveCreateFlowUpload } from "../../../lib/server/uploads/saveCreateFlowUpload";
import { issueGuestUploadGrantCookie } from "../../../lib/server/uploads/uploadGrantCookie";
import { getUploadRootFromEnv } from "../../../lib/server/uploads/uploadRoot";
import {
CREATE_FLOW_UPLOAD_MAX_BYTES,
@@ -146,6 +147,7 @@ export const POST = apiRoute("uploads.post", async (request: NextRequest) => {
const saved = await saveCreateFlowUpload({
purpose: purposeRaw,
buffer: buf,
userId: user?.id ?? null,
});
if ("error" in saved) {
@@ -171,6 +173,14 @@ export const POST = apiRoute("uploads.post", async (request: NextRequest) => {
);
}
if (!user) {
try {
await issueGuestUploadGrantCookie(saved.id);
} catch {
// Cookie is best-effort; the file is already stored.
}
}
return NextResponse.json({
url: saved.urlPath,
id: saved.id,