Phase 0: stop-the-bleeding bugfixes
- Defer polling_service.start() and FilterEngine init to a one-shot before_request hook so importing app.py no longer spawns a scheduler thread (also fixes migrate_*.py import side effects). - Fix migrate_bookmarks.py: init_db returns None, so use the shared `db` instead of assigning its None return. - Enforce MIN_PASSWORD_LENGTH (8) in the password-reset route for consistency with signup (was hardcoded 6). - post_detail.html: replace undefined moment(...).fromNow() (always "Recently") with a new timeago Jinja filter + data-timestamp attrs that also drive the existing JS updater; make nl2br escape-then-Markup and drop | safe from comment/post content to close the XSS hole. - filter_pipeline: when AI is disabled but a filterset requires it, pass posts through with status=FAILED + explicit error instead of silently degrading to no_filter. No source-file mojibake found; content-encoding ingest is a Phase 3 concern. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ Migration script to create the bookmarks table.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from database import init_db
|
||||
from database import init_db, db
|
||||
from flask import Flask
|
||||
|
||||
# Add the current directory to Python path
|
||||
@@ -24,12 +24,13 @@ def main():
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
# Initialize database
|
||||
db = init_db(app)
|
||||
|
||||
# Initialize database (init_db binds the shared `db` extension; it
|
||||
# returns None, so use the module-level `db` directly).
|
||||
init_db(app)
|
||||
|
||||
# Import models to register them
|
||||
from models import User, Session, PollSource, PollLog, Bookmark
|
||||
|
||||
|
||||
# Create all tables (will only create missing ones)
|
||||
db.create_all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user