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

reeadme and blacksky's labeler examples

+47 -12
+4 -2
.env.example
··· 1 1 DATABASE_URL=file:./label-watcher.db 2 + # for the docker compose 3 + # DATABASE_URL="file:/app/data/label-watcher.db" 2 4 MIGRATIONS_FOLDER=drizzle 3 - # Email sending: set RESEND_API_KEY to use Resend, or NOTIFY_SMTP_URL to use SMTP (one is required) 4 - RESEND_API_KEYb=123 5 + # Will always default to using resend if the API key is set 6 + # RESEND_API_KEY=123 5 7 NOTIFY_SMTP_URL=smtp://localhost:1025 6 8 NOTIFY_SENDER_EMAIL=yougotmail@pdsmoover.com 7 9 LOG_LEVEL=info
+14 -8
README.md
··· 2 2 3 3 Subscribes to multiple labelers that you set in your [settings.toml](settings.toml.example) along with which labels you would like to watch for. If it sees the label is applied to a user on one of the PDSs you configure it will take an action. Either notify you by email, or does an auto takedown of the account. 4 4 5 - The idea is we have some awesome labelers like [skywatch.blue](https://bsky.app/profile/skywatch.blue) and [Hailey's Labeler](https://bsky.app/profile/did:plc:saslbwamakedc4h6c5bmshvz) that are doing an amazing job of moderating already, but we do not have a way as PDS admins to be able to use these labels in an easy way. The hope is that this gives an easy way to use these resources to help moderate your PDS. Pick your labelers to subscribe to and which labels from it you would like to to watch for. Then set an action like notify to get an email when a label is applied to an account on your PDS, or can even do an auto takedown of the account(beta and recommend trying the notify action first to get a hang of what accounts gets the label you expect). 5 + The idea is we have some awesome labelers like [Blacksky's labeler](https://bsky.app/profile/moderation.blacksky.app), [Hailey's Labeler](https://bsky.app/profile/did:plc:saslbwamakedc4h6c5bmshvz), and [skywatch.blue](https://bsky.app/profile/skywatch.blue) that are doing an amazing job of moderating already, but we do not have a way as PDS admins to be able to use these labels in an easy way. The hope is that this gives an easy way to use these resources to help moderate your PDS. Pick your labelers to subscribe to and which labels from it you would like to to watch for. Then set an action like notify to get an email when a label is applied to an account on your PDS, or can even do an auto takedown of the account(beta and recommend trying the notify action first to get a hang of what accounts gets the label you expect). 6 6 7 7 I think it will be great for PDSs that also run their own labeler to be able to issue a label for takedowns allowing moderates of an org to have the ability to remotely do takedowns with out the need of the PDS admin password. Should also work at catching bot accounts since the labelers have gotten very good at it 8 8 9 9 10 10 11 11 # Setup 12 - Got some configs to setup. Use toml to set it up and have an example one at [settings.toml.example](./settings.toml.example). Here you can set 12 + Got some configs to setup. We use toml to config the PDSs and labelers. There is an example one at [settings.toml.example](./settings.toml.example). Here you can set 13 13 - PDSs settings 14 14 - Can set the watch for multiple PDSs 15 15 - An array of email addresses to send the notifications to 16 16 - On startup should it query your PDS to find all the active accounts and add them to the watch list 17 - - Should it subscribe to your PDS to auto pick up new accounts (cursor resume does not work for this) 18 - - Admin password. This is the keys to your PDS so please use this with caution. label watcher does not require this. But it is needed for auto takedowns. 17 + - Should it subscribe to your PDS to auto pick up new accounts (cursor resume does not work for this since the startup backfill can usually handle most backfills) 18 + - Admin password. __This is the keys to your PDS so please use this with caution. label watcher does not require this__. But it is needed for auto takedowns. 19 19 - Which labelers and labels 20 20 - Can set multiple labelers 21 - - Backfill (should mostly be supported in my test) 22 - - Which label and which action to take when it is seen 21 + - Backfill (should mostly be supported in my test and does take a while to run) 22 + - Which labels and which action to take when it is seen. Can set as many as you want, make sure to match it to the labeler key. 23 23 24 - Also have a .env for some shared secrets at [.env.example](.env.example). 24 + Also have a .env for some shared secrets at [.env.example](.env.example). This sets up 25 + 26 + - How to email the notifications. Either via Resend's API or a smtp url like the PDS supports 27 + - Email address the email comes from 28 + - database location 29 + - migrations folder 30 + - logs level 25 31 26 32 27 33 Can use pnpm or npm and run with ··· 29 35 pnpm i 30 36 pnpm run start 31 37 ``` 32 - or can use the docker compose file with 38 + or can use the docker compose file with. This will build and run label-watcher as a docker container. No release image yet. 33 39 ```bash 34 40 docker compose up 35 41 ```
+27
settings.toml.example
··· 46 46 # [labeler.hailey.labels.suss-handle-change] 47 47 # label_name = "suss-handle-change" 48 48 # action = "notify" 49 + 50 + 51 + # Bluesky example to be notify on their needs-review or !takedowns 52 + # This is what blocks users from their appview 53 + # [labeler.bluesky] 54 + # host = "mod.bsky.app" 55 + 56 + # [labeler.bluesky.labels.spam] 57 + # label_name = "spam" 58 + # action = "notify" 59 + 60 + # [labeler.bluesky.labels.needs-review] 61 + # label_name = "needs-review" 62 + # action = "notify" 63 + 64 + # [labeler.bluesky.labels.takedown] 65 + # label_name = "!takedown" 66 + # action = "notify" 67 + 68 + 69 + # Blacksky example 70 + # [labeler.blacksky] 71 + # host = "mod.blackskyweb.xyz" 72 + 73 + # [labeler.blacksky.labels.violence] 74 + # label_name = "violence" 75 + # action = "notify"
+2 -2
src/handlers/handleNewLabel.ts
··· 74 74 throw new Error(`Watched repo: ${watchedRepo.did} config not found`); 75 75 } 76 76 77 - logger.debug( 77 + logger.info( 78 78 { label: label.val, action: labelConfig.action }, 79 79 `Listed label: ${label.val} found added to ${watchedRepo.did}`, 80 80 ); ··· 251 251 return; 252 252 } 253 253 254 - logger.warn( 254 + logger.debug( 255 255 { label: label.val, action: labelConfig.action }, 256 256 "Listed label found but repo is not watched. Skipping", 257 257 );