一人のサーバでも、宇宙全体と文通できます。外交の実務はfedify別院に任せているから、holloの外交はこの数ファイルで済んでいる——「自分のSNSを持つ」が、一人の趣味プロジェクトの規模に収まる理由がここにあります。
台所事情も潔い。KVも配達キューも@fedify/postgres一本で、Redisも別のブローカーも置いていません。小さな館には、倉がひとつで足りる。
見どころ
actor.tsのsetKeyPairsDispatcherはRSAとEd25519、二対の鍵を返す——古い町とも新しい町とも話すため- inboxは
/@{identifier}/inboxと共有/inboxの二枚口。Follow/Accept/Create/Like/EmojiReact/Announce/Update/Delete/Block/Move/Undoなど15種ほどの.on()が並ぶ - NODE_TYPEがwebのノードはキューを自動起動しない(manuallyStartQueue)——web係と配達係を分けられる
- FEDIFY_DEBUG=trueにすると全体がcreateFederationDebuggerに包まれて、行き交う文書を覗ける
経文の一節
let federation: Federation<void> & { sink?: Sink } = createFederation<void>({
kv,
queue: new ParallelMessageQueue(new PostgresMessageQueue(postgres), 10),
// Only start the queue automatically if not running as a web-only node
manuallyStartQueue: nodeType === "web",
// TODO: Revert to Fedify's default RFC 9421-first behavior once
// https://github.com/bonfire-networks/activity_pub/issues/8 is fixed and
// released.
firstKnock: "draft-cavage-http-signatures-12",
userAgent: {
software: `Hollo/${metadata.version}`,
},