+4
-2
index/jetstream.ts
+4
-2
index/jetstream.ts
···
1
-
import { handleIndex, jetstreamManager } from "../main.ts";
1
+
import { Database } from "jsr:@db/sqlite@0.11";
2
+
import { handleIndex } from "../main.ts";
2
3
import { resolveRecordFromURI } from "../utils/records.ts";
4
+
import { JetstreamManager } from "../utils/sharders.ts";
3
5
4
-
export function startJetstream() {
6
+
export function startJetstream(jetstreamManager: JetstreamManager) {
5
7
jetstreamManager.start({
6
8
// for realsies pls get from db or something instead of this shit
7
9
wantedDids: [
+5
-3
index/spacedust.ts
+5
-3
index/spacedust.ts
···
1
-
import { db, handleIndex, spacedustManager } from "../main.ts";
1
+
import { Database } from "jsr:@db/sqlite@0.11";
2
+
import { handleIndex } from "../main.ts";
2
3
import { parseAtUri } from "../utils/aturi.ts";
3
4
import { resolveRecordFromURI } from "../utils/records.ts";
5
+
import { SpacedustManager } from "../utils/sharders.ts";
4
6
5
-
export function startSpacedust() {
7
+
export function startSpacedust(spacedustManager: SpacedustManager) {
6
8
spacedustManager.start({
7
9
wantedSources: [
8
10
"app.bsky.feed.like:subject.uri", // like
···
54
56
};
55
57
};
56
58
57
-
export async function handleSpacedust(msg: SpacedustLinkMessage) {
59
+
export async function handleSpacedust(db: Database, msg: SpacedustLinkMessage) {
58
60
if (!msg || !msg.link || !msg.link.source_record) return;
59
61
console.log("Received Spacedust message: ", msg);
60
62
+17
-8
main.ts
+17
-8
main.ts
···
28
28
export const systemDB = new Database("system.db");
29
29
setupSystemDb(systemDB);
30
30
31
-
export const spacedustManager = new SpacedustManager((msg) =>
32
-
handleSpacedust(msg)
33
-
);
34
-
export const jetstreamManager = new JetstreamManager((msg) =>
35
-
handleJetstream(msg)
36
-
);
37
-
startSpacedust();
38
-
startJetstream();
31
+
// should do both of these per user actually, since now each user has their own db
32
+
// also the set of records and backlinks to listen should be seperate between index and view servers
33
+
// damn
34
+
// export const spacedustManager = new SpacedustManager((msg) =>
35
+
// handleSpacedust(msg)
36
+
// );
37
+
// export const jetstreamManager = new JetstreamManager((msg) =>
38
+
// handleJetstream(msg)
39
+
// );
40
+
// startSpacedust();
41
+
// startJetstream();
42
+
43
+
// 1. connect to system db
44
+
// 2. get all registered users
45
+
// parse config (maybe some are only indexes and maybe some are only views)
46
+
// map all new jetstream and spacedust listeners
47
+
// call handleIndex with the specific db to use
39
48
40
49
setupAuth({
41
50
// local3768forumtest is just my tunnel from my dev env to the outside web that im reusing from forumtest