Commit Graph

73 Commits

Author SHA1 Message Date
steve 4f675fe74c feat: display admin timestamps in America/Denver time
Convert UTC timestamps from SQLite to Mountain Time (America/Denver)
using a Jinja2 template filter backed by zoneinfo; add tzdata dependency
for IANA timezone data in the slim Docker image.
2026-03-28 22:58:37 -06:00
steve d5eac47ceb feat: apply TMDC brand fonts to guestbook page
Use Vollkorn 700 for headings and Open Sans for body text,
in line with The Montana Dinosaur Center style guide.
2026-03-11 18:05:08 -06:00
steve 9ebac80f35 feat: add webhook integration for new guestbook submissions
Posts signup data as JSON to WEBHOOK_URL (e.g. an n8n Webhook node)
in a daemon thread so it never blocks the visitor-facing response.
2026-03-11 15:30:31 -06:00
steve 2d4eac6583 refactor: migrate admin auth from HTTP Basic to Flask-Login sessions
Replaces browser-cached Basic Auth credentials with proper server-side
session management. Logout now fully invalidates the session. Adds an
HTML login form at /admin/login, SECRET_KEY env var support, and updates
README with key generation instructions and role table.
v2.3.0
2026-03-10 11:41:16 -06:00
steve 94d6690e57 fix: add logout button to admin pages 2026-03-10 10:39:10 -06:00
steve 4f0a7df22a feat: add role-based access control with database-backed users v2.2.0 2026-03-10 10:29:42 -06:00
steve b2e7eeb570 feat: add hardened HTTP Basic Auth for admin interface v2.1.0 2026-03-10 10:07:09 -06:00
steve 047f1a8c8b feat: add paginated admin interface for viewing and deleting entries 2026-03-10 09:57:28 -06:00
steve c2b6c1b460 fix: add Bearer token authentication to ntfy notification 2026-03-09 23:47:01 -06:00
steve e733e7b092 fix: enable verbose curl output for ntfy debugging 2026-03-09 23:41:46 -06:00
steve 9fe3bc43d0 chore: add TODO for admin interface 2026-03-09 23:37:13 -06:00
steve a0e6042300 feat: add ntfy push notification on successful Docker Hub push 2026-03-09 23:16:54 -06:00
steve 05bcf10614 fix: resolve volume permission error for non-root container user
Entrypoint now runs as root, chowns the data directory to appuser,
then drops privileges via gosu before starting Gunicorn. This prevents
sqlite3.OperationalError on mounted volumes owned by root.
2026-03-09 23:07:49 -06:00
steve 78ef3eeb85 refactor: replace init_db with lightweight schema migration system
- Add MIGRATIONS list — each entry is a list of SQL statements for
  that schema version; append new lists to add future migrations,
  never modify existing ones
- Add schema_version table to track applied migrations
- migrate_db() runs on startup and applies any pending versions
  automatically; safe to run against existing DBs (v1 uses
  CREATE IF NOT EXISTS so it no-ops on the existing table/indexes)
