[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 - [x] Backfill network 15 - [x] Store did+route -> blob & mime type in database 16 - [x] Store blobs for CDN (max ~0.25gb per user) 17 - - [ ] Moderate illegal content or hope that people are niceys 18 - [ ] Finish CLI tool 19 - [ ] Sign in via app password 20 - - [ ] Sign in via oAuth (for interactive) 21 - [ ] Clear old site 22 - [ ] Upload new site 23 - [ ] Fuse uploader
··· 14 - [x] Backfill network 15 - [x] Store did+route -> blob & mime type in database 16 - [x] Store blobs for CDN (max ~0.25gb per user) 17 + - [x] Moderate illegal content or hope that people are niceys 18 + (Hope that people are niceys) 19 - [ ] Finish CLI tool 20 - [ ] Sign in via app password 21 - [ ] Clear old site 22 - [ ] Upload new site 23 - [ ] Fuse uploader
+18 -11
server/src/backfill/blob.ts
··· 5 did: `did:${"plc" | "web"}:${string}`, 6 cid: string 7 ): Promise<Blob> { 8 const pds = await getPds(did); 9 if (!pds) throw "PDS not found"; 10 ··· 20 21 if (!ok) throw `${data.error}`; 22 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; 29 } 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 36 return data; 37 }
··· 5 did: `did:${"plc" | "web"}:${string}`, 6 cid: string 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 + 13 const pds = await getPds(did); 14 if (!pds) throw "PDS not found"; 15 ··· 25 26 if (!ok) throw `${data.error}`; 27 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); 41 } 42 43 return data; 44 }
+4 -1
server/src/routes/user.ts
··· 106 console.error(e); 107 return new Response(`${ascii} 108 109 - This page couldn't be resolved. Either the blob does not exist, or contained illegal content. 110 `); 111 } 112 }
··· 106 console.error(e); 107 return new Response(`${ascii} 108 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. 113 `); 114 } 115 }