[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

server: hope people be niceys

it works for everyone on atproto except bluesky it should be Fine here

i hope

please be niceys

vielle.dev b6e105f8 72daba06

verified
Changed files
+24 -14
server
src
backfill
routes
+2 -2
README.md
··· 14 14 - [x] Backfill network 15 15 - [x] Store did+route -> blob & mime type in database 16 16 - [x] Store blobs for CDN (max ~0.25gb per user) 17 - - [ ] Moderate illegal content or hope that people are niceys 17 + - [x] Moderate illegal content or hope that people are niceys 18 + (Hope that people are niceys) 18 19 - [ ] Finish CLI tool 19 20 - [ ] Sign in via app password 20 - - [ ] Sign in via oAuth (for interactive) 21 21 - [ ] Clear old site 22 22 - [ ] Upload new site 23 23 - [ ] Fuse uploader
+18 -11
server/src/backfill/blob.ts
··· 5 5 did: `did:${"plc" | "web"}:${string}`, 6 6 cid: string 7 7 ): Promise<Blob> { 8 + // if the user has been manually taken down (cache dir deleted and replaced with empty file) 9 + // this errors out for quick exit 10 + // saving the round trip to resolve the pds and blob. 11 + await Deno.mkdir(`./blobs/${did}`, { recursive: true }); 12 + 8 13 const pds = await getPds(did); 9 14 if (!pds) throw "PDS not found"; 10 15 ··· 20 25 21 26 if (!ok) throw `${data.error}`; 22 27 23 - // check for CSAM etc here 24 - 25 - await Deno.mkdir(`./blobs/${did}`, { recursive: true }); 26 - let size = 0; 27 - for await (const file of Deno.readDir(`./blobs/${did}`)) { 28 - size += (await Deno.stat(`./blobs/${did}/${file.name}`)).size; 28 + // if the file size cant be calculated or the file cant be written, still return the blob 29 + try { 30 + let size = 0; 31 + for await (const file of Deno.readDir(`./blobs/${did}`)) { 32 + size += (await Deno.stat(`./blobs/${did}/${file.name}`)).size; 33 + } 34 + // only write if total stays below max site size 35 + if (size + data.size <= MAX_SITE_SIZE) 36 + await Deno.writeFile(`./blobs/${did}/${cid}`, await data.bytes(), { 37 + createNew: true, 38 + }); 39 + } catch (e) { 40 + console.warn(e); 29 41 } 30 - // only write if total stays below max site size 31 - if (size + data.size <= MAX_SITE_SIZE) 32 - await Deno.writeFile(`./blobs/${did}/${cid}`, await data.bytes(), { 33 - createNew: true, 34 - }); 35 42 36 43 return data; 37 44 }
+4 -1
server/src/routes/user.ts
··· 106 106 console.error(e); 107 107 return new Response(`${ascii} 108 108 109 - This page couldn't be resolved. Either the blob does not exist, or contained illegal content. 109 + This page could not be resolved. Either: 110 + - The user has no PDS 111 + - The blob does not exist 112 + - The user has been manually hidden for uploading illegal content. 110 113 `); 111 114 } 112 115 }