add ability to bookmark posts and threads, courtesy of bitty

This commit is contained in:
2025-11-23 22:07:50 +03:00
parent 962b833a80
commit 075a9bd498
15 changed files with 521 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
from flask import Flask, session
from flask import Flask, session, request
from dotenv import load_dotenv
from .models import Avatars, Users, PostHistory, Posts
from .auth import digest
@@ -131,6 +131,7 @@ def create_app():
from app.routes.mod import bp as mod_bp
from app.routes.api import bp as api_bp
from app.routes.posts import bp as posts_bp
from app.routes.hyperapi import bp as hyperapi_bp
app.register_blueprint(app_bp)
app.register_blueprint(topics_bp)
app.register_blueprint(threads_bp)
@@ -138,6 +139,7 @@ def create_app():
app.register_blueprint(mod_bp)
app.register_blueprint(api_bp)
app.register_blueprint(posts_bp)
app.register_blueprint(hyperapi_bp)
app.config['SESSION_COOKIE_SECURE'] = True
@@ -200,6 +202,15 @@ def create_app():
for id_, text in matches
]
@app.errorhandler(404)
def _handle_404(e):
if request.path.startswith('/hyperapi/'):
return '<h1>not found</h1>', e.code
elif request.path.startswith('/api/'):
return {'error': 'not found'}, e.code
else:
return e
# this only happens at build time but
# build time is when updates are done anyway
# sooo... /shrug