grain.social is a photo sharing platform built on atproto.

add max file limit of 20mb

Changed files
+15 -7
src
+1 -1
deno.json
··· 3 3 "$lexicon/": "./__generated__/", 4 4 "@atproto/syntax": "npm:@atproto/syntax@^0.4.0", 5 5 "@bigmoves/bff": "jsr:@bigmoves/bff@0.3.0-beta.23", 6 - "@bigmoves/bff-photo-processor": "jsr:@bigmoves/bff-photo-processor@0.1.0", 6 + "@bigmoves/bff-photo-processor": "jsr:@bigmoves/bff-photo-processor@0.1.1", 7 7 "@gfx/canvas": "jsr:@gfx/canvas@^0.5.8", 8 8 "@std/path": "jsr:@std/path@^1.0.9", 9 9 "@tailwindcss/cli": "npm:@tailwindcss/cli@^4.1.4",
+7 -6
deno.lock
··· 2 2 "version": "5", 3 3 "specifiers": { 4 4 "jsr:@bigmoves/atproto-oauth-client@0.2": "0.2.0", 5 - "jsr:@bigmoves/bff-photo-processor@0.1.0": "0.1.0", 5 + "jsr:@bigmoves/bff-photo-processor@0.1.1": "0.1.1", 6 6 "jsr:@bigmoves/bff@0.3.0-beta.23": "0.3.0-beta.23", 7 7 "jsr:@deno/gfm@0.10": "0.10.0", 8 8 "jsr:@denosaurs/emoji@0.3": "0.3.1", ··· 122 122 "npm:tailwind-merge" 123 123 ] 124 124 }, 125 - "@bigmoves/bff-photo-processor@0.1.0": { 126 - "integrity": "43ff00033fb1c6dcf8f94b6c653788ba24cffd14509a6d0397d3209fbb93e111", 125 + "@bigmoves/bff-photo-processor@0.1.1": { 126 + "integrity": "3f9b4ad0f1b028ca69ef4c34b88984c0ad79b651d99ecfcf7ab98a5091bc776b", 127 127 "dependencies": [ 128 128 "jsr:@std/cache", 129 129 "jsr:@std/path@^1.0.8", 130 - "npm:@atproto/api@~0.14.19", 131 - "npm:@atproto/lexicon@~0.4.10" 130 + "npm:@atproto/api@~0.15.7", 131 + "npm:@atproto/lexicon@~0.4.11", 132 + "npm:sharp" 132 133 ] 133 134 }, 134 135 "@deno/gfm@0.10.0": { ··· 2064 2065 }, 2065 2066 "workspace": { 2066 2067 "dependencies": [ 2067 - "jsr:@bigmoves/bff-photo-processor@0.1.0", 2068 + "jsr:@bigmoves/bff-photo-processor@0.1.1", 2068 2069 "jsr:@bigmoves/bff@0.3.0-beta.23", 2069 2070 "jsr:@gfx/canvas@~0.5.8", 2070 2071 "jsr:@std/path@^1.0.9",
+7
src/uploads.tsx
··· 25 25 if (!file) { 26 26 return new Response("No file", { status: 400 }); 27 27 } 28 + // Check if file size exceeds 20MB limit 29 + const maxSizeBytes = 20 * 1000 * 1000; // 20MB in bytes 30 + if (file.size > maxSizeBytes) { 31 + return new Response("File too large. Maximum size is 20MB", { 32 + status: 400, 33 + }); 34 + } 28 35 const dataUrl = await compressImageForPreview(file); 29 36 if (!ctx.agent) { 30 37 return new Response("No agent", { status: 400 });