Overview
The moderation system provides:Report management
Track and process user-submitted content reports
Content filtering
Automatically hide reported or filtered posts
User authentication
Role-based access with admin and moderator permissions
Multi-interface access
Moderate via web UI, REST API, or CLI
Authentication
Moderation requires authentication. Three interfaces are supported:Web authentication
Cookie-based sessions are used for web authentication. HTTPS is required unless
moderation.auth.cookie_secure=false in configuration.API authentication
API access uses bearer token authentication:CLI access
Command-line tools require no authentication since they run directly on the server:User management
Administrators can create and manage moderator accounts:Default credentials
The default admin account is created on first startup:- Username:
admin - Password:
admin(or configured value fromconfig.toml)
User roles
Administrator- Full system access
- Create and manage users
- All moderation permissions
- Delete posts permanently
- Report management based on assigned permissions
- Hide/show posts
- Close reports
- Limited by permission flags
Permissions system
Granular permissions control what moderators can do:report_read: View reportsreport_write: Modify report statuspost_hide: Hide posts from public viewpost_show: Restore hidden posts- Additional permissions for advanced features
Report system
Users can report inappropriate or illegal content:Submitting reports
Select category
Choose a report category:
- NSFW content on SFW board
- Illegal content
- DCMA violation
- Spam
- Other violations
Report submissions are rate limited to 4 reports per hour per IP address
Report behavior
When a post is reported:- Report record created: Stored in moderation database with submitter IP, category, and notes
- Automatic hiding (optional): If
hide_post_if_reportedis enabled, post media is immediately hidden - Threshold hiding (optional): If
n_reports_then_hideis set, posts are hidden after N reports - Filter cache update: Hidden posts are added to the filter cache (Redis or SQLite)
Viewing reports
Moderators can view reports in the web interface: Open reports:/reports/open
- Active reports requiring attention
- Paginated view (20 per page)
- Sortable and filterable
/reports/closed
- Resolved reports for reference
- Same pagination and filtering
Report details
Each report shows:- Post preview: Full post with media and content
- Report metadata: IP count, category, submitter notes
- Moderation notes: Internal notes for moderator collaboration
- Actions: Hide/show post, open/close report
- Links: View in thread, view on source (4chan/Lainchan)
Moderation actions
Moderators can perform several actions on reported posts:Post actions
Hide post
Hide post
Removes post from public view:
- Post marked as hidden in filter cache
- Regular users don’t see the post
- Moderators and admins still see it
- Reversible with “Show post” action
src/ayase_quart/blueprints/web/bp_moderation.py:239Show post
Show post
Restores a hidden post:
- Post becomes visible to all users
- Removes from filter cache
- Marks report as closed (optional)
src/ayase_quart/blueprints/web/bp_moderation.py:239Nuke post (admin only)
Nuke post (admin only)
Permanently deletes a post:
- Removes from database
- Cannot be undone
- Requires admin privileges
src/ayase_quart/blueprints/web/bp_moderation.py:49Report actions
Close report
Close report
Marks report as resolved:
- Moves to closed reports list
- Post visibility unchanged
- Can be reopened later
Open report
Open report
Marks report as active:
- Moves to open reports list
- Requires moderator attention
Save moderation notes
Save moderation notes
Add internal notes:
- Visible only to moderators
- Document decisions and context
- Useful for collaboration
Bulk actions
Process multiple reports simultaneously:- Select reports: Check boxes next to reports
- Choose action: Hide/show posts or close/open reports
- Confirm: Apply action to all selected reports
src/ayase_quart/blueprints/web/bp_moderation.py:260
Filter cache
The filter cache tracks hidden posts for fast lookup:Cache backends
Redis
Recommended for production. Fast in-memory cache.
SQLite
Good for single-instance deployments.
Null
Disables filtering (not recommended).
Cache operations
- Insert post: Add post to hidden list
- Remove post: Remove from hidden list
- Check post: Verify if post is hidden
- Filter list: Remove hidden posts from result sets
Configuring Redis
For best performance, use Redis:Content filtering
Posts are filtered from view based on moderation status:Filter logic
When loading posts:- Query posts from database
- Check each post against filter cache
- Remove hidden posts (for regular users)
- Return filtered results
Filter points
Filtering occurs at:- Board index:
src/ayase_quart/blueprints/web/bp_app.py:101 - Thread view:
src/ayase_quart/blueprints/web/bp_app.py:295 - Catalog:
src/ayase_quart/blueprints/web/bp_app.py:215 - Search results:
src/ayase_quart/blueprints/web/bp_search.py:192 - API endpoints: All JSON responses
CLI tools
Manage moderation from the command line:View reports
Manage reports
Available actions
report_close: Close reportreport_open: Reopen reportpost_hide: Hide post from publicpost_show: Show hidden postpost_delete: Delete post (admin only)media_hide: Hide only mediamedia_show: Show hidden mediareport_save_notes: Update moderation notes
Security features
CSRF protection
All moderation actions require CSRF tokens:- Tokens generated per-session
- Validated on form submission
- Prevents cross-site request forgery
src/ayase_quart/security/captcha.py
Rate limiting
- Report submissions: 4 per hour per IP
- Search requests: 5 per minute per IP
- Configurable limits for other endpoints
SSL/TLS requirement
For production:- HTTPS required for cookie security
- SSL certificates in
cert.pemandkey.pem - Generate with:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
Configuration
Key moderation settings inconfig.toml:
API endpoints
Moderation APIs (require authentication):POST /nuke/<board>/<num>: Delete post (admin only)POST /report/<board>/<thread_num>/<num>: Submit reportGET /reports/open: List open reportsGET /reports/closed: List closed reportsPOST /reports/<report_id>/<action>: Perform moderation actionPOST /reports/bulk/<action>: Bulk moderation actions
- Moderation init:
src/ayase_quart/moderation/__init__.py:8 - Web routes:
src/ayase_quart/blueprints/web/bp_moderation.py:46 - API routes:
src/ayase_quart/blueprints/api/bp_moderation.py - Report system:
src/ayase_quart/moderation/report.py