diff options
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | deno.json | 17 | ||||
| -rw-r--r-- | dep/std.ts | 8 | ||||
| -rw-r--r-- | dep/x/dedent.ts | 6 | ||||
| -rw-r--r-- | dep/x/interceptor.ts | 7 | ||||
| -rw-r--r-- | ende.json | 22 | ||||
| -rw-r--r-- | feed.ts | 10 | ||||
| -rw-r--r-- | import_map.json | 6 | ||||
| -rw-r--r-- | justfile | 8 | ||||
| -rw-r--r-- | main.ts | 14 | ||||
| -rw-r--r-- | memos/WM-106.txt | 156 | ||||
| -rw-r--r-- | src/helper/get-binary-contents.ts | 2 | ||||
| -rw-r--r-- | src/helper/get-directory-contents.ts | 6 | ||||
| -rw-r--r-- | src/helper/get-documents.ts | 6 | ||||
| -rw-r--r-- | src/helper/get-file-contents.ts | 4 | ||||
| -rw-r--r-- | src/utility/constant.ts | 10 | ||||
| -rw-r--r-- | src/utility/markdown.ts | 2 | ||||
| -rw-r--r-- | version.txt | 2 |
18 files changed, 216 insertions, 82 deletions
@@ -7,7 +7,7 @@ ## Prerequisites -- [Deno](https://deno.land/#installation) +- [Ende](https://docs.ende.sh/runtime/#install-ende) - [Just](https://just.systems/man/en) ## Setup @@ -34,9 +34,9 @@ just version ## Production -- ensure Deno is installed on your server - - Deno also expects unzip or 7zip to be installed: `apt install unzip -y` -- make note of `which deno` to find the path of your install +- ensure Ende is installed on your server + - Ende also expects unzip or 7zip to be installed: `apt install unzip -y` +- make note of `which ende` to find the path of your install - `nano /etc/systemd/system/blog.service` ```service [Unit] @@ -45,8 +45,8 @@ just version Documentation=https://blog.webb.page [Service] - # your deno path - ExecStart=/root/.deno/bin/deno run --allow-env --allow-net --allow-read main.ts + # your ende path + ExecStart=/root/.ende/bin/ende run --allow-env --allow-net --allow-read main.ts Restart=on-failure Type=simple User=root diff --git a/deno.json b/deno.json deleted file mode 100644 index 4383d79..0000000 --- a/deno.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "noImplicitAny": false - }, - "exclude": ["dbschema/"], - "importMap": "import_map.json", - "lint": { - "rules": { - "exclude": ["no-explicit-any"] - } - }, - "lock": false, - "tasks": { - "dev": "deno run --allow-env --allow-net --allow-read --allow-run --allow-write main.ts development", - "start": "deno run --allow-env --allow-net --allow-read --allow-run --allow-write main.ts" - } -} diff --git a/dep/std.ts b/dep/std.ts deleted file mode 100644 index 97473b0..0000000 --- a/dep/std.ts +++ /dev/null @@ -1,8 +0,0 @@ - - - -/*** EXPORT ------------------------------------------- ***/ - -export * from "node:buffer"; -export * from "jsr:@std/fmt/colors"; -export * from "jsr:@std/path"; diff --git a/dep/x/dedent.ts b/dep/x/dedent.ts deleted file mode 100644 index d6415d8..0000000 --- a/dep/x/dedent.ts +++ /dev/null @@ -1,6 +0,0 @@ - - - -/*** EXPORT ------------------------------------------- ***/ - -export { default as dedent } from "npm:dedent@1.7.0"; diff --git a/dep/x/interceptor.ts b/dep/x/interceptor.ts deleted file mode 100644 index 8c46851..0000000 --- a/dep/x/interceptor.ts +++ /dev/null @@ -1,7 +0,0 @@ - - - -/*** EXPORT ------------------------------------------- ***/ - -export * from "jsr:@http/interceptor@0.26.0/cors"; -export * from "jsr:@http/interceptor@0.26.0/intercept"; diff --git a/ende.json b/ende.json new file mode 100644 index 0000000..402bfc2 --- /dev/null +++ b/ende.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "noImplicitAny": false + }, + "exclude": ["dbschema/"], + "imports": { + "@netopwibby/dedent": "jsr:@netopwibby/dedent@^0.1.0", + "@std/fmt": "jsr:@std/fmt@^1.0.10", + "@std/path": "jsr:@std/path@^1.1.6", + "src/": "./src/" + }, + "lint": { + "rules": { + "exclude": ["no-explicit-any"] + } + }, + "lock": false, + "tasks": { + "dev": "ende run --allow-env --allow-net --allow-read --allow-run --allow-write main.ts development", + "start": "ende run --allow-env --allow-net --allow-read --allow-run --allow-write main.ts" + } +} @@ -4,7 +4,7 @@ /*** IMPORT ------------------------------------------- ***/ import { ATOM, JSON, RSS } from "src/utility/feed/index.ts"; -import { join } from "dep/std.ts"; +import { join } from "@std/path"; /*** UTILITY ------------------------------------------ ***/ @@ -68,7 +68,7 @@ const rssFeed = new RSS({ createFeeds(); async function createFeeds() { - await Deno.mkdir(feedDirectory, { recursive: true }); + await Ende.mkdir(feedDirectory, { recursive: true }); const feedPosts: DocumentMeta[] = []; const filenames = await getDocuments(memoDirectory); @@ -118,9 +118,9 @@ async function createFeeds() { // atomFeed.updated = new Date(latestPostDate); // rssFeed.updated = new Date(latestPostDate); - Deno.writeTextFileSync(join(feedDirectory, "index.xml"), atomFeed.build()); - Deno.writeTextFileSync(join(feedDirectory, "index.json"), jsonFeed.build()); - Deno.writeTextFileSync(join(feedDirectory, "index.rss"), rssFeed.build()); + Ende.writeTextFileSync(join(feedDirectory, "index.xml"), atomFeed.build()); + Ende.writeTextFileSync(join(feedDirectory, "index.json"), jsonFeed.build()); + Ende.writeTextFileSync(join(feedDirectory, "index.rss"), rssFeed.build()); console.log("Feeds written"); } diff --git a/import_map.json b/import_map.json deleted file mode 100644 index 2f686e4..0000000 --- a/import_map.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "imports": { - "dep/": "./dep/", - "src/": "./src/" - } -} @@ -10,18 +10,18 @@ deploy: # run blog for local development dev: - deno run --allow-env --allow-net --allow-read main.ts development + ende run --allow-env --allow-net --allow-read main.ts development # generate feeds feed: - deno run --allow-env --allow-read --allow-write feed.ts + ende run --allow-env --allow-read --allow-write feed.ts # run blog for production start: - deno run --allow-env --allow-net --allow-read main.ts + ende run --allow-env --allow-net --allow-read main.ts # generate version.txt version: @echo "Updating version.txt with ChronVer" - @deno eval "const now = new Date(); const version = \`\${now.getFullYear()}.\${String(now.getMonth() + 1).padStart(2, '0')}.\${String(now.getDate()).padStart(2, '0')}\`; await Deno.writeTextFile('version.txt', version);" + @ende eval "const now = new Date(); const version = \`\${now.getFullYear()}.\${String(now.getMonth() + 1).padStart(2, '0')}.\${String(now.getDate()).padStart(2, '0')}\`; await Ende.writeTextFile('version.txt', version);" @echo "Version updated: $(cat version.txt)" @@ -4,13 +4,13 @@ /*** IMPORT ------------------------------------------- ***/ import { - join, green as shellGreen, magenta as shellMagenta, underline as shellUnderline -} from "dep/std.ts"; +} from "@std/fmt/colors"; -import { dedent } from "dep/x/dedent.ts"; +import { default as dedent } from "@netopwibby/dedent"; +import { join } from "@std/path"; /*** UTILITY ------------------------------------------ ***/ @@ -36,7 +36,7 @@ import populateRecents from "src/helper/populate-recents.ts"; const version = await getVersion(); -const server = Deno.serve({ +const server = Ende.serve({ handler: async(req) => { const { origin, pathname } = new URL(req.url); @@ -282,10 +282,10 @@ const server = Deno.serve({ ); }, port -}) as Deno.HttpServer; +}) as Ende.HttpServer; -Deno.addSignalListener("SIGINT", gracefulShutdown); -Deno.addSignalListener("SIGTERM", gracefulShutdown); +Ende.addSignalListener("SIGINT", gracefulShutdown); +Ende.addSignalListener("SIGTERM", gracefulShutdown); /*** HELPER ------------------------------------------- ***/ diff --git a/memos/WM-106.txt b/memos/WM-106.txt new file mode 100644 index 0000000..e6acd3c --- /dev/null +++ b/memos/WM-106.txt @@ -0,0 +1,156 @@ + + + + + + + +Document: WM-106 P. Webb +Category: Socail 2026-10-26 + + Self-hosting Mastodon and Bluesky + +Abstract + + Remember re/thinking Twitter handles for your various projects? It’s + 2026, I’m not doing all that for a shit platform. I will spend hours + wrangling social I control though. + +Body + + A few weeks ago[1] I decided to look into self-hosting a Mastodon + server for my various projects and Sang[2] told me about + GoToSocial[3], the software he uses to self-host his own. For Bluesky + I used the official PDS software[4]. + + ## GoToSocial + + I decided to put GoToSocial on the same server I’m hosting ~15 + other sites because it’s beefy enough. + + This is how you create accounts: + ``` + sudo -u gotosocial ./gotosocial --config-path ./config.yaml admin account create --username friend --email friend@example.org --password 'p@$$w0rd!with`odd*chars' + ``` + + After the FIRST account you make (this is your admin, right?), + you’ll have to promote it to `admin`: + ``` + sudo -u gotosocial ./gotosocial --config-path ./config.yaml admin account promote --username you + ``` + + I installed GoToSocial at `pr.inc.sh`. For some reason, the + directory isn’t showing all the accounts I created. Here are the + direct links to the accounts I made thus far: + + — [https://pr.inc.sh/@inc](https://pr.inc.sh/@inc) + — [https://pr.inc.sh/@dap](https://pr.inc.sh/@dap) + — [https://pr.inc.sh/@disc](https://pr.inc.sh/@disc) + — [https://pr.inc.sh/@ende](https://pr.inc.sh/@ende) + — [https://pr.inc.sh/@eol](https://pr.inc.sh/@eol) + + ## Bluesky + + Setting up a PDS on an existing server meant I had to make several + adjustments to their guide. I’m already using Caddy so my + `/pds/compose.yaml` didn’t need that. + ``` + services: + pds: + container_name: pds + env_file: + - /pds/pds.env + image: ghcr.io/bluesky-social/pds:0.4 + ports: + - "127.0.0.1:3000:3000" + restart: unless-stopped + volumes: + - type: bind + source: /pds + target: /pds + watchtower: + command: pds + container_name: watchtower + environment: + WATCHTOWER_CLEANUP: "true" + WATCHTOWER_SCHEDULE: "0 0 4 * * *" + image: ghcr.io/nicholas-fedor/watchtower:latest + restart: unless-stopped + volumes: + - type: bind + source: /var/run/docker.sock + target: /var/run/docker.sock + ``` + (I changed my ports because `3000` is such a common port, I didn’t + want interference with something else on my server.) + + This is how you create accounts: + ``` + docker exec pds goat pds admin account create --email friend+handle@example.org --handle handle.pds.domain --pds-host https://pds.domain --password 'p@$$w0rd!with`odd*chars' + ``` + When you run this, you’ll see a `DID` of the created account. The + cool thing about Bluesky is being able to use your domain as your + handle. Add a `TXT` record to your domain with: + ``` + did=did:plc:<output-of-above-command> + ``` + and your account will be ready to switch to the domain handle. + + My PDS is at `at.inc.sh`. Here’s the Bluesky variants of my + Mastodon accounts: + + — [https://bsky.app/profile/inc.sh](https://bsky.app/profile/inc.sh) + — [https://bsky.app/profile/dap.sh](https://bsky.app/profile/dap.sh) + — [https://bsky.app/profile/disc.sh](https://bsky.app/profile/disc.sh) + — [https://bsky.app/profile/ende.sh](https://bsky.app/profile/ende.sh) + — [https://bsky.app/profile/eol.sh](https://bsky.app/profile/eol.sh) + + I wasn’t able to get email verification working but the way to get + around that is to install `sqlite3` on your server. + ``` + apt install -y sqlite3 + ``` + List the `*.sqlite` files your PDS generates: + ``` + ls /pds/*.sqlite + ``` + You should see: + ``` + /pds/account.sqlite /pds/did_cache.sqlite /pds/sequencer.sqlite + ``` + Finally, initiate email verification in the Bluesky app and run + this in your terminal: + ``` + sudo sqlite3 /pds/account.sqlite "SELECT did, purpose, token FROM email_token;" + ``` + You’ll see something like: + ``` + did:plc:abcdefghijklmnopqrstuvwx|confirm_email|ABCDE-FGHIJ + ``` + That last bit (`ABCDE-FGHIJ`) is the code Bluesky is looking for. + In the UI, click the button that asks for a code and paste it in. + + This is your own PDS so if anything goes wrong, why do you need to + be emailed? You’d know if something fell over…probably. + + If your setup is like mine, do NOT run `pdsadmin update`. It + replaces `/pds/compose.yaml` with the stock file and sets up its + own Caddy situation. I should probably put this stuff in 1Password + anyway, just in case. + + This is great because now I won’t feel like I’m spamming people with + all my project updates and musings and ramblings. If you opt-in to + follow my various accounts, thanks! You can enjoy the deluge of words + at your leisure. + + There’s still the matter of Discord and uhh, meh? I use it but the + idea of creating a server for every project sounds insane. Maybe I + could just create the one and have a channel for each project? + Meh? 🕸️ + +References + + [1] <https://social.coop/@netopwibby/117425999797104004> + [2] <https://social.sang.design/@sang> + [3] <https://gotosocial.org> + [4] <https://github.com/bluesky-social/pds> diff --git a/src/helper/get-binary-contents.ts b/src/helper/get-binary-contents.ts index df41228..2d0179c 100644 --- a/src/helper/get-binary-contents.ts +++ b/src/helper/get-binary-contents.ts @@ -4,7 +4,7 @@ /*** EXPORT ------------------------------------------- ***/ export default async(filePath: string) => { - const fileExists = await Deno.readFile(filePath); + const fileExists = await Ende.readFile(filePath); if (!fileExists) return ""; diff --git a/src/helper/get-directory-contents.ts b/src/helper/get-directory-contents.ts index 80fb20c..d6029f8 100644 --- a/src/helper/get-directory-contents.ts +++ b/src/helper/get-directory-contents.ts @@ -7,9 +7,9 @@ export default async(directory: string): Promise<{ filename: string; }[]> => { const documentArray: { filename: string; }[] = []; try { - const documents: Deno.DirEntry[] = []; + const documents: Ende.DirEntry[] = []; - for await (const dirEntry of Deno.readDir(directory)) { + for await (const dirEntry of Ende.readDir(directory)) { if (dirEntry.isFile) documents.push(dirEntry); } @@ -28,7 +28,7 @@ export default async(directory: string): Promise<{ filename: string; }[]> => { } catch(error) { console.error(`Error reading directory contents: ${String(error)}`); } finally { - // deno-lint-ignore no-unsafe-finally + // ende-lint-ignore no-unsafe-finally return documentArray; } } diff --git a/src/helper/get-documents.ts b/src/helper/get-documents.ts index ca9ce93..1639d8d 100644 --- a/src/helper/get-documents.ts +++ b/src/helper/get-documents.ts @@ -7,9 +7,9 @@ export default async(directory: string) => { const posts: string[] = []; try { - const files: Deno.DirEntry[] = []; + const files: Ende.DirEntry[] = []; - for await (const dirEntry of Deno.readDir(directory)) { + for await (const dirEntry of Ende.readDir(directory)) { if (dirEntry.isFile) files.push(dirEntry); } @@ -29,7 +29,7 @@ export default async(directory: string) => { } catch(error) { console.error(`Error reading directory for posts: ${String(error)}`); } finally { - // deno-lint-ignore no-unsafe-finally + // ende-lint-ignore no-unsafe-finally return posts; } } diff --git a/src/helper/get-file-contents.ts b/src/helper/get-file-contents.ts index a159f95..74e94ab 100644 --- a/src/helper/get-file-contents.ts +++ b/src/helper/get-file-contents.ts @@ -4,11 +4,11 @@ /*** EXPORT ------------------------------------------- ***/ export default async(filePath: string) => { - const fileExists = await Deno.stat(filePath); + const fileExists = await Ende.stat(filePath); if (!fileExists) return ""; - const content = await Deno.readTextFile(filePath); + const content = await Ende.readTextFile(filePath); return content; } diff --git a/src/utility/constant.ts b/src/utility/constant.ts index d734164..6973b3e 100644 --- a/src/utility/constant.ts +++ b/src/utility/constant.ts @@ -3,12 +3,12 @@ /*** IMPORT ------------------------------------------- ***/ -import { join } from "dep/std.ts"; +import { join } from "@std/path"; /*** UTILITY ------------------------------------------ ***/ -const baseDirectory = await Deno.realPath("."); -const isDevelopment = Deno.args.includes("development"); +const baseDirectory = await Ende.realPath("."); +const isDevelopment = Ende.args.includes("development"); /*** EXPORT ------------------------------------------- ***/ @@ -19,7 +19,7 @@ export const email = "paul+blog@webb.page"; export const environment = isDevelopment ? "development" : "production"; export const feedDirectory = join(baseDirectory, "feed"); export const memoDirectory = join(baseDirectory, "memos"); -export const port = Number(Deno.env.has("PORT") ? Deno.env.get("PORT") : 3465); +export const port = Number(Ende.env.has("PORT") ? Ende.env.get("PORT") : 3465); export const remarkDirectory = join(baseDirectory, "remarks"); export const remarkRegex = /^(WR-\d*).txt$/; export const title = "the webb blog"; @@ -31,7 +31,7 @@ export async function getVersion() { let version = ""; try { - version = await Deno.readTextFile("./version.txt"); + version = await Ende.readTextFile("./version.txt"); } catch { /*** ignore ***/ } diff --git a/src/utility/markdown.ts b/src/utility/markdown.ts index 9d8e514..cf96e70 100644 --- a/src/utility/markdown.ts +++ b/src/utility/markdown.ts @@ -51,7 +51,7 @@ export default (input: string): string => { .replace(/(\~\~)(.*?)\1/g, `<del>$2</del>`) /*** strikethrough ***/ .replace(/'/g, "’") /*** fancy apostrophe ***/ .replace(/(:nbhyp:)/g, "‑") /*** non‑breaking hyphen ***/ - // deno-lint-ignore no-irregular-whitespace + // ende-lint-ignore no-irregular-whitespace .replace(/(:nbsp:)/g, " ") /*** non‑breaking space ***/ .replace(/(\.\.\.)/g, "…") /*** ellipsis ***/ .replace(/---/g, "<hr/>") diff --git a/version.txt b/version.txt index 08e8fcd..c79d9dc 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2026.10.24
\ No newline at end of file +2026.10.26
\ No newline at end of file |