this repo has no description
0
fork

Configure Feed

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

fixes

alice 59628b7f 30b91b74

+17 -16
+1 -1
.nvmrc
··· 1 - v22.9.0 1 + v22.11.0
+3 -3
README.md
··· 22 22 SIGNING_KEY=xxx 23 23 BSKY_IDENTIFIER=xxx 24 24 BSKY_PASSWORD=xxx 25 - PORT=4002 26 - METRICS_PORT=4102 25 + PORT=4100 26 + METRICS_PORT=4101 27 27 FIREHOSE_URL=wss://jetstream.atproto.tools/subscribe 28 28 CURSOR_UPDATE_INTERVAL=10000 29 29 ``` ··· 47 47 48 48 ```Caddyfile 49 49 labeler.example.com { 50 - reverse_proxy 127.0.0.1:4002 50 + reverse_proxy 127.0.0.1:4100 51 51 } 52 52 ``` 53 53
+2 -3
package.json
··· 21 21 "@types/eslint__js": "^8.42.3", 22 22 "@types/express": "^4.17.21", 23 23 "@types/node": "^22.9.0", 24 - "@types/ws": "^8.5.13", 25 24 "eslint": "^9.14.0", 26 25 "prettier": "^3.3.3", 27 26 "tsx": "^4.19.2", 28 27 "typescript": "^5.6.3", 29 - "typescript-eslint": "^8.13.0" 28 + "typescript-eslint": "^8.14.0" 30 29 }, 31 30 "dependencies": { 32 31 "@atproto/api": "^0.13.15", ··· 38 37 "husky": "^9.1.6", 39 38 "lint-staged": "^15.2.10", 40 39 "pino": "^9.5.0", 41 - "pino-pretty": "^12.1.0", 40 + "pino-pretty": "^13.0.0", 42 41 "prom-client": "^15.1.3" 43 42 } 44 43 }
+3 -3
src/config.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 = process.env.PORT ? Number(process.env.PORT) : 4002; 6 - export const METRICS_PORT = process.env.METRICS_PORT ? Number(process.env.METRICS_PORT) : 4102; 5 + export const PORT = process.env.PORT ? Number(process.env.PORT) : 4100; 6 + export const METRICS_PORT = process.env.METRICS_PORT ? Number(process.env.METRICS_PORT) : 4101; 7 7 export const FIREHOSE_URL = process.env.FIREHOSE_URL ?? 'wss://jetstream.atproto.tools/subscribe'; 8 8 export const WANTED_COLLECTION = 'app.bsky.feed.like'; 9 9 export const BSKY_IDENTIFIER = process.env.BSKY_IDENTIFIER ?? ''; 10 10 export const BSKY_PASSWORD = process.env.BSKY_PASSWORD ?? ''; 11 11 export const CURSOR_UPDATE_INTERVAL = 12 - process.env.CURSOR_UPDATE_INTERVAL ? Number(process.env.CURSOR_UPDATE_INTERVAL) : 10000; 12 + process.env.CURSOR_UPDATE_INTERVAL ? Number(process.env.CURSOR_UPDATE_INTERVAL) : 60000;
+7 -3
src/label.ts
··· 63 63 64 64 function addOrUpdateLabel(did: string, rkey: string, labels: Set<string>) { 65 65 const newLabel = LABELS.find((label) => label.rkey === rkey); 66 - logger.info(`New label: ${newLabel?.identifier}`); 66 + if (!newLabel) { 67 + logger.warn(`New label not found: ${rkey}. Likely liked a post that's not one for labels.`); 68 + return; 69 + } 70 + logger.info(`New label: ${newLabel.identifier}`); 67 71 68 72 if (labels.size >= LABEL_LIMIT) { 69 73 try { ··· 75 79 } 76 80 77 81 try { 78 - labelerServer.createLabel({ uri: did, val: newLabel!.identifier }); 79 - logger.info(`Successfully labeled ${did} with ${newLabel?.identifier}`); 82 + labelerServer.createLabel({ uri: did, val: newLabel.identifier }); 83 + logger.info(`Successfully labeled ${did} with ${newLabel.identifier}`); 80 84 } catch (error) { 81 85 logger.error(`Error adding new label: ${error}`); 82 86 }
+1 -3
src/main.ts
··· 60 60 jetstream.onCreate(WANTED_COLLECTION, (event: CommitCreateEvent<typeof WANTED_COLLECTION>) => { 61 61 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition 62 62 if (event.commit?.record?.subject?.uri?.includes(DID)) { 63 - label(event.did, event.commit.record.subject.uri.split('/').pop()!).catch((error: unknown) => { 64 - logger.error(`Unexpected error labeling ${event.did}: ${error}`); 65 - }); 63 + label(event.did, event.commit.record.subject.uri.split('/').pop()!); 66 64 } 67 65 }); 68 66