bud-09 implemented

This commit is contained in:
Your Name
2025-09-03 15:21:48 -04:00
parent 17bb57505e
commit 21fc43167c
13 changed files with 25814 additions and 71 deletions

View File

@@ -47,7 +47,7 @@ ginxsom implements the following Blossom Upgrade Documents (BUDs):
- [x] **BUD-06**: Upload Requirements
- [ ] **BUD-07**: Payment Integration *(Not implemented)*
- [x] **BUD-08**: NIP-94 File Metadata Tags
- [ ] **BUD-09**: Content Reporting *(Partial)*
- [x] **BUD-09**: Content Reporting
### Supported Endpoints
@@ -56,9 +56,11 @@ ginxsom implements the following Blossom Upgrade Documents (BUDs):
| `/<sha256>` | GET | Retrieve blob | nginx → disk | ✅ **Implemented** |
| `/<sha256>` | HEAD | Check blob exists | nginx → FastCGI ginxsom | ✅ **Implemented** |
| `/upload` | PUT | Upload new blob | nginx → FastCGI ginxsom | ✅ **Implemented** |
| `/upload` | HEAD | Check upload requirements | nginx → FastCGI ginxsom | **BUD-06 Planned** |
| `/upload` | HEAD | Check upload requirements | nginx → FastCGI ginxsom | **Implemented** |
| `/list/<pubkey>` | GET | List user's blobs | nginx → FastCGI ginxsom | ✅ **Implemented** |
| `/<sha256>` | DELETE | Delete blob | nginx → FastCGI ginxsom | ✅ **Recently Added** |
| `/<sha256>` | DELETE | Delete blob | nginx → FastCGI ginxsom | ✅ **Implemented** |
| `/mirror` | PUT | Mirror blob from URL | nginx → FastCGI ginxsom | ✅ **Implemented** |
| `/report` | PUT | Report blob content | nginx → FastCGI ginxsom | ✅ **Implemented** |
## Installation
@@ -301,6 +303,72 @@ Successful uploads return blob descriptors with optional NIP-94 metadata:
The `nip94` field is included by default but can be disabled via server configuration.
### Content Reporting (BUD-09)
ginxsom implements BUD-09 Content Reporting using NIP-56 report events for moderating inappropriate content. Users can submit cryptographically signed reports about blobs containing objectionable material.
#### Report Event Structure
Reports use NIP-56 kind 1984 events with the following structure:
```json
{
"kind": 1984,
"content": "This content violates community guidelines",
"tags": [
["x", "b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553", "nudity"],
["x", "a8472f6d93e42c1e5b4e6f9a1b3c8d4e6f9a1b3c5d7e8f0a1b2c3d4e5f6a7b8", "spam"]
],
"created_at": 1725105921,
"pubkey": "reporter_public_key",
"id": "event_id",
"sig": "cryptographic_signature"
}
```
#### Supported Report Types
- **nudity**: Adult or sexually explicit content
- **malware**: Malicious software or files
- **profanity**: Offensive language or content
- **illegal**: Content that violates laws
- **spam**: Unwanted promotional content
- **impersonation**: Content impersonating others
- **other**: Any other inappropriate content
- **extensible**: Unknown types are accepted per NIP-56
#### Report Submission
Submit reports to the `/report` endpoint:
```bash
# Generate report with nak tool
REPORT=$(nak event -k 1984 -c "Report description" -t "x=deadbeef...;nudity")
# Submit report
curl -X PUT http://localhost:9001/report \
-H "Content-Type: application/json" \
-d "$REPORT"
```
#### Response Format
Successful reports return confirmation:
```json
{
"message": "Report received",
"reported_blobs": 2,
"reporter": "reporter_pubkey_bytes"
}
```
Error responses include specific error codes:
- `invalid_json`: Malformed JSON
- `invalid_report_event`: Invalid NIP-56 structure
- `no_blob_hashes`: Missing valid SHA-256 hashes
- `unsupported_media_type`: Non-JSON Content-Type
## File Storage
### Current (Flat) Structure