Basically wrote the whole thing.

This commit is contained in:
Aodhan
2025-06-25 04:21:13 +01:00
parent 1ff4a6f6d7
commit c5391a957d
216 changed files with 168676 additions and 1303 deletions

View File

@@ -6,31 +6,51 @@ A web application for sorting and organizing images using swipe gestures, simila
- **Swipe Interface**: Swipe images in four directions (left, right, up, down) to categorize them
- **Full-size Image View**: Click on any image to view it in full resolution with metadata
- **History Page**: View all your past selections with filtering options
- **History Page**: View all your past selections with rich filtering and sort options
- **NSFW Filtering**: Toggle to include/exclude NSFW images on both the main swiper and history pages
- **NSFW Blur**: Optional blur for NSFW thumbnails on the history page with a toolbar toggle
- **Orientation & Action Filters**: Filter results by orientation (portrait/landscape/square) and by action taken
- **Database Storage**: All selections are saved in a SQLite database
- **Reset Functionality**: Option to clear all selections and start fresh
## File Structure
- `app.py`: Python server that handles API requests and serves files
- `server.py`: Entry point that starts the HTTP server
- `handler.py`: HTTP request handler implementing all API endpoints
- `database.py`: SQLite helpers (initialisation, queries, sync)
- `config.py`: Centralised constants (paths, port)
- `index.html`: Main page with the swipe interface
- `history.html`: Page to view and manage past selections
- `script.js`: JavaScript for the swipe functionality and UI interactions
- `js/`: Front-end JavaScript (`main.js`, `utils.js`, etc.)
- `styles.css`: CSS styling for the application
- `update_nsfw_flags.py`: Utility script to (re)calculate NSFW flags for existing images after changing keyword lists
## How to Use
1. Run the server: `python app.py`
1. Run the server: `python server.py`
2. Open a web browser and navigate to `http://localhost:8000`
3. Swipe images or use the buttons to categorize them:
3. Use the on-screen buttons or swipe gestures to categorize images:
- Left: Discard
- Right: Keep
- Up: Favorite
- Down: Review Later
4. Click on an image to view it in full resolution
5. Use the "View History" link to see all your selections
5. Use the "View History" link to see all your selections. The toolbar lets you:
- Filter by action/orientation/NSFW status
- Toggle blur of NSFW thumbnails
- Sort by creation date, swipe date or resolution
6. Use the "Reset Database" button in the history page to clear all selections
## NSFW Detection & Maintenance
NSFW status is inferred from prompt keywords defined in `config.py` (`NSFW_KEYWORDS`).
After changing the keyword list or adding new images you can refresh the database flags:
```bash
python update_nsfw_flags.py
```
This will reset and recalculate all `nsfw` flags so that the new filters work correctly.
## Requirements
- Python 3.x