Rename to stealergram, add pyproject.toml, purge em-dashes

- Rename project to stealergram throughout
- Add pyproject.toml (replaces requirements.txt split, folds pytest.ini)
- Replace all em-dashes with hyphens across all source files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 10:06:30 -04:00
parent 4c104cddd2
commit 741e6bb0d3
46 changed files with 244 additions and 191 deletions

View File

@@ -1,5 +1,5 @@
"""
web/app.py FastAPI application factory.
web/app.py - FastAPI application factory.
Usage:
from web.app import create_app

View File

@@ -1,9 +1,9 @@
"""
web/auth.py JWT signing/verification and bcrypt password helpers.
web/auth.py - JWT signing/verification and bcrypt password helpers.
Tokens:
access HS256, 15 min TTL, payload: {sub, role, type:"access"}
refresh HS256, 7 day TTL, payload: {sub, jti, type:"refresh"}
access - HS256, 15 min TTL, payload: {sub, role, type:"access"}
refresh - HS256, 7 day TTL, payload: {sub, jti, type:"refresh"}
Both tokens live in httpOnly SameSite=Strict cookies.
The `type` claim prevents an access token being used as a refresh token.

View File

@@ -1,9 +1,9 @@
"""
web/db.py SQLite user store for the web frontend.
web/db.py - SQLite user store for the web frontend.
Tables:
users credentials + role + active flag
refresh_tokens JTI-indexed refresh token revocation list
users - credentials + role + active flag
refresh_tokens - JTI-indexed refresh token revocation list
Bootstrap: on first init, creates a superadmin from WEB_ADMIN_USER / WEB_ADMIN_PASS
env vars (required only on first run if the DB doesn't exist yet).
@@ -63,7 +63,9 @@ def init_db() -> None:
admin_pass = os.environ.get("WEB_ADMIN_PASS")
if not admin_pass:
raise RuntimeError(
"WEB_ADMIN_PASS env var is required on first run to create the superadmin."
"WEB_ADMIN_PASS env var is required on first run to bootstrap the superadmin. "
"Add WEB_ADMIN_PASS=<password> (and optionally WEB_ADMIN_USER=<username>) "
"to your .env file, then restart."
)
conn.execute(
"INSERT INTO users (id, username, password_hash, role, created_at) VALUES (?,?,?,?,?)",

View File

@@ -1,5 +1,5 @@
"""
web/dependencies.py FastAPI dependency functions.
web/dependencies.py - FastAPI dependency functions.
get_current_user: reads the access_token cookie, decodes + validates it,
loads the user row from web.db. Raises 401 if anything fails.

View File

@@ -1,5 +1,5 @@
"""
web/models.py Pydantic request/response schemas.
web/models.py - Pydantic request/response schemas.
"""
import re

View File

@@ -1,9 +1,9 @@
"""
web/routes/auth.py Login, logout, token refresh.
web/routes/auth.py - Login, logout, token refresh.
POST /login form submit; sets access_token + refresh_token cookies
POST /logout revokes refresh token, clears cookies
POST /refresh exchanges refresh_token cookie for a new access_token
POST /login - form submit; sets access_token + refresh_token cookies
POST /logout - revokes refresh token, clears cookies
POST /refresh - exchanges refresh_token cookie for a new access_token
"""
from fastapi import APIRouter, Form, HTTPException, Request, Response, status

View File

@@ -1,5 +1,5 @@
"""
web/routes/config_routes.py Keyword groups and channel list management.
web/routes/config_routes.py - Keyword groups and channel list management.
GET /config/keywords → render groups editor
PUT /config/keywords → validate + save groups, reload scorer

View File

@@ -1,5 +1,5 @@
"""
web/routes/dashboard.py Dashboard views and SSE live stream.
web/routes/dashboard.py - Dashboard views and SSE live stream.
GET / → redirect to /dashboard
GET /dashboard → overview: all groups, stats, live hit feed

View File

@@ -1,5 +1,5 @@
"""
web/routes/users.py User CRUD (superadmin only).
web/routes/users.py - User CRUD (superadmin only).
GET /users → list all users
POST /users → create a new user