A fast and efficient image sharing server built with Bun and SQLite.
When using test.js, you have to disable rate limiting on index.js to use.
- Two main routes:
/new
for uploading and/existing
for retrieving - You will need a cloudflare origin server cert, key, and ca to use, for https.
- SQLite database with Write-Ahead Logging (WAL) for improved performance
- Rate limiting to prevent abuse
- Turnstile integration for spam prevention
- Duplicate image detection
- Configurable sharing options
-
Rate Limit
IP
: text (primary key)expiry
: number
-
Image Hashes
Hash
: text (primary key)Added_by_ip
: textAdded_ts
: text
-
Share Links
link
: text (primary key)Hash
: textoptions
: textviewed
: number
Note: All links are 10 characters long
Uploads an image with options and returns a share link.
image
: bloboptions
: JSONturnstile_response
: text
- Check rate limit (15s) for user IP
- Validate Turnstile response
- Validate options
- Ensure image size < 0.5MB
- Hash image and check for duplicates
- Store new image or retrieve existing image ID
- Generate and return share link
Retrieves an image and its options using a share link.
share_key
: textturnstile_response
: text
- Check rate limit (15s) for user IP
- Validate Turnstile response
- Validate share key
- Retrieve image and options
- Return image and options
A background task runs every 15 seconds to clean up expired rate limit entries from the database.