feat: add flaskpaste plugin with paste/shorten commands

- PoW-authenticated paste creation and URL shortening via FlaskPaste
- !paste <text> creates a paste, !shorten <url> shortens a URL
- Module-level shorten_url/create_paste helpers for cross-plugin use
- Alert plugin auto-shortens URLs in announcements and history output
- Custom TLS CA cert support via secrets/flaskpaste/derp.crt
- No SOCKS proxy -- direct urllib.request to FlaskPaste instance
This commit is contained in:
user
2026-02-16 23:10:59 +01:00
parent 35acc744ac
commit 3cdc00c285
5 changed files with 294 additions and 0 deletions

View File

@@ -273,6 +273,16 @@ API keys: set `ABUSEIPDB_API_KEY` / `VIRUSTOTAL_API_KEY` env vars or
configure in `config/derp.toml` under `[abuseipdb]` / `[virustotal]`.
VT rate limit: 4 req/min. Email check: max 5, admin only.
## FlaskPaste
```
!paste some text here # Create paste, get URL
!shorten https://long-url.com/x # Shorten URL
```
Auto-shortens URLs in `!alert` announcements and history when plugin is loaded.
Config: `[flaskpaste]` in `config/derp.toml` or `FLASKPASTE_URL` env var.
### Data Setup
```bash

View File

@@ -131,6 +131,8 @@ format = "text" # Log format: "text" (default) or "json"
| `!abuse <ip> report <cats> <comment>` | Report IP to AbuseIPDB (admin) |
| `!vt <hash\|ip\|domain\|url>` | VirusTotal lookup |
| `!emailcheck <email> [email2 ...]` | SMTP email verification (admin) |
| `!paste <text>` | Create a paste on FlaskPaste |
| `!shorten <url>` | Shorten a URL via FlaskPaste |
### Command Shorthand
@@ -845,3 +847,49 @@ bad@example.com -- SMTP 550 User unknown (mx: mail.example.com)
- Raw SMTP via SOCKS5 proxy: EHLO, MAIL FROM:<>, RCPT TO, QUIT
- 15-second timeout per connection
- Max 5 emails per invocation
### `!paste` -- Create Paste
Upload text to FlaskPaste and get a shareable URL.
```
!paste some long text here
```
Output format:
```
https://paste.mymx.me/abc12345
```
- PoW challenge (difficulty 20) solved per request
- Content sent as JSON body to FlaskPaste API
- No API key needed -- PoW is the auth mechanism
- Raw content available at `<paste_url>/raw`
### `!shorten` -- Shorten URL
Shorten a URL via FlaskPaste's URL shortener.
```
!shorten https://very-long-url.example.com/path/to/resource
```
Output format:
```
https://paste.mymx.me/s/AbCdEfGh
```
- URL must start with `http://` or `https://`
- PoW challenge (difficulty 20) solved per request
- Also used internally by `!alert` to shorten announcement URLs
### FlaskPaste Configuration
```toml
[flaskpaste]
url = "https://paste.mymx.me" # or set FLASKPASTE_URL env var
```
TLS: custom CA cert at `secrets/flaskpaste/derp.crt` loaded automatically.