Implements tag/category system backend following microformats2 p-category specification. Database changes: - Migration 008: Add tags and note_tags tables - Normalized tag storage (case-insensitive lookup, display name preserved) - Indexes for performance New module: - starpunk/tags.py: Tag management functions - normalize_tag: Normalize tag strings - get_or_create_tag: Get or create tag records - add_tags_to_note: Associate tags with notes (replaces existing) - get_note_tags: Retrieve note tags (alphabetically ordered) - get_tag_by_name: Lookup tag by normalized name - get_notes_by_tag: Get all notes with specific tag - parse_tag_input: Parse comma-separated tag input Model updates: - Note.tags property (lazy-loaded, prefer pre-loading in routes) - Note.to_dict() add include_tags parameter CRUD updates: - create_note() accepts tags parameter - update_note() accepts tags parameter (None = no change, [] = remove all) Micropub integration: - Pass tags to create_note() (tags already extracted by extract_tags()) - Return tags in q=source response Per design doc: docs/design/v1.3.0/microformats-tags-design.md Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1.6 KiB
1.6 KiB
QUICK FIX: Auth Redirect Loop
Problem: Dev login redirects back to login page (loop)
Cause: Cookie name collision (session used by both Flask and StarPunk)
Fix: Rename auth cookie to starpunk_session
Time: 30 minutes
6 Changes in 3 Files
1. starpunk/routes/dev_auth.py (Line 75)
# Change this:
response.set_cookie("session", session_token, ...)
# To this:
response.set_cookie("starpunk_session", session_token, ...)
2. starpunk/routes/auth.py (5 changes)
Line 47:
session_token = request.cookies.get("starpunk_session") # was "session"
Line 121:
response.set_cookie("starpunk_session", session_token, ...) # was "session"
Line 167:
session_token = request.cookies.get("starpunk_session") # was "session"
Line 178:
response.delete_cookie("starpunk_session") # was "session"
3. starpunk/auth.py (Line 390)
session_token = request.cookies.get("starpunk_session") # was "session"
Test It
# Run tests
uv run pytest tests/ -v
# Start server
uv run flask run
# Browser test:
# 1. Go to http://localhost:5000/admin/
# 2. Click dev login
# 3. Should see dashboard (not login page)
# 4. Check cookies in DevTools - should see "starpunk_session"
Full Docs
- Executive Summary:
/docs/design/auth-redirect-loop-executive-summary.md - Implementation Guide:
/docs/design/auth-redirect-loop-fix-implementation.md - Visual Diagrams:
/docs/design/auth-redirect-loop-diagram.md - Root Cause Analysis:
/docs/design/auth-redirect-loop-diagnosis.md