Go to file
Tanishq Dubey 5b0b30d69c
All checks were successful
Docker Build and Publish / build (push) Successful in 6s
Docker Build and Publish / build (release) Successful in 7s
Fix CSP Error
Getting rid of inline onclick calls and registering the handler in the
primary script ensure securty (XSS).
2024-12-08 18:03:44 -05:00
.gitea/workflows Add release process 2024-11-05 23:49:09 -05:00
templates Fix CSP Error 2024-12-08 18:03:44 -05:00
.gitignore More frontend changes, ready for deploy 2024-11-05 19:25:52 -05:00
app.py EXIF Error handling 2024-11-14 18:56:46 -05:00
config.example.toml Checkpoint, configuration can now be done through DB and the site. Server settings are still on the file system 2024-11-05 19:03:04 -05:00
config.py Checkpoint, configuration can now be done through DB and the site. Server settings are still on the file system 2024-11-05 19:03:04 -05:00
docker-compose.yml More frontend changes, ready for deploy 2024-11-05 19:25:52 -05:00
Dockerfile ready for prod 2024-11-05 14:02:21 -05:00
Makefile Fix startup and init 2024-11-05 15:03:32 -05:00
models.py Checkpoint, configuration can now be done through DB and the site. Server settings are still on the file system 2024-11-05 19:03:04 -05:00
pyvenv.cfg checkpt 2024-11-05 13:55:44 -05:00
README.md Add release process 2024-11-05 23:49:09 -05:00
requirements.txt fix requirements 2024-11-05 14:54:20 -05:00
steganography.py Checkpoint, configuration can now be done through DB and the site. Server settings are still on the file system 2024-11-05 19:03:04 -05:00

Spectra

A variation on the masonry grid image gallery with the row alighment constraint removed. Oh, it also has an admin interface so you can set it up and forget it.

Features

  • Color Analysis: Automatically extracts color palettes from images to create cohesive galleries
  • Smart Thumbnails: Generates and caches responsive thumbnails in multiple sizes
  • EXIF Preservation: Maintains all photo metadata through processing
  • Ownership Verification: Embeds steganographic proofs in images
  • Live Configuration: Hot-reload config changes without restarts
  • Production Ready: Fully Dockerized with Traefik integration

Quick Start

Local Development

Clone the repository

git clone https://git.dws.rip/your-username/spectra
cd spectra

Set up Python virtual environment

python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows

Install dependencies

pip install -r requirements.txt

Create config from template

cp config.example.toml config.toml

Run development server

python app.py

Production Deployment

Create required network

docker network create traefik-public

Configure your domain

sed -i 's/photos.dws.rip/your.domain.here/g' docker-compose.yml

Launch

docker-compose up -d

Configuration

Essential Settings

[server]
host = "0.0.0.0"
port = 5000
[security]
max_upload_size_mb = 80
rate_limit = 100 # requests per minute
[admin]
password = "change-this-password" # Required

See config.example.toml for all available options.

Directory Structure

spectra/
├── app.py # Application entry point
├── config.py # Configuration management
├── models.py # Database models
├── steganography.py # Image verification
├── templates/ # Jinja2 templates
├── uploads/ # Original images
└── thumbnails/ # Generated thumbnails

API Reference

Endpoints

Public Endpoints

  • GET / - Main gallery view
  • GET /api/images - Get paginated image list
  • GET /verify/<filename> - Verify image authenticity

Admin Endpoints

  • POST /admin/login - Admin authentication
  • POST /admin/upload - Upload new images
  • POST /admin/update_photo/<id> - Update image metadata
  • POST /admin/delete_photo/<id> - Delete image

Environment Variables

  • FLASK_ENV: Set to 'production' in production
  • WORKERS: Number of Gunicorn workers (default: 4)
  • PORT: Override default port (default: 5000)

Release Process

To create a release:

  • Create and push a tag: git tag v1.0.0 && git push origin v1.0.0
  • Create a release in Gitea UI using that tag
  • The workflow will build and push the Docker image with appropriate version tags
  • The Docker image will be available at: git.dws.rip/your-repo/image:v1.0.0