Initial federation app — ActivityPub server for Rose-Ash
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 41s

Phase 0+1 of AP integration. New 5th Quart microservice:

Blueprints:
- wellknown: WebFinger, NodeInfo 2.0, host-meta
- actors: AP actor profiles (JSON-LD + HTML), outbox, inbox, followers
- identity: username selection flow (creates ActorProfile + RSA keypair)
- auth: magic link login/logout (ported from blog, self-contained)

Services:
- Registers SqlFederationService (real impl) for federation domain
- Registers real impls for blog, calendar, market, cart
- All cross-domain via shared service contracts

Templates:
- Actor profiles, username selection, platform home
- Auth login/check-email (ported from blog)

Infrastructure:
- Dockerfile + entrypoint.sh (matches other apps)
- CI/CD via Gitea Actions
- shared/ as git submodule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-21 15:11:52 +00:00
commit 41e9670975
32 changed files with 1450 additions and 0 deletions

67
app.py Normal file
View File

@@ -0,0 +1,67 @@
from __future__ import annotations
import path_setup # noqa: F401 # adds shared_lib to sys.path
from pathlib import Path
from quart import g
from jinja2 import FileSystemLoader, ChoiceLoader
from shared.infrastructure.factory import create_base_app
from shared.services.registry import services
from bp import (
register_wellknown_bp,
register_actors_bp,
register_identity_bp,
register_auth_bp,
)
async def federation_context() -> dict:
"""Federation app context processor."""
from shared.infrastructure.context import base_context
ctx = await base_context()
# If user is logged in, check for ActorProfile
if g.get("user"):
actor = await services.federation.get_actor_by_user_id(g.s, g.user.id)
ctx["actor"] = actor
else:
ctx["actor"] = None
return ctx
def create_app() -> "Quart":
from services import register_domain_services
app = create_base_app(
"federation",
context_fn=federation_context,
domain_services_fn=register_domain_services,
)
# App-specific templates override shared templates
app_templates = str(Path(__file__).resolve().parent / "templates")
app.jinja_loader = ChoiceLoader([
FileSystemLoader(app_templates),
app.jinja_loader,
])
# --- blueprints ---
app.register_blueprint(register_wellknown_bp())
app.register_blueprint(register_actors_bp())
app.register_blueprint(register_identity_bp())
app.register_blueprint(register_auth_bp())
# --- home page ---
@app.get("/")
async def home():
from quart import render_template
stats = await services.federation.get_stats(g.s)
return await render_template("federation/home.html", stats=stats)
return app
app = create_app()