nomadro/apps/api/social_main.py
Eric ffa456afdf Ship social join profile + SeaweedFS avatars, notify/coffee, and .com audience stack.
Pay-then-profile join desk with live card, S3 upload fallback, hydration-safe drafts; document on test9 README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 02:25:05 +08:00

46 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""游民社区独立进程入口 — 仅挂 social_svc,不拖垮 ebook/community/pay。"""
from __future__ import annotations
import sys
from pathlib import Path
from fastapi import FastAPI
ROOT = Path(__file__).resolve().parent
SERVICES = ROOT / "services"
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(SERVICES))
from social_svc.config import SOCIAL_ENABLED # noqa: E402
from social_svc.realtime import issue_connection_token # noqa: E402
from social_svc.routers import router as social_router # noqa: E402
from social_svc.store import init_db # noqa: E402
app = FastAPI(title="nomadro-social", docs_url=None, redoc_url=None)
@app.on_event("startup")
def _startup() -> None:
if SOCIAL_ENABLED:
init_db()
if SOCIAL_ENABLED:
app.include_router(social_router, prefix="/api/social/v1")
@app.get("/health")
def health():
from social_svc.config import CENTRIFUGO_ENABLED
from social_svc.contract import IM_FEATURES, IM_PROTOCOL
return {
"ok": True,
"service": "nomadro-social",
"social": bool(SOCIAL_ENABLED),
"centrifugo": bool(CENTRIFUGO_ENABLED),
"imProtocol": IM_PROTOCOL,
"imFeatures": list(IM_FEATURES),
"uiAgnostic": True,
}