Admin login now uses OpenID Connect (PKCE, nonce, ID token verified against the provider JWKS) and only OIDC_ADMIN_SUB may log in. Micropub tokens are issued and verified by StarPunk itself, with a consent screen behind the OIDC session and a Connected Apps page to revoke them, so an external IndieAuth server (Gondulf) is no longer needed. Existing notes, media, tags, webmentions, author profile and sessions are unchanged. Migration 011 adds new tables only. BREAKING CHANGE: production requires OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET and OIDC_ADMIN_SUB. The ADMIN_ME page must point Micropub apps at StarPunk's IndieAuth endpoints. See ADR-064. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
"""
|
|
Route registration module for StarPunk
|
|
|
|
This module handles registration of all route blueprints including public,
|
|
admin, auth, and (conditionally) dev auth routes.
|
|
"""
|
|
|
|
from flask import Flask
|
|
|
|
from starpunk.routes import admin, auth, indieauth, micropub, public, search, webmention
|
|
|
|
|
|
def register_routes(app: Flask) -> None:
|
|
"""
|
|
Register all route blueprints with the Flask app
|
|
|
|
Args:
|
|
app: Flask application instance
|
|
|
|
Registers:
|
|
- Public routes (homepage, note permalinks)
|
|
- Auth routes (login, callback, logout, token, authorization)
|
|
- Micropub routes (Micropub API endpoint)
|
|
- Admin routes (dashboard, note management)
|
|
- Dev auth routes (if DEV_MODE enabled)
|
|
"""
|
|
# Register public routes
|
|
app.register_blueprint(public.bp)
|
|
|
|
# Register auth routes
|
|
app.register_blueprint(auth.bp)
|
|
app.register_blueprint(indieauth.bp)
|
|
|
|
# Register Micropub routes
|
|
app.register_blueprint(micropub.bp)
|
|
|
|
# Register admin routes
|
|
app.register_blueprint(admin.bp)
|
|
|
|
# Register search routes
|
|
app.register_blueprint(search.bp)
|
|
|
|
# Register webmention routes (v1.6.0)
|
|
if app.config.get("WEBMENTION_ENABLED", True):
|
|
app.register_blueprint(webmention.bp)
|
|
|
|
# Conditionally register dev auth routes
|
|
if app.config.get("DEV_MODE"):
|
|
app.logger.warning(
|
|
"=" * 60
|
|
+ "\n"
|
|
+ "WARNING: Development authentication enabled!\n"
|
|
+ "This should NEVER be used in production.\n"
|
|
+ "Set DEV_MODE=false for production deployments.\n"
|
|
+ "=" * 60
|
|
)
|
|
from starpunk.routes import dev_auth
|
|
|
|
app.register_blueprint(dev_auth.bp)
|