A very simple single-file PDS home page to list active users

add README

finxol.io cbf663b2 d12e9171

verified
+65 -28
+38
README.md
··· 1 + # PDS Home 2 + 3 + Very simple single-file PDS home page. 4 + 5 + ## Why? 6 + 7 + By default, the PDS home page isn't very nice, especially on mobile. 8 + It's fine as a default, but we can do better. 9 + 10 + The approach here is to make it into a single glorious HTML file to avoid overriding too many routes on the PDS, 11 + and make deployment as simple as possible. 12 + 13 + There's still a build step involved because there's some dependencies involved (`atcute`), 14 + and working with types and CSS/JS in separate files is so much nicer. 15 + 16 + ## How to use 17 + 18 + Before you deploy, you may want to fork this repository to customise the welcome message and/or PDS owner listed. 19 + 20 + - Install dependencies with `pnpm i` 21 + 22 + - Build the file with `pnpm run build` 23 + 24 + - Upload the `dist/index.html` file to static hosting. 25 + 26 + The most straighforward solution is to host it on the same server as your PDS. 27 + 28 + You can simply add this directive to your Caddyfile: 29 + 30 + ```Caddyfile 31 + @home path / 32 + handle @home { 33 + root /<the directory where the file is> 34 + file_server 35 + } 36 + ``` 37 + 38 + You will now see a pretty little home page for your PDS!
+27 -26
package.json
··· 1 1 { 2 - "name": "pds-home", 3 - "private": true, 4 - "version": "0.0.0", 5 - "type": "module", 6 - "scripts": { 7 - "dev": "vite", 8 - "build": "tsc && vite build", 9 - "preview": "vite preview" 10 - }, 11 - "devDependencies": { 12 - "typescript": "~5.9.3", 13 - "vite": "npm:rolldown-vite@7.1.14", 14 - "vite-plugin-singlefile": "^2.3.0" 15 - }, 16 - "pnpm": { 17 - "overrides": { 18 - "vite": "npm:rolldown-vite@7.1.14" 2 + "name": "pds-home", 3 + "private": true, 4 + "version": "0.0.0", 5 + "type": "module", 6 + "scripts": { 7 + "dev": "vite", 8 + "build": "tsc && vite build", 9 + "preview": "vite preview", 10 + "deploy": "pnpm build && scp -r dist/index.html akhaten:/srv/http/pds-home.html" 11 + }, 12 + "devDependencies": { 13 + "typescript": "~5.9.3", 14 + "vite": "npm:rolldown-vite@7.1.14", 15 + "vite-plugin-singlefile": "^2.3.0" 16 + }, 17 + "pnpm": { 18 + "overrides": { 19 + "vite": "npm:rolldown-vite@7.1.14" 20 + } 21 + }, 22 + "dependencies": { 23 + "@atcute/atproto": "^3.1.4", 24 + "@atcute/bluesky": "^3.2.3", 25 + "@atcute/client": "^4.0.3", 26 + "@atcute/identity": "^1.1.0", 27 + "@atcute/identity-resolver": "^1.1.3", 28 + "@atcute/lexicons": "^1.1.1" 19 29 } 20 - }, 21 - "dependencies": { 22 - "@atcute/atproto": "^3.1.4", 23 - "@atcute/bluesky": "^3.2.3", 24 - "@atcute/client": "^4.0.3", 25 - "@atcute/identity": "^1.1.0", 26 - "@atcute/identity-resolver": "^1.1.3", 27 - "@atcute/lexicons": "^1.1.1" 28 - } 29 30 }
-2
src/atproto.ts
··· 66 66 return 67 67 } 68 68 69 - console.log(doc.value); 70 - 71 69 return doc.value.alsoKnownAs; 72 70 } 73 71