Skip to content

Commit a6dd3fc

Browse files
committed
initial commit for porn blocker pls leave me alone porn bots
0 parents  commit a6dd3fc

13 files changed

+887
-0
lines changed

.env.example

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Your Bluesky account credentials
2+
# Use an App Password from your account settings, not your main password
3+
BLUESKY_EMAIL=[email protected]
4+
BLUESKY_APP_PASSWORD=your-app-password
5+
6+
# Your moderation list details
7+
# Create a list at https://bsky.app/moderation/modlists
8+
# Blocklist name is the last part of the URL, e.g. 3lf3zw6vcbs2n
9+
BLOCKLIST_DID=did:plc:your-user-did
10+
BLOCKLIST_NAME=your-list-id

.gitignore

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2+
3+
# Logs
4+
5+
logs
6+
_.log
7+
npm-debug.log_
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Caches
14+
15+
.cache
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
19+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
20+
21+
# Runtime data
22+
23+
pids
24+
_.pid
25+
_.seed
26+
*.pid.lock
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
30+
lib-cov
31+
32+
# Coverage directory used by tools like istanbul
33+
34+
coverage
35+
*.lcov
36+
37+
# nyc test coverage
38+
39+
.nyc_output
40+
41+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42+
43+
.grunt
44+
45+
# Bower dependency directory (https://bower.io/)
46+
47+
bower_components
48+
49+
# node-waf configuration
50+
51+
.lock-wscript
52+
53+
# Compiled binary addons (https://nodejs.org/api/addons.html)
54+
55+
build/Release
56+
57+
# Dependency directories
58+
59+
node_modules/
60+
jspm_packages/
61+
62+
# Snowpack dependency directory (https://snowpack.dev/)
63+
64+
web_modules/
65+
66+
# TypeScript cache
67+
68+
*.tsbuildinfo
69+
70+
# Optional npm cache directory
71+
72+
.npm
73+
74+
# Optional eslint cache
75+
76+
.eslintcache
77+
78+
# Optional stylelint cache
79+
80+
.stylelintcache
81+
82+
# Microbundle cache
83+
84+
.rpt2_cache/
85+
.rts2_cache_cjs/
86+
.rts2_cache_es/
87+
.rts2_cache_umd/
88+
89+
# Optional REPL history
90+
91+
.node_repl_history
92+
93+
# Output of 'npm pack'
94+
95+
*.tgz
96+
97+
# Yarn Integrity file
98+
99+
.yarn-integrity
100+
101+
# dotenv environment variable files
102+
103+
.env
104+
.env.development.local
105+
.env.test.local
106+
.env.production.local
107+
.env.local
108+
109+
# parcel-bundler cache (https://parceljs.org/)
110+
111+
.parcel-cache
112+
113+
# Next.js build output
114+
115+
.next
116+
out
117+
118+
# Nuxt.js build / generate output
119+
120+
.nuxt
121+
dist
122+
123+
# Gatsby files
124+
125+
# Comment in the public line in if your project uses Gatsby and not Next.js
126+
127+
# https://nextjs.org/blog/next-9-1#public-directory-support
128+
129+
# public
130+
131+
# vuepress build output
132+
133+
.vuepress/dist
134+
135+
# vuepress v2.x temp and cache directory
136+
137+
.temp
138+
139+
# Docusaurus cache and generated files
140+
141+
.docusaurus
142+
143+
# Serverless directories
144+
145+
.serverless/
146+
147+
# FuseBox cache
148+
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
153+
.dynamodb/
154+
155+
# TernJS port file
156+
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
161+
.vscode-test
162+
163+
# yarn v2
164+
165+
.yarn/cache
166+
.yarn/unplugged
167+
.yarn/build-state.yml
168+
.yarn/install-state.gz
169+
.pnp.*
170+
171+
# IntelliJ based IDEs
172+
.idea
173+
174+
# Finder (MacOS) folder config
175+
.DS_Store

