From 7b7dcf4a5eda74d41cfd9b60eb34a11fb1ec7b77 Mon Sep 17 00:00:00 2001 From: finxol Date: Mon, 24 Nov 2025 10:05:45 +0100 Subject: [PATCH] chore: add bsky post cid to content schema --- content.config.ts | 3 ++- content/posts/embracing-atproto-pt-2-tangled-knot.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/content.config.ts b/content.config.ts index 1e7afab..aebac35 100644 --- a/content.config.ts +++ b/content.config.ts @@ -26,7 +26,8 @@ export default defineContentConfig({ }) ), tags: z.array(z.string()), - published: z.boolean().optional() + published: z.boolean().optional(), + bskyCid: z.string().optional() }) }) ) diff --git a/content/posts/embracing-atproto-pt-2-tangled-knot.md b/content/posts/embracing-atproto-pt-2-tangled-knot.md index 7e99a03..788e248 100644 --- a/content/posts/embracing-atproto-pt-2-tangled-knot.md +++ b/content/posts/embracing-atproto-pt-2-tangled-knot.md @@ -10,6 +10,7 @@ tags: - atproto - self-hosting published: true +bskyCid: bafyreid4opjtllapzeyjgrsqcfrzyz2t6wjmxulmkhuh2wc6cyg5bre2su --- I recently set up my own atproto PDS, for use with Bluesky and all other atproto apps. -- 2.51.2 From f74ce1657bff8e17f945546c05e4f13ddd6897e6 Mon Sep 17 00:00:00 2001 From: finxol Date: Mon, 24 Nov 2025 10:13:51 +0100 Subject: [PATCH] chore: add deps --- package.json | 4 +++- pnpm-lock.yaml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e1adf1..aae236a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "name": "nuxt-app", "type": "module", - "packageManager": "pnpm@10.20.0", + "packageManager": "pnpm@10.23.0", "scripts": { "build": "nuxt build", "dev": "nuxt dev", @@ -12,6 +12,8 @@ "format": "biome format --write" }, "dependencies": { + "@atcute/bluesky": "^3.2.10", + "@atcute/client": "^4.0.5", "@nuxt/content": "^3.8.0", "@nuxt/icon": "1.11.0", "@nuxtjs/tailwindcss": "^6.14.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0049377..eda5a9d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: dependencies: + '@atcute/bluesky': + specifier: ^3.2.10 + version: 3.2.10 + '@atcute/client': + specifier: ^4.0.5 + version: 4.0.5 '@nuxt/content': specifier: ^3.8.0 version: 3.8.0(@libsql/client@0.15.15)(better-sqlite3@12.4.1)(magicast@0.5.1) @@ -71,6 +77,21 @@ packages: resolution: {integrity: sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ==} engines: {node: '>= 16'} + '@atcute/atproto@3.1.9': + resolution: {integrity: sha512-DyWwHCTdR4hY2BPNbLXgVmm7lI+fceOwWbE4LXbGvbvVtSn+ejSVFaAv01Ra3kWDha0whsOmbJL8JP0QPpf1+w==} + + '@atcute/bluesky@3.2.10': + resolution: {integrity: sha512-qwQWTzRf3umnh2u41gdU+xWYkbzGlKDupc3zeOB+YjmuP1N9wEaUhwS8H7vgrqr0xC9SGNDjeUVcjC4m5BPLBg==} + + '@atcute/client@4.0.5': + resolution: {integrity: sha512-R8Qen8goGmEkynYGg2m6XFlVmz0GTDvQ+9w+4QqOob+XMk8/WDpF4aImev7WKEde/rV2gjcqW7zM8E6W9NShDA==} + + '@atcute/identity@1.1.3': + resolution: {integrity: sha512-oIqPoI8TwWeQxvcLmFEZLdN2XdWcaLVtlm8pNk0E72As9HNzzD9pwKPrLr3rmTLRIoULPPFmq9iFNsTeCIU9ng==} + + '@atcute/lexicons@1.2.4': + resolution: {integrity: sha512-s6fl/SVjQMv7jiitLCcZ434X+VrTsJt7Fl9iJg8WXHJIELRz/U0sNUoP++oWd7bvPy1Vcd2Wnm+YtTm/Zn7AIQ==} + '@babel/code-frame@7.27.1': resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==} engines: {node: '>=6.9.0'} @@ -188,6 +209,10 @@ packages: resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} engines: {node: '>=6.9.0'} + '@badrap/valita@0.4.6': + resolution: {integrity: sha512-4kdqcjyxo/8RQ8ayjms47HCWZIF5981oE5nIenbfThKDxWXtEHKipAOWlflpPJzZx9y/JWYQkp18Awr7VuepFg==} + engines: {node: '>= 18'} + '@biomejs/biome@1.9.4': resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} engines: {node: '>=14.21.3'} @@ -2304,6 +2329,9 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} + esm-env@1.2.2: + resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==} + estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} @@ -4802,6 +4830,30 @@ snapshots: '@types/json-schema': 7.0.15 js-yaml: 4.1.0 + '@atcute/atproto@3.1.9': + dependencies: + '@atcute/lexicons': 1.2.4 + + '@atcute/bluesky@3.2.10': + dependencies: + '@atcute/atproto': 3.1.9 + '@atcute/lexicons': 1.2.4 + + '@atcute/client@4.0.5': + dependencies: + '@atcute/identity': 1.1.3 + '@atcute/lexicons': 1.2.4 + + '@atcute/identity@1.1.3': + dependencies: + '@atcute/lexicons': 1.2.4 + '@badrap/valita': 0.4.6 + + '@atcute/lexicons@1.2.4': + dependencies: + '@standard-schema/spec': 1.0.0 + esm-env: 1.2.2 + '@babel/code-frame@7.27.1': dependencies: '@babel/helper-validator-identifier': 7.28.5 @@ -4969,6 +5021,8 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 + '@badrap/valita@0.4.6': {} + '@biomejs/biome@1.9.4': optionalDependencies: '@biomejs/cli-darwin-arm64': 1.9.4 @@ -7259,6 +7313,8 @@ snapshots: escape-string-regexp@5.0.0: {} + esm-env@1.2.2: {} + estree-walker@2.0.2: {} estree-walker@3.0.3: -- 2.51.2 From c7f79e947cd6414f335530bf3b2c0d9e97d321ce Mon Sep 17 00:00:00 2001 From: finxol Date: Mon, 24 Nov 2025 11:15:40 +0100 Subject: [PATCH] feat: first draft at bsky replies --- .zed/settings.json | 9 ++-- app/components/BskyComments.vue | 52 +++++++++++++++++++ app/pages/posts/[...slug].vue | 4 ++ app/util/atproto.ts | 39 ++++++++++++++ blog.config.ts | 1 + .../embracing-atproto-pt-2-tangled-knot.md | 2 +- globals.ts | 2 + package.json | 1 + pnpm-lock.yaml | 3 ++ tsconfig.json | 5 +- 10 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 app/components/BskyComments.vue create mode 100644 app/util/atproto.ts diff --git a/.zed/settings.json b/.zed/settings.json index e01c6ec..4adf6af 100644 --- a/.zed/settings.json +++ b/.zed/settings.json @@ -2,22 +2,23 @@ "language_servers": ["deno", "..."], "languages": { "Vue.js": { - "language_servers": ["deno", "..."] + "formatter": { "language_server": { "name": "biome" } }, + "language_servers": ["!deno", "biome", "..."] }, "JavaScript": { "formatter": { "language_server": { "name": "biome" } }, - "language_servers": ["deno", "..."] + "language_servers": ["!deno", "..."] }, "TypeScript": { "formatter": { "language_server": { "name": "biome" } }, - "language_servers": ["deno", "..."] + "language_servers": ["!deno", "..."] }, "TSX": { "formatter": { "language_server": { "name": "biome" } }, - "language_servers": ["deno", "..."] + "language_servers": ["!deno", "..."] }, "JSON": { "formatter": { "language_server": { "name": "biome" } } }, "JSONC": { "formatter": { "language_server": { "name": "biome" } } }, diff --git a/app/components/BskyComments.vue b/app/components/BskyComments.vue new file mode 100644 index 0000000..a35f402 --- /dev/null +++ b/app/components/BskyComments.vue @@ -0,0 +1,52 @@ + + + diff --git a/app/pages/posts/[...slug].vue b/app/pages/posts/[...slug].vue index e79c9f7..5388340 100644 --- a/app/pages/posts/[...slug].vue +++ b/app/pages/posts/[...slug].vue @@ -91,6 +91,10 @@ if (post.value) { + + + +
diff --git a/app/util/atproto.ts b/app/util/atproto.ts new file mode 100644 index 0000000..a14d39a --- /dev/null +++ b/app/util/atproto.ts @@ -0,0 +1,39 @@ +import { Client, simpleFetchHandler } from "@atcute/client"; +import type { AppBskyFeedDefs } from "@atcute/bluesky"; +import type { ResourceUri } from "@atcute/lexicons"; + +import config from "@/../blog.config"; + +const handler = simpleFetchHandler({ + service: "https://public.api.bsky.app" +}); +const rpc = new Client({ handler }); + +export type ReplyThread = + | AppBskyFeedDefs.ThreadViewPost + | AppBskyFeedDefs.BlockedPost + | AppBskyFeedDefs.NotFoundPost; + +export async function getBskyReplies(cid: string) { + // uri should be in format: at://did:plc:xxx/app.bsky.feed.post/xxxxx + const uri: ResourceUri = `at://${config.authorDid}/app.bsky.feed.post/${cid}`; + + const { ok, data } = await rpc.get("app.bsky.feed.getPostThread", { + params: { + uri, + depth: 10 + } + }); + + if (!ok) { + console.error(data); + console.error("Error fetching thread:", data.error); + return { $type: "app.bsky.feed.defs#notFoundPost" }; + } + + if (ok) { + return data.thread; + } + + return { $type: "app.bsky.feed.defs#notFoundPost" }; +} diff --git a/blog.config.ts b/blog.config.ts index f123bec..2a6d950 100644 --- a/blog.config.ts +++ b/blog.config.ts @@ -4,6 +4,7 @@ export default defineBlogConfig({ site: "https://finxol.io", title: "finxol's blog", author: "finxol", + authorDid: "did:plc:hpmpe3pzpdtxbmvhlwrevhju", meta: [ { name: "description", diff --git a/content/posts/embracing-atproto-pt-2-tangled-knot.md b/content/posts/embracing-atproto-pt-2-tangled-knot.md index 788e248..f3d090b 100644 --- a/content/posts/embracing-atproto-pt-2-tangled-knot.md +++ b/content/posts/embracing-atproto-pt-2-tangled-knot.md @@ -10,7 +10,7 @@ tags: - atproto - self-hosting published: true -bskyCid: bafyreid4opjtllapzeyjgrsqcfrzyz2t6wjmxulmkhuh2wc6cyg5bre2su +bskyCid: 3lyzhrumfu22n --- I recently set up my own atproto PDS, for use with Bluesky and all other atproto apps. diff --git a/globals.ts b/globals.ts index 264ff1d..c792da0 100644 --- a/globals.ts +++ b/globals.ts @@ -10,6 +10,7 @@ export type BlogConfig = { sharingProviders: SharingProvider[]; title: string; author: string; + authorDid: `did:plc:${string}`; meta: { name: string; content: string; @@ -36,6 +37,7 @@ export function defineBlogConfig(config: Prettify>) { : { bluesky: true, clipboard: true, native: true }, title: config.title ?? "My Blog", author: config.author ?? "finxol", + authorDid: config.authorDid, meta: config.meta ?? [ { name: "description", content: "My blog description" } ], diff --git a/package.json b/package.json index aae236a..0495147 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "@atcute/bluesky": "^3.2.10", "@atcute/client": "^4.0.5", + "@atcute/lexicons": "^1.2.4", "@nuxt/content": "^3.8.0", "@nuxt/icon": "1.11.0", "@nuxtjs/tailwindcss": "^6.14.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eda5a9d..5767345 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@atcute/client': specifier: ^4.0.5 version: 4.0.5 + '@atcute/lexicons': + specifier: ^1.2.4 + version: 1.2.4 '@nuxt/content': specifier: ^3.8.0 version: 3.8.0(@libsql/client@0.15.15)(better-sqlite3@12.4.1)(magicast@0.5.1) diff --git a/tsconfig.json b/tsconfig.json index 76e2dd5..c53dd85 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,7 @@ { // https://nuxt.com/docs/guide/concepts/typescript - "extends": "./.nuxt/tsconfig.json" + "extends": "./.nuxt/tsconfig.json", + "compilerOptions": { + "types": ["@atcute/bluesky"] + } } -- 2.51.2