An ATProto PDS running on Rivet?
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add some basic organization and config.

Zicklag 28aa422b 3c095967

+50 -16
+2 -2
package.json
··· 5 5 "main": "main.ts", 6 6 "type": "module", 7 7 "scripts": { 8 - "runner": "npx tsx start_runner.ts", 9 - "gateway": "npx tsx start_gateway.ts" 8 + "runner": "npx tsx src/start_runner.ts", 9 + "gateway": "npx tsx src/start_gateway.ts" 10 10 }, 11 11 "keywords": [], 12 12 "author": "Zicklag",
-14
registry.ts
··· 1 - import { actor, setup } from "rivetkit"; 2 - 3 - // Create an HTTP actor for handling requests 4 - export const http = actor({ 5 - // Create a raw request handler 6 - onRequest(_c, req) { 7 - // Return whatever URL comes from the request as the text body 8 - return new Response(`Url: ${req.url}`); 9 - }, 10 - }); 11 - 12 - export const registry = setup({ 13 - use: { http }, 14 - });
+3
src/config.ts
··· 1 + export const CONFIG = { 2 + publicEndpoint: process.env.PUBLIC_ENDPOINT || "http://localhost:3000", 3 + };
+8
src/registry.ts
··· 1 + import { setup } from "rivetkit"; 2 + 3 + import { authServer } from "./registry/authServer"; 4 + import { http } from "./registry/http"; 5 + 6 + export const registry = setup({ 7 + use: { http, authServer }, 8 + });
+12
src/registry/authServer.ts
··· 1 + import { actor } from "rivetkit"; 2 + import { CONFIG } from "../config"; 3 + 4 + export const authServer = actor({ 5 + actions: { 6 + getMetadata() { 7 + return JSON.stringify({ 8 + issuer: CONFIG.publicEndpoint, 9 + }); 10 + }, 11 + }, 12 + });
+25
src/registry/http.ts
··· 1 + import { Hono } from "hono"; 2 + import { actor } from "rivetkit"; 3 + import type { registry } from "../registry"; 4 + 5 + /** Create an HTTP actor for handling requests. */ 6 + export const http = actor({ 7 + onRequest(c, req) { 8 + const client = c.client<typeof registry>(); 9 + const authServer = client.authServer.getOrCreate("main"); 10 + 11 + const app = new Hono(); 12 + 13 + app.get( 14 + "/.well-known/oauth-authorization-server", 15 + async () => 16 + new Response(await authServer.getMetadata(), { 17 + headers: { 18 + "content-type": "application/json", 19 + }, 20 + }), 21 + ); 22 + 23 + return app.fetch(req); 24 + }, 25 + });
start_gateway.ts src/start_gateway.ts
start_runner.ts src/start_runner.ts