README.md

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Bluesky Blocker
2+
3+
A tool to automatically detect and block spam accounts on Bluesky by analyzing follower patterns and content.
4+
5+
## Features
6+
7+
- Automatically detects spam accounts using configurable patterns
8+
- Checks for suspicious follower/following ratios
9+
- Adds detected accounts to a list
10+
- Maintains a local database of checked followers
11+
- Debug mode for detailed pattern matching information
12+
13+
## Installation
14+
15+
1. Install Bun (sorry for the extra tool, but i used it for the sqlite):
16+
17+
- Visit https://bun.sh/ for installation instructions
18+
- Or run this command (macOS, Linux, WSL):
19+
```bash
20+
curl -fsSL https://bun.sh/install | bash
21+
```
22+
- Verify installation:
23+
```bash
24+
bun --version
25+
```
26+
27+
2. Clone the repository:
28+
29+
```bash
30+
git clone https://github.com/keith/bsky-blocker.git
31+
cd bsky-blocker
32+
```
33+
34+
2. Install dependencies:
35+
36+
```bash
37+
bun install
38+
```
39+
40+
## Configuration
41+
42+
1. Create a `.env` file in the project root (copy from `.env.example`):
43+
44+
```bash
45+
cp .env.example .env
46+
```
47+
48+
2. Set up your Bluesky credentials in `.env`:
49+
50+
```env
51+
52+
BLUESKY_APP_PASSWORD=your-app-password
53+
```
54+
55+
Note: Use an App Password, not your main account password. You can create one in your Bluesky account settings.
56+
57+
3. Create a moderation list on Bluesky:
58+
59+
- Go to https://bsky.app/moderation/modlists
60+
- Click "+ New"
61+
- Give it a name (e.g., "Spam Accounts")
62+
- After creating the list, copy the list ID from the URL
63+
- For example, if your list URL is `https://bsky.app/profile/username.bsky.social/lists/3jd92h5kw9s`, the ID is `3jd92h5kw9s`
64+
65+
4. Add your list ID to `.env`:
66+
67+
```env
68+
BLOCKLIST_ID=3jd92h5kw9s
69+
```
70+
71+
## Usage
72+
73+
### Check New Followers
74+
75+
To check your recent followers for spam accounts:
76+
77+
```bash
78+
bun run index.ts
79+
```
80+
81+
This will:
82+
83+
- Check your most recent followers
84+
- Apply spam detection patterns
85+
- Add matching accounts to your block list
86+
- Save results to a local database
87+
88+
### Test Patterns Against a Specific Account
89+
90+
To test your spam detection patterns against a specific account:
91+
92+
```bash
93+
bun run test-patterns.ts username.bsky.social
94+
```
95+
96+
This will show:
97+
98+
- Account information
99+
- Pattern matching results
100+
- Follow ratio analysis
101+
- Detailed debug information
102+
103+
### Debug Mode
104+
105+
To enable debug mode for detailed pattern matching information:
106+
107+
```typescript
108+
const blocker = new BlueskyBlocker(DEFAULT_PATTERNS, true);
109+
```
110+
111+
## Spam Detection
112+
113+
The tool does some basic checks to help spot potential spam accounts:
114+
115+
1. Simple text matching:
116+
117+
- Looks for promotional content in display names
118+
- Checks for certain types of links in descriptions
119+
- Spots common promotional phrases
120+
121+
2. Basic behavior checks:
122+
- Looks at the ratio of following vs followers
123+
- Checks for combinations of promo links and certain emojis
124+
125+
You can customize these checks in `patterns.ts`. They're pretty basic but help catch some of the more obvious spam accounts.
126+
127+
## Database
128+
129+
The tool maintains a SQLite database (`db.sqlite`) to track which followers have been checked. This prevents re-checking the same accounts multiple times.
130+
131+
## Contributing
132+
133+
Feel free to submit issues and pull requests for:
134+
135+
- New spam detection patterns
136+
- Bug fixes
137+
- Feature improvements
138+
139+
## License
140+
141+
MIT

0 commit comments

Comments
 (0)