diff --git a/deno.lock b/deno.lock index 9b6a843..7ec9e54 100644 --- a/deno.lock +++ b/deno.lock @@ -10,6 +10,7 @@ "jsr:@std/fmt@1": "1.0.8", "jsr:@std/fs@1": "1.0.19", "jsr:@std/internal@^1.0.9": "1.0.10", + "jsr:@std/jsonc@*": "1.0.2", "jsr:@std/path@0.217": "0.217.0", "jsr:@std/path@1": "1.1.1", "jsr:@std/path@^1.1.1": "1.1.1", @@ -31,7 +32,8 @@ "npm:multiformats@*": "13.4.0", "npm:quick-lru@*": "7.0.1", "npm:vite@*": "7.1.3_@types+node@22.15.15_picomatch@4.0.3", - "npm:web-did-resolver@*": "2.0.30" + "npm:web-did-resolver@*": "2.0.30", + "npm:zod@*": "3.25.46" }, "jsr": { "@db/sqlite@0.11.1": { @@ -75,6 +77,9 @@ "@std/internal@1.0.10": { "integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7" }, + "@std/jsonc@1.0.2": { + "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7" + }, "@std/path@0.217.0": { "integrity": "1217cc25534bca9a2f672d7fe7c6f356e4027df400c0e85c0ef3e4343bc67d11", "dependencies": [ diff --git a/readme.md b/readme.md index fb3e0ae..0e49e20 100644 --- a/readme.md +++ b/readme.md @@ -48,10 +48,60 @@ despite both living in this repo, they run different http servers with different example configuration is in the `config.jsonc.example` file -expose your localhost to the web using a tunnel or something and use that url as the custom appview url +### Index Server +start it by running +```sh +deno task index +``` +it should just work actually +implemented xrpc routes for `#skylite_index` are: +```ts +const indexServerRoutes = new Set([ + "/xrpc/app.bsky.actor.getProfile", + "/xrpc/app.bsky.actor.getProfiles", + "/xrpc/app.bsky.feed.getActorFeeds", + "/xrpc/app.bsky.feed.getFeedGenerator", + "/xrpc/app.bsky.feed.getFeedGenerators", + "/xrpc/app.bsky.feed.getPosts", + "/xrpc/party.whey.app.bsky.feed.getActorLikesPartial", + "/xrpc/party.whey.app.bsky.feed.getAuthorFeedPartial", + "/xrpc/party.whey.app.bsky.feed.getLikesPartial", + "/xrpc/party.whey.app.bsky.feed.getPostThreadPartial", + "/xrpc/party.whey.app.bsky.feed.getQuotesPartial", + "/xrpc/party.whey.app.bsky.feed.getRepostedByPartial", + // i havent implemented these three yet + /* + app.bsky.graph.getLists // doesnt need to because theres no items[], and its self ProfileViewBasic + app.bsky.graph.getList // needs to be Partial-ed (items[] union with ProfileViewRef) + app.bsky.graph.getActorStarterPacks // maybe doesnt need to be Partial-ed because its self ProfileViewBasic + */ -this should work on any bluesky client that supports changing the appview URL (im using an unreleased custom fork for development) + // and the last one is a stub because its pretty hard to do + "/xrpc/party.whey.app.bsky.feed.getListFeedPartial", +]); +``` there is no way to register users to be indexed by the server yet (either Index nor View servers) so you can just manually add your account to the `system.db` file for now +### View Server +start it by running +```sh +deno task view +``` +expose your localhost to the web using a tunnel or something and use that url as the custom appview url + +this should work on any bluesky client that supports changing the appview URL (im using an unreleased custom fork for development) as the view server implements the `#bsky_appview` routes for compatibility with existing clients + +the view server has extra configurations that you need to understand. +the view server hydrates content by calling other servers (either an `#skylite_index` or `#bsky_appview`) and so you need to write the order of which servers are prioritized first for resolving the hydration endpoints +```js +// In order of which skylite index servers or bsky appviews to use first +"indexPriority": [ + "user#skylite_index", // user resolved skylite index server + "did:web:backupindexserver.your.site#skylite_index", // a specific skylite index server + "user#bsky_appview", // user resolved bsky appview + "did:web:api.bsky.app#bsky_appview" // a specific bsky appview +] +``` + id say this project is like uhh ~20% done so not a lot of things you can do with this right now \ No newline at end of file diff --git a/utils/sharders.ts b/utils/sharders.ts index 9fb5d7b..776ddeb 100644 --- a/utils/sharders.ts +++ b/utils/sharders.ts @@ -1,3 +1,5 @@ +import { config } from "../config.ts"; + function getShardId(params: URLSearchParams): string { params.sort(); return params.toString(); @@ -245,7 +247,7 @@ interface SpacedustParams { export class JetstreamManager extends ShardedConnectionManager { constructor(onMessage: (msg: any) => void) { super( - `${Deno.env.get("JETSTREAM_URL")}/subscribe`, + `${config.jetstream}/subscribe`, { wantedDids: 10000, wantedCollections: 100 }, onMessage ); @@ -255,7 +257,7 @@ export class JetstreamManager extends ShardedConnectionManager export class SpacedustManager extends ShardedConnectionManager { constructor(onMessage: (msg: any) => void) { super( - `${Deno.env.get("SPACEDUST_URL")}/subscribe`, + `${config.spacedust}/subscribe`, { wantedSubjects: 100, wantedSubjectDids: 100, wantedSources: 100 }, onMessage );