FastAPI backend (SQLite + APScheduler), Vue 3 frontend, MCP server for Claude integration, and Docker Compose stack. Includes campaign data model (campaigns → variants → subs), post history, sub rules, and Playwright-based Reddit posting layer migrated from claude-bridge/reddit-poster. Also seeds legacy campaigns (6) and sub rules (14) from reddit-poster history. Closes #1 (scaffold), resolves migration from claude-bridge.
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""
|
|
Platform registry: maps platform names to their poster implementations.
|
|
|
|
Adding a new platform:
|
|
1. Create app/services/<platform>/client.py implementing PlatformClient
|
|
2. Register it here in REGISTRY
|
|
|
|
This keeps poster.py platform-agnostic — it looks up the right client by
|
|
the campaign's `platform` field rather than branching on strings everywhere.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
|
|
class PlatformClient(Protocol):
|
|
def post(self, target: str, title: str, body: str, flair: str | None = None) -> str:
|
|
"""Post content to a target (sub, group, channel). Returns a URL."""
|
|
...
|
|
|
|
|
|
def get_client(platform: str) -> PlatformClient:
|
|
"""Return an initialized client for the given platform name."""
|
|
if platform == "reddit":
|
|
from app.services.reddit.client import RedditClient
|
|
return RedditClient()
|
|
raise NotImplementedError(
|
|
f"Platform '{platform}' is not yet implemented. "
|
|
f"Add a client in app/services/{platform}/ and register it here."
|
|
)
|
|
|
|
|
|
# Platforms with posting support implemented
|
|
SUPPORTED_PLATFORMS = {"reddit"}
|
|
|
|
# Platforms planned but not yet implemented
|
|
PLANNED_PLATFORMS = {"facebook", "discord", "lemmy", "mastodon"}
|