Loading deno.json +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ "@fedify/fedify/x/hono": "./x/hono.ts", "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0", "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.1", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.2", "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0", "@std/assert": "jsr:@std/assert@^0.220.1", "@std/async/delay": "jsr:@std/async@^0.220.1/delay", Loading examples/blog/.vscode/settings.json +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ "fediverse", "halfyear", "httpsig", "logtape", "nodeinfo", "preact", "unfollow", Loading examples/blog/federation/mod.ts +20 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import { Federation } from "@fedify/fedify/federation"; import { Accept, Activity, Article, Create, Endpoints, Follow, Loading @@ -26,6 +27,9 @@ import { } from "../models/follower.ts"; import { countPosts, getPosts, toArticle } from "../models/post.ts"; import { openKv } from "../models/kv.ts"; import { getLogger } from "@logtape/logtape"; const logger = getLogger(["blog", "federation"]); // The `Federation<TContextData>` object is a registry that registers // federation-related callbacks: Loading Loading @@ -177,7 +181,7 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") // The `Create` activity is handled by adding a comment to the post: .on(Create, async (ctx, create) => { const object = await create.getObject(ctx); if (object instanceof Note) { if (object instanceof Note || object instanceof Article) { if (object.id == null || object.content == null) return; const author = await object.getAttribution(); if ( Loading Loading @@ -205,7 +209,10 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") await addComment({ ...comment, postUuid }); } } else { console.debug(object); logger.getChild("inbox").warn( "Unsupported object type ({type}) for Create activity: {object}", { type: object?.constructor.name, object }, ); } }) // The `Undo` activity purposes to undo the previous activity. In this Loading @@ -217,10 +224,19 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") if (activity.id == null) return; await removeFollower(activity.id.href); } else { console.debug(undo); logger.getChild("inbox").warn( "Unsupported object type ({type}) for Undo activity: {object}", { type: activity?.constructor.name, object: activity }, ); } }) .onError((_ctx, e) => console.error(e)); .onError((_ctx, error) => { logger.getChild("inbox").error( "An error occurred while processing an activity in the inbox handler:\n" + "{error}", { error }, ); }); // Since the blog does not follow anyone, the following dispatcher is // implemented to return just an empty list: Loading examples/blog/fresh.config.ts +1 −0 Original line number Diff line number Diff line import { defineConfig } from "$fresh/server.ts"; import "./loggers.ts"; export default defineConfig({}); examples/blog/import_map.g.json +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ "@fedify/fedify/x/hono": "./x/hono.ts", "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0", "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.1", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.2", "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0", "@std/assert": "jsr:@std/assert@^0.220.1", "@std/async/delay": "jsr:@std/async@^0.220.1/delay", Loading Loading
deno.json +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ "@fedify/fedify/x/hono": "./x/hono.ts", "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0", "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.1", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.2", "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0", "@std/assert": "jsr:@std/assert@^0.220.1", "@std/async/delay": "jsr:@std/async@^0.220.1/delay", Loading
examples/blog/.vscode/settings.json +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ "fediverse", "halfyear", "httpsig", "logtape", "nodeinfo", "preact", "unfollow", Loading
examples/blog/federation/mod.ts +20 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import { Federation } from "@fedify/fedify/federation"; import { Accept, Activity, Article, Create, Endpoints, Follow, Loading @@ -26,6 +27,9 @@ import { } from "../models/follower.ts"; import { countPosts, getPosts, toArticle } from "../models/post.ts"; import { openKv } from "../models/kv.ts"; import { getLogger } from "@logtape/logtape"; const logger = getLogger(["blog", "federation"]); // The `Federation<TContextData>` object is a registry that registers // federation-related callbacks: Loading Loading @@ -177,7 +181,7 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") // The `Create` activity is handled by adding a comment to the post: .on(Create, async (ctx, create) => { const object = await create.getObject(ctx); if (object instanceof Note) { if (object instanceof Note || object instanceof Article) { if (object.id == null || object.content == null) return; const author = await object.getAttribution(); if ( Loading Loading @@ -205,7 +209,10 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") await addComment({ ...comment, postUuid }); } } else { console.debug(object); logger.getChild("inbox").warn( "Unsupported object type ({type}) for Create activity: {object}", { type: object?.constructor.name, object }, ); } }) // The `Undo` activity purposes to undo the previous activity. In this Loading @@ -217,10 +224,19 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox") if (activity.id == null) return; await removeFollower(activity.id.href); } else { console.debug(undo); logger.getChild("inbox").warn( "Unsupported object type ({type}) for Undo activity: {object}", { type: activity?.constructor.name, object: activity }, ); } }) .onError((_ctx, e) => console.error(e)); .onError((_ctx, error) => { logger.getChild("inbox").error( "An error occurred while processing an activity in the inbox handler:\n" + "{error}", { error }, ); }); // Since the blog does not follow anyone, the following dispatcher is // implemented to return just an empty list: Loading
examples/blog/fresh.config.ts +1 −0 Original line number Diff line number Diff line import { defineConfig } from "$fresh/server.ts"; import "./loggers.ts"; export default defineConfig({});
examples/blog/import_map.g.json +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ "@fedify/fedify/x/hono": "./x/hono.ts", "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0", "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.1", "@logtape/logtape": "jsr:@logtape/logtape@^0.2.2", "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0", "@std/assert": "jsr:@std/assert@^0.220.1", "@std/async/delay": "jsr:@std/async@^0.220.1/delay", Loading