PDS Admin tool make it easier to moderate your PDS with labels
43
fork

Configure Feed

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

wip

+125 -516
+7
drizzle/0000_tidy_prima.sql drizzle/0000_crazy_wallflower.sql
··· 1 + CREATE TABLE `labeler_cursors` ( 2 + `labeler_id` text, 3 + `cursor` integer NOT NULL 4 + ); 5 + --> statement-breakpoint 6 + CREATE UNIQUE INDEX `labeler_cursors_labeler_id_unique` ON `labeler_cursors` (`labeler_id`);--> statement-breakpoint 1 7 CREATE TABLE `labels_applied` ( 2 8 `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, 3 9 `did` text NOT NULL, 4 10 `label` text NOT NULL, 5 11 `action` text NOT NULL, 12 + `negated` integer DEFAULT false NOT NULL, 6 13 `date_applied` integer NOT NULL, 7 14 FOREIGN KEY (`did`) REFERENCES `watched_repos`(`did`) ON UPDATE no action ON DELETE no action 8 15 );
-6
drizzle/0001_faithful_shard.sql
··· 1 - CREATE TABLE `labeler_cursors` ( 2 - `labeler_id` text, 3 - `cursor` text NOT NULL 4 - ); 5 - --> statement-breakpoint 6 - CREATE UNIQUE INDEX `labeler_cursors_labeler_id_unique` ON `labeler_cursors` (`labeler_id`);
-5
drizzle/0002_greedy_dormammu.sql
··· 1 - DROP INDEX "labeler_cursors_labeler_id_unique";--> statement-breakpoint 2 - DROP INDEX "watched_repos_did_unique";--> statement-breakpoint 3 - ALTER TABLE `labeler_cursors` ALTER COLUMN "cursor" TO "cursor" integer NOT NULL;--> statement-breakpoint 4 - CREATE UNIQUE INDEX `labeler_cursors_labeler_id_unique` ON `labeler_cursors` (`labeler_id`);--> statement-breakpoint 5 - CREATE UNIQUE INDEX `watched_repos_did_unique` ON `watched_repos` (`did`);
-1
drizzle/0003_kind_the_liberteens.sql
··· 1 - ALTER TABLE `labels_applied` ADD `negated` integer DEFAULT 0 NOT NULL;
+41 -1
drizzle/meta/0000_snapshot.json
··· 1 1 { 2 2 "version": "6", 3 3 "dialect": "sqlite", 4 - "id": "2f73eace-efb4-467d-8b3e-0fce14415678", 4 + "id": "5a06d315-4901-4f9e-aab2-1c8dd03bb750", 5 5 "prevId": "00000000-0000-0000-0000-000000000000", 6 6 "tables": { 7 + "labeler_cursors": { 8 + "name": "labeler_cursors", 9 + "columns": { 10 + "labeler_id": { 11 + "name": "labeler_id", 12 + "type": "text", 13 + "primaryKey": false, 14 + "notNull": false, 15 + "autoincrement": false 16 + }, 17 + "cursor": { 18 + "name": "cursor", 19 + "type": "integer", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false 23 + } 24 + }, 25 + "indexes": { 26 + "labeler_cursors_labeler_id_unique": { 27 + "name": "labeler_cursors_labeler_id_unique", 28 + "columns": [ 29 + "labeler_id" 30 + ], 31 + "isUnique": true 32 + } 33 + }, 34 + "foreignKeys": {}, 35 + "compositePrimaryKeys": {}, 36 + "uniqueConstraints": {}, 37 + "checkConstraints": {} 38 + }, 7 39 "labels_applied": { 8 40 "name": "labels_applied", 9 41 "columns": { ··· 34 66 "primaryKey": false, 35 67 "notNull": true, 36 68 "autoincrement": false 69 + }, 70 + "negated": { 71 + "name": "negated", 72 + "type": "integer", 73 + "primaryKey": false, 74 + "notNull": true, 75 + "autoincrement": false, 76 + "default": false 37 77 }, 38 78 "date_applied": { 39 79 "name": "date_applied",
-155
drizzle/meta/0001_snapshot.json
··· 1 - { 2 - "version": "6", 3 - "dialect": "sqlite", 4 - "id": "69fbc25d-9d45-43d4-973b-b6bcd6148bb3", 5 - "prevId": "2f73eace-efb4-467d-8b3e-0fce14415678", 6 - "tables": { 7 - "labeler_cursors": { 8 - "name": "labeler_cursors", 9 - "columns": { 10 - "labeler_id": { 11 - "name": "labeler_id", 12 - "type": "text", 13 - "primaryKey": false, 14 - "notNull": false, 15 - "autoincrement": false 16 - }, 17 - "cursor": { 18 - "name": "cursor", 19 - "type": "text", 20 - "primaryKey": false, 21 - "notNull": true, 22 - "autoincrement": false 23 - } 24 - }, 25 - "indexes": { 26 - "labeler_cursors_labeler_id_unique": { 27 - "name": "labeler_cursors_labeler_id_unique", 28 - "columns": [ 29 - "labeler_id" 30 - ], 31 - "isUnique": true 32 - } 33 - }, 34 - "foreignKeys": {}, 35 - "compositePrimaryKeys": {}, 36 - "uniqueConstraints": {}, 37 - "checkConstraints": {} 38 - }, 39 - "labels_applied": { 40 - "name": "labels_applied", 41 - "columns": { 42 - "id": { 43 - "name": "id", 44 - "type": "integer", 45 - "primaryKey": true, 46 - "notNull": true, 47 - "autoincrement": true 48 - }, 49 - "did": { 50 - "name": "did", 51 - "type": "text", 52 - "primaryKey": false, 53 - "notNull": true, 54 - "autoincrement": false 55 - }, 56 - "label": { 57 - "name": "label", 58 - "type": "text", 59 - "primaryKey": false, 60 - "notNull": true, 61 - "autoincrement": false 62 - }, 63 - "action": { 64 - "name": "action", 65 - "type": "text", 66 - "primaryKey": false, 67 - "notNull": true, 68 - "autoincrement": false 69 - }, 70 - "date_applied": { 71 - "name": "date_applied", 72 - "type": "integer", 73 - "primaryKey": false, 74 - "notNull": true, 75 - "autoincrement": false 76 - } 77 - }, 78 - "indexes": {}, 79 - "foreignKeys": { 80 - "labels_applied_did_watched_repos_did_fk": { 81 - "name": "labels_applied_did_watched_repos_did_fk", 82 - "tableFrom": "labels_applied", 83 - "tableTo": "watched_repos", 84 - "columnsFrom": [ 85 - "did" 86 - ], 87 - "columnsTo": [ 88 - "did" 89 - ], 90 - "onDelete": "no action", 91 - "onUpdate": "no action" 92 - } 93 - }, 94 - "compositePrimaryKeys": {}, 95 - "uniqueConstraints": {}, 96 - "checkConstraints": {} 97 - }, 98 - "watched_repos": { 99 - "name": "watched_repos", 100 - "columns": { 101 - "did": { 102 - "name": "did", 103 - "type": "text", 104 - "primaryKey": true, 105 - "notNull": true, 106 - "autoincrement": false 107 - }, 108 - "pds_host": { 109 - "name": "pds_host", 110 - "type": "text", 111 - "primaryKey": false, 112 - "notNull": true, 113 - "autoincrement": false 114 - }, 115 - "active": { 116 - "name": "active", 117 - "type": "integer", 118 - "primaryKey": false, 119 - "notNull": true, 120 - "autoincrement": false 121 - }, 122 - "date_first_seen": { 123 - "name": "date_first_seen", 124 - "type": "integer", 125 - "primaryKey": false, 126 - "notNull": true, 127 - "autoincrement": false 128 - } 129 - }, 130 - "indexes": { 131 - "watched_repos_did_unique": { 132 - "name": "watched_repos_did_unique", 133 - "columns": [ 134 - "did" 135 - ], 136 - "isUnique": true 137 - } 138 - }, 139 - "foreignKeys": {}, 140 - "compositePrimaryKeys": {}, 141 - "uniqueConstraints": {}, 142 - "checkConstraints": {} 143 - } 144 - }, 145 - "views": {}, 146 - "enums": {}, 147 - "_meta": { 148 - "schemas": {}, 149 - "tables": {}, 150 - "columns": {} 151 - }, 152 - "internal": { 153 - "indexes": {} 154 - } 155 - }
-155
drizzle/meta/0002_snapshot.json
··· 1 - { 2 - "version": "6", 3 - "dialect": "sqlite", 4 - "id": "d53a3c1c-688b-4aed-a866-be1a3366eda4", 5 - "prevId": "69fbc25d-9d45-43d4-973b-b6bcd6148bb3", 6 - "tables": { 7 - "labeler_cursors": { 8 - "name": "labeler_cursors", 9 - "columns": { 10 - "labeler_id": { 11 - "name": "labeler_id", 12 - "type": "text", 13 - "primaryKey": false, 14 - "notNull": false, 15 - "autoincrement": false 16 - }, 17 - "cursor": { 18 - "name": "cursor", 19 - "type": "integer", 20 - "primaryKey": false, 21 - "notNull": true, 22 - "autoincrement": false 23 - } 24 - }, 25 - "indexes": { 26 - "labeler_cursors_labeler_id_unique": { 27 - "name": "labeler_cursors_labeler_id_unique", 28 - "columns": [ 29 - "labeler_id" 30 - ], 31 - "isUnique": true 32 - } 33 - }, 34 - "foreignKeys": {}, 35 - "compositePrimaryKeys": {}, 36 - "uniqueConstraints": {}, 37 - "checkConstraints": {} 38 - }, 39 - "labels_applied": { 40 - "name": "labels_applied", 41 - "columns": { 42 - "id": { 43 - "name": "id", 44 - "type": "integer", 45 - "primaryKey": true, 46 - "notNull": true, 47 - "autoincrement": true 48 - }, 49 - "did": { 50 - "name": "did", 51 - "type": "text", 52 - "primaryKey": false, 53 - "notNull": true, 54 - "autoincrement": false 55 - }, 56 - "label": { 57 - "name": "label", 58 - "type": "text", 59 - "primaryKey": false, 60 - "notNull": true, 61 - "autoincrement": false 62 - }, 63 - "action": { 64 - "name": "action", 65 - "type": "text", 66 - "primaryKey": false, 67 - "notNull": true, 68 - "autoincrement": false 69 - }, 70 - "date_applied": { 71 - "name": "date_applied", 72 - "type": "integer", 73 - "primaryKey": false, 74 - "notNull": true, 75 - "autoincrement": false 76 - } 77 - }, 78 - "indexes": {}, 79 - "foreignKeys": { 80 - "labels_applied_did_watched_repos_did_fk": { 81 - "name": "labels_applied_did_watched_repos_did_fk", 82 - "tableFrom": "labels_applied", 83 - "tableTo": "watched_repos", 84 - "columnsFrom": [ 85 - "did" 86 - ], 87 - "columnsTo": [ 88 - "did" 89 - ], 90 - "onDelete": "no action", 91 - "onUpdate": "no action" 92 - } 93 - }, 94 - "compositePrimaryKeys": {}, 95 - "uniqueConstraints": {}, 96 - "checkConstraints": {} 97 - }, 98 - "watched_repos": { 99 - "name": "watched_repos", 100 - "columns": { 101 - "did": { 102 - "name": "did", 103 - "type": "text", 104 - "primaryKey": true, 105 - "notNull": true, 106 - "autoincrement": false 107 - }, 108 - "pds_host": { 109 - "name": "pds_host", 110 - "type": "text", 111 - "primaryKey": false, 112 - "notNull": true, 113 - "autoincrement": false 114 - }, 115 - "active": { 116 - "name": "active", 117 - "type": "integer", 118 - "primaryKey": false, 119 - "notNull": true, 120 - "autoincrement": false 121 - }, 122 - "date_first_seen": { 123 - "name": "date_first_seen", 124 - "type": "integer", 125 - "primaryKey": false, 126 - "notNull": true, 127 - "autoincrement": false 128 - } 129 - }, 130 - "indexes": { 131 - "watched_repos_did_unique": { 132 - "name": "watched_repos_did_unique", 133 - "columns": [ 134 - "did" 135 - ], 136 - "isUnique": true 137 - } 138 - }, 139 - "foreignKeys": {}, 140 - "compositePrimaryKeys": {}, 141 - "uniqueConstraints": {}, 142 - "checkConstraints": {} 143 - } 144 - }, 145 - "views": {}, 146 - "enums": {}, 147 - "_meta": { 148 - "schemas": {}, 149 - "tables": {}, 150 - "columns": {} 151 - }, 152 - "internal": { 153 - "indexes": {} 154 - } 155 - }
-163
drizzle/meta/0003_snapshot.json
··· 1 - { 2 - "version": "6", 3 - "dialect": "sqlite", 4 - "id": "c01e52ce-5a45-4633-9fa4-0c85803cf3d8", 5 - "prevId": "d53a3c1c-688b-4aed-a866-be1a3366eda4", 6 - "tables": { 7 - "labeler_cursors": { 8 - "name": "labeler_cursors", 9 - "columns": { 10 - "labeler_id": { 11 - "name": "labeler_id", 12 - "type": "text", 13 - "primaryKey": false, 14 - "notNull": false, 15 - "autoincrement": false 16 - }, 17 - "cursor": { 18 - "name": "cursor", 19 - "type": "integer", 20 - "primaryKey": false, 21 - "notNull": true, 22 - "autoincrement": false 23 - } 24 - }, 25 - "indexes": { 26 - "labeler_cursors_labeler_id_unique": { 27 - "name": "labeler_cursors_labeler_id_unique", 28 - "columns": [ 29 - "labeler_id" 30 - ], 31 - "isUnique": true 32 - } 33 - }, 34 - "foreignKeys": {}, 35 - "compositePrimaryKeys": {}, 36 - "uniqueConstraints": {}, 37 - "checkConstraints": {} 38 - }, 39 - "labels_applied": { 40 - "name": "labels_applied", 41 - "columns": { 42 - "id": { 43 - "name": "id", 44 - "type": "integer", 45 - "primaryKey": true, 46 - "notNull": true, 47 - "autoincrement": true 48 - }, 49 - "did": { 50 - "name": "did", 51 - "type": "text", 52 - "primaryKey": false, 53 - "notNull": true, 54 - "autoincrement": false 55 - }, 56 - "label": { 57 - "name": "label", 58 - "type": "text", 59 - "primaryKey": false, 60 - "notNull": true, 61 - "autoincrement": false 62 - }, 63 - "action": { 64 - "name": "action", 65 - "type": "text", 66 - "primaryKey": false, 67 - "notNull": true, 68 - "autoincrement": false 69 - }, 70 - "negated": { 71 - "name": "negated", 72 - "type": "integer", 73 - "primaryKey": false, 74 - "notNull": true, 75 - "autoincrement": false, 76 - "default": 0 77 - }, 78 - "date_applied": { 79 - "name": "date_applied", 80 - "type": "integer", 81 - "primaryKey": false, 82 - "notNull": true, 83 - "autoincrement": false 84 - } 85 - }, 86 - "indexes": {}, 87 - "foreignKeys": { 88 - "labels_applied_did_watched_repos_did_fk": { 89 - "name": "labels_applied_did_watched_repos_did_fk", 90 - "tableFrom": "labels_applied", 91 - "tableTo": "watched_repos", 92 - "columnsFrom": [ 93 - "did" 94 - ], 95 - "columnsTo": [ 96 - "did" 97 - ], 98 - "onDelete": "no action", 99 - "onUpdate": "no action" 100 - } 101 - }, 102 - "compositePrimaryKeys": {}, 103 - "uniqueConstraints": {}, 104 - "checkConstraints": {} 105 - }, 106 - "watched_repos": { 107 - "name": "watched_repos", 108 - "columns": { 109 - "did": { 110 - "name": "did", 111 - "type": "text", 112 - "primaryKey": true, 113 - "notNull": true, 114 - "autoincrement": false 115 - }, 116 - "pds_host": { 117 - "name": "pds_host", 118 - "type": "text", 119 - "primaryKey": false, 120 - "notNull": true, 121 - "autoincrement": false 122 - }, 123 - "active": { 124 - "name": "active", 125 - "type": "integer", 126 - "primaryKey": false, 127 - "notNull": true, 128 - "autoincrement": false 129 - }, 130 - "date_first_seen": { 131 - "name": "date_first_seen", 132 - "type": "integer", 133 - "primaryKey": false, 134 - "notNull": true, 135 - "autoincrement": false 136 - } 137 - }, 138 - "indexes": { 139 - "watched_repos_did_unique": { 140 - "name": "watched_repos_did_unique", 141 - "columns": [ 142 - "did" 143 - ], 144 - "isUnique": true 145 - } 146 - }, 147 - "foreignKeys": {}, 148 - "compositePrimaryKeys": {}, 149 - "uniqueConstraints": {}, 150 - "checkConstraints": {} 151 - } 152 - }, 153 - "views": {}, 154 - "enums": {}, 155 - "_meta": { 156 - "schemas": {}, 157 - "tables": {}, 158 - "columns": {} 159 - }, 160 - "internal": { 161 - "indexes": {} 162 - } 163 - }
+2 -23
drizzle/meta/_journal.json
··· 5 5 { 6 6 "idx": 0, 7 7 "version": "6", 8 - "when": 1771556897599, 9 - "tag": "0000_tidy_prima", 10 - "breakpoints": true 11 - }, 12 - { 13 - "idx": 1, 14 - "version": "6", 15 - "when": 1771593593688, 16 - "tag": "0001_faithful_shard", 17 - "breakpoints": true 18 - }, 19 - { 20 - "idx": 2, 21 - "version": "6", 22 - "when": 1771611742268, 23 - "tag": "0002_greedy_dormammu", 24 - "breakpoints": true 25 - }, 26 - { 27 - "idx": 3, 28 - "version": "6", 29 - "when": 1771613785897, 30 - "tag": "0003_kind_the_liberteens", 8 + "when": 1771615394802, 9 + "tag": "0000_crazy_wallflower", 31 10 "breakpoints": true 32 11 } 33 12 ]
+1
package.json
··· 16 16 "packageManager": "pnpm@10.28.2", 17 17 "dependencies": { 18 18 "@atcute/atproto": "^3.1.10", 19 + "@atcute/client": "^4.2.1", 19 20 "@atcute/firehose": "^0.1.0", 20 21 "@libsql/client": "^0.17.0", 21 22 "drizzle-orm": "^0.45.1",
+25
pnpm-lock.yaml
··· 11 11 '@atcute/atproto': 12 12 specifier: ^3.1.10 13 13 version: 3.1.10 14 + '@atcute/client': 15 + specifier: ^4.2.1 16 + version: 4.2.1 14 17 '@atcute/firehose': 15 18 specifier: ^0.1.0 16 19 version: 0.1.0 ··· 54 57 '@atcute/cid@2.4.1': 55 58 resolution: {integrity: sha512-bwhna69RCv7yetXudtj+2qrMPYvhhIQqvJz6YUpUS98v7OdF3X2dnye9Nig2NDrklZcuyOsu7sQo7GOykJXRLQ==} 56 59 60 + '@atcute/client@4.2.1': 61 + resolution: {integrity: sha512-ZBFM2pW075JtgGFu5g7HHZBecrClhlcNH8GVP9Zz1aViWR+cjjBsTpeE63rJs+FCOHFYlirUyo5L8SGZ4kMINw==} 62 + 57 63 '@atcute/firehose@0.1.0': 58 64 resolution: {integrity: sha512-xBEKdi6rkODpCIIRpXtXhhcuQ1vTbufDykAM2kA6bmWEpuwI4acoUCg9zbiUWqd21SMMOAthu9Eh72i2VYrD7A==} 65 + 66 + '@atcute/identity@1.1.3': 67 + resolution: {integrity: sha512-oIqPoI8TwWeQxvcLmFEZLdN2XdWcaLVtlm8pNk0E72As9HNzzD9pwKPrLr3rmTLRIoULPPFmq9iFNsTeCIU9ng==} 59 68 60 69 '@atcute/lexicons@1.2.9': 61 70 resolution: {integrity: sha512-/RRHm2Cw9o8Mcsrq0eo8fjS9okKYLGfuFwrQ0YoP/6sdSDsXshaTLJsvLlcUcaDaSJ1YFOuHIo3zr2Om2F/16g==} ··· 68 77 69 78 '@atcute/util-text@1.1.1': 70 79 resolution: {integrity: sha512-JH0SxzUQJAmbOBTYyhxQbkkI6M33YpjlVLEcbP5GYt43xgFArzV0FJVmEpvIj0kjsmphHB45b6IitdvxPdec9w==} 80 + 81 + '@badrap/valita@0.4.6': 82 + resolution: {integrity: sha512-4kdqcjyxo/8RQ8ayjms47HCWZIF5981oE5nIenbfThKDxWXtEHKipAOWlflpPJzZx9y/JWYQkp18Awr7VuepFg==} 83 + engines: {node: '>= 18'} 71 84 72 85 '@drizzle-team/brocli@0.10.2': 73 86 resolution: {integrity: sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==} ··· 864 877 '@atcute/multibase': 1.1.8 865 878 '@atcute/uint8array': 1.1.1 866 879 880 + '@atcute/client@4.2.1': 881 + dependencies: 882 + '@atcute/identity': 1.1.3 883 + '@atcute/lexicons': 1.2.9 884 + 867 885 '@atcute/firehose@0.1.0': 868 886 dependencies: 869 887 '@atcute/cbor': 2.3.2 ··· 874 892 partysocket: 1.1.13 875 893 type-fest: 4.41.0 876 894 895 + '@atcute/identity@1.1.3': 896 + dependencies: 897 + '@atcute/lexicons': 1.2.9 898 + '@badrap/valita': 0.4.6 899 + 877 900 '@atcute/lexicons@1.2.9': 878 901 dependencies: 879 902 '@atcute/uint8array': 1.1.1 ··· 890 913 '@atcute/util-text@1.1.1': 891 914 dependencies: 892 915 unicode-segmenter: 0.14.5 916 + 917 + '@badrap/valita@0.4.6': {} 893 918 894 919 '@drizzle-team/brocli@0.10.2': {} 895 920
+1 -1
src/db/schema.ts
··· 15 15 .references(() => watchedRepos.did), 16 16 label: text("label").notNull(), 17 17 action: text("action").notNull(), 18 - negated: integer("negated").default(0).notNull(), 18 + negated: integer("negated", { mode: "boolean" }).default(false).notNull(), 19 19 dateApplied: integer("date_applied", { mode: "timestamp" }).notNull(), 20 20 }); 21 21
+14 -4
src/index.ts
··· 4 4 import { parse } from "smol-toml"; 5 5 import PQueue from "p-queue"; 6 6 import { labelerSubscriber } from "./handlers/lablerSubscriber.js"; 7 - import type { Settings } from "./types/settings.js"; 7 + import type { PDSConfig, Settings } from "./types/settings.js"; 8 8 import { logger } from "./logger.js"; 9 9 import { labelerCursor } from "./db/schema.js"; 10 + import { backFillPds } from "./pds.js"; 10 11 11 - const queue = new PQueue({ concurrency: 2 }); 12 + const labelQueue = new PQueue({ concurrency: 2 }); 13 + const identityQueue = new PQueue({ concurrency: 2 }); 12 14 13 15 // TODO 14 16 // 1. Figure out a schema for settings we want. PDSs to watch.Labelers and their Labels ··· 25 27 //TODO I really really don't like this unknown to settings. Figure that out later. Cause. It does work >.> 26 28 const settings = parse(settingsFile) as unknown as Settings; 27 29 30 + let pdsConfigs = Object.entries(settings.pds).map(([_, config]) => config); 31 + 32 + for (const config of pdsConfigs) { 33 + if (config.backfillAccounts) { 34 + await backFillPds(config, identityQueue); 35 + } 36 + } 37 + 28 38 // Gets the last saved cursors for Labelers from db for resume 29 39 const lastCursors = await db.select().from(labelerCursor); 30 40 ··· 35 45 (cursor) => cursor.labelerId === config.host, 36 46 ); 37 47 let lastCursor = lastCursorRow?.cursor ?? undefined; 38 - return labelerSubscriber(config, lastCursor, db, queue); 48 + return labelerSubscriber(config, lastCursor, db, labelQueue); 39 49 }); 40 50 41 51 // Graceful shutdown ··· 46 56 subscribers.forEach((close) => close()); 47 57 48 58 logger.info("Draining the queue..."); 49 - await queue.onIdle(); 59 + await labelQueue.onIdle(); 50 60 51 61 logger.info("Clean shutdown complete."); 52 62 process.exit(0);
+28
src/pds.ts
··· 1 + import type PQueue from "p-queue"; 2 + import type { PDSConfig } from "./types/settings.js"; 3 + import type {} from "@atcute/atproto"; 4 + import { Client, simpleFetchHandler, ok } from "@atcute/client"; 5 + 6 + export const backFillPds = async (config: PDSConfig, queue: PQueue) => { 7 + const rpc = new Client({ 8 + handler: simpleFetchHandler({ service: `https://${config.host}` }), 9 + }); 10 + 11 + let cursor = undefined; 12 + 13 + do { 14 + let result = await ok( 15 + rpc.get("com.atproto.sync.listRepos", { 16 + params: { 17 + limit: 1000, 18 + cursor, 19 + }, 20 + }), 21 + ); 22 + 23 + cursor = result.cursor; 24 + for (let repo of result.repos) { 25 + console.log(repo.did); 26 + } 27 + } while (cursor); 28 + };
+5 -1
src/types/settings.ts
··· 4 4 host: string; 5 5 emails: string[]; 6 6 pdsAdminPassword: string; 7 + backfillAccounts: boolean; 8 + listenForNewAccounts: boolean; 7 9 } 8 10 9 11 export type LabelAction = "notify" | "takedown"; ··· 15 17 16 18 export interface LabelerConfig { 17 19 host: string; 20 + // If set to true and no previous cursor is found it starts from 0 21 + backfillLabels: boolean; 18 22 labels: Record<string, LabelConfig>; 19 23 } 20 24 ··· 25 29 }; 26 30 }; 27 31 labeler: Record<string, LabelerConfig>; 28 - pds: Record<LabelAction, PDSConfig>; 32 + pds: Record<string, PDSConfig>; 29 33 }
+1 -1
tsconfig.json
··· 9 9 // See also https://aka.ms/tsconfig/module 10 10 "module": "nodenext", 11 11 "target": "esnext", 12 - "types": ["node"], 12 + "types": ["node", "@atcute/atproto"], 13 13 // For nodejs: 14 14 // "lib": ["esnext"], 15 15 // "types": ["node"],