v2.0.0
2026-03-09 21:01:35 -06:00
steve 46dca45e04 fix: correct WORKERS var, export path, and seamless marquee loop
- entrypoint.sh: use GUNICORN_WORKERS to match example.env (#17)
- guestbook_export.py: read DATABASE_PATH from env instead of
  hardcoded relative path (#18)
- Scrolling marquee: duplicate guest list for seamless loop,
  animate translateX(0) to translateX(-50%), increase font to
  1.25rem, fix JS speed calc to use half content width (#20)
2026-03-09 20:52:00 -06:00
steve 2dc276f098 fix: improve profanity filter to catch spacing and embedding bypasses
Add a secondary normalized substring check: strips all non-alpha chars
then checks if any banned word appears as a substring. This catches:
- Spacing tricks: 'f u c k'
- Embedded forms: 'fucking'
Note: substring matching can produce false positives (e.g. 'classic'
contains 'ass'). Trade-off accepted for a museum kiosk context.
2026-03-09 20:48:26 -06:00
steve e6d742f92e fix: replace regex email validation with email-validator
Swap hand-rolled regex for the email-validator library which handles
RFC 5322 edge cases correctly. check_deliverability=False skips DNS
lookups (not viable on an intranet). Blank email still passes — only
a non-empty, malformed address triggers the error.
2026-03-09 20:36:54 -06:00
steve e0d72f8057 feat: add rate limiting to form submission
Add Flask-Limiter and cap POST submissions to 5 per minute per IP.
GET requests are not limited. Uses in-memory storage (appropriate
for single-instance kiosk deployment).
2026-03-09 20:29:17 -06:00
steve d98dd1518b Remove CSRF TODO — closed as won't fix in #11 2026-03-09 20:26:42 -06:00
steve 920463b4a7 fix: add database error handling throughout app
Wrap all sqlite3 operations in try/except sqlite3.Error:
- SELECT on validation error path: falls back to empty guest list
- INSERT on form submit: shows user-friendly retry message
- SELECT on page load: falls back to empty guest list
- SELECT in /api/guests: returns 503 JSON response
2026-03-09 20:24:09 -06:00
steve a178e6193b Keep PII logging as intentional — close #8
Logging guest name and location is appropriate here: visitors knowingly
submit this info for a newsletter, and the log is useful for confirming
submissions and debugging on an intranet-only kiosk.
2026-03-09 20:19:28 -06:00
steve 0c4d3ab15d perf: add DB indexes and cap guest queries at 100 rows
- Add idx_guests_id and idx_guests_email indexes in init_db()
- Cap all SELECT queries on the guests table to LIMIT 100 to prevent
  unbounded memory growth as the guestbook accumulates entries
2026-03-09 20:17:34 -06:00
steve 3e17574fe6 fix: upgrade to Flask 3.x and replace before_first_request
- Pin Flask to >=3.1.3 to resolve all outstanding Dependabot CVEs
  (session cookie Vary header, Werkzeug DoS/RCE/safe_join vulns)
- Replace removed @before_first_request decorator with app.app_context()
  call at module level, compatible with Flask 3.0+
2026-03-09 20:15:14 -06:00
steve 0c8491ce7a feat: run container as non-root user
Create appuser with configurable UID/GID (default 1000, matching
example.env PID/GID vars) and switch to it before starting Gunicorn.
Override at build time with --build-arg UID=... --build-arg GID=...

Note: the /data volume mount must be owned by the matching UID on the
host for the DB to remain writable.
2026-03-09 20:13:21 -06:00
steve 1a0a1371bc fix: correct marquee scroll speed and add code TODOs
- Fixed scrolling marquee to use a fixed px/s speed via JS instead of
  a fixed duration, preventing it from speeding up as entries are added
- Added inline TODO comments throughout codebase to track known issues
  (rate limiting, CSRF, unbounded queries, deprecated Flask decorator,
  PII logging, schema versioning, Docker non-root user, etc.)
- Added todo-to-issue GitHub Action to auto-create Issues from TODOs on push to main
- Added .claude/ to .gitignore
2026-03-09 19:30:13 -06:00
steve d260bc6f9f docs: remove outdated project structure section from README 2025-04-04 18:48:20 -06:00
steve 412d373421 docs: add Portainer setup instructions to README 2025-04-04 16:28:34 -06:00
steve bae3ddda32 - make the newsletter checkbox generic
- Added LOGO_URL to `example.env` and index.html template
- Rewrote README.md to reflect current methods of installing and configuring
1.1.0
2025-04-04 15:36:12 -06:00
steve 85a0096846 fix: move index.html template to correct Flask templates directory 2025-04-04 15:04:46 -06:00
steve d76a95e57b chore: move entrypoint.sh to project root 2025-04-04 14:59:05 -06:00
steve 91d4715e19 fix: correct DATABASE_PATH in example.env 2025-04-04 14:55:38 -06:00
steve ffa09e3daa Making the header/title are a variable
Refactor Dockerfile and entrypoint script; add index.html.template and update example.env
2025-04-04 14:46:29 -06:00
steve dfb350f8a8 chore: remove dev Dockerfile and add example docker-compose 2025-04-04 14:28:26 -06:00
steve ff175edcf6 chore: remove committed docker-compose.yml
Cleaning up files so it's easier to deploy. Look for example.docker-compose.yml instead
2025-04-04 14:20:04 -06:00
Steve Dogiakos 2bbe30e1e0 ci: add Docker Hub push step to workflow 2025-04-04 14:07:11 -06:00
steve af3ad37b4c chore: remove committed .env file
Just making the example.env available to the public.
2025-04-04 13:51:14 -06:00
Steve Dogiakos bc9fe0909e Created example.env so I don't have to keep messing
with my setup.
2025-04-04 13:50:13 -06:00
steve c04ffaf16d chore: add MIT license
Adding the MIT license to the project
2025-04-02 19:47:44 -06:00
steve 5091518bd2 ci: update Docker image workflow
changed secrete to vars for DOCKER_USERNAME
2025-04-02 19:36:36 -06:00
steve caf6f9e970 docs: update README
Added section about API use
2025-04-02 19:28:21 -06:00
steve 20dd611b70 ci: add Docker build GitHub Actions workflow
Added Docker secrets so hopefully it will run now.
2025-04-02 18:16:53 -06:00
Steve Dogiakos ada25eba70 fix: remove duplicate email field introduced in previous commit 2025-04-02 15:48:56 -06:00
Steve Dogiakos f34c163a76 Add API to app.py so I can use n8n to export the entries.
Added opt-out newsletter checkbox and the appropriate places to insert it to the db.
2025-04-02 15:31:33 -06:00
Steve Dogiakos cfcd301eb0 ci: remove Docker Hub push workflow 2025-04-02 09:44:59 -06:00
Steve Dogiakos 86529e0728 Rename production.Dockerfile to development.Dockerfile.
It was a late night, ok? Updated README.md to include removal of DB from repo.
2025-04-02 09:29:25 -06:00
steve dba4c21a5e ci: add Docker image build workflow 2025-04-02 08:38:24 -06:00
steve 1cb9dae204 chore: remove committed database file
Remove guestbook.db from repository

- Deleted guestbook.db, a binary SQLite database file, from the repo.
- Added guestbook.db to .gitignore to prevent storing environment-specific binaries.
- This change enhances security and keeps the repository clean by not tracking generated files.
1.0.0
2025-04-02 08:05:08 -06:00
Steve Dogiakos f528ef6f38 docs: add screenshot to README and update .gitignore 2025-04-02 08:02:47 -06:00
Steve Dogiakos c8c9d5ecd6 fix: update guestbook_export.py export logic 2025-04-01 22:17:18 -06:00
Steve Dogiakos d126d18fe9 chore: add Python-focused .gitignore 2025-04-01 22:12:24 -06:00