+2
-1
src/constants.ts
+2
-1
src/constants.ts
···
2
2
3
3
export const DID = process.env.DID ?? "";
4
4
export const SIGNING_KEY = process.env.SIGNING_KEY ?? "";
5
-
export const PORT = 4001;
5
+
export const PORT = Number(process.env.PORT ?? 4001);
6
+
export const URL = process.env.URL ?? "wss://jetstream.atproto.tools/subscribe";
6
7
export const LABEL_LIMIT = 4;
7
8
export const DELETE = "3kwsqucto3j2a";
8
9
export const POSTS: Record<string, string> = {
+2
-2
src/main.ts
+2
-2
src/main.ts
···
1
1
import { label } from "./label.js";
2
-
import { DID } from "./constants.js";
2
+
import { DID, URL } from "./constants.js";
3
3
import fs from "node:fs";
4
4
import { Jetstream } from "@skyware/jetstream";
5
5
import { AppBskyFeedLike } from "@atcute/client/lexicons";
···
9
9
if (cursorFile) console.log(`Initiate firehose at cursor ${cursorFile}`);
10
10
11
11
const jetstream = new Jetstream({
12
+
endpoint: URL,
12
13
wantedCollections: ["app.bsky.feed.like"],
13
14
cursor: cursorFile ?? 0,
14
15
});
···
16
17
jetstream.on("open", () => {
17
18
intervalID = setInterval(() => {
18
19
if (jetstream.cursor) {
19
-
console.log(`${new Date().toISOString()}: ${jetstream.cursor}`);
20
20
fs.writeFile("cursor.txt", jetstream.cursor.toString(), (err) => {
21
21
if (err) console.log(err);
22
22
});