64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class BlueskyAccountConfig(BaseModel):
|
|
handle: str = ""
|
|
app_password: str = Field(default="", alias="appPassword")
|
|
session_string: str = Field(default="", alias="sessionString")
|
|
dm_policy: str = Field(default="pairing", alias="dmPolicy")
|
|
allow_from: list[str] = Field(default_factory=list, alias="allowFrom")
|
|
enable_notifications: bool = Field(default=False, alias="enableNotifications")
|
|
enable_firehose: bool = Field(default=False, alias="enableFirehose")
|
|
name: str = ""
|
|
|
|
model_config = {"populate_by_name": True}
|
|
|
|
|
|
class BlueskyConfig(BaseModel):
|
|
accounts: dict[str, BlueskyAccountConfig] = Field(default_factory=dict)
|
|
|
|
|
|
BLUESKY_CONFIG_SCHEMA = {
|
|
"type": "object",
|
|
"properties": {
|
|
"handle": {
|
|
"type": "string",
|
|
"description": "Bluesky handle (e.g. my-bot.bsky.social)",
|
|
},
|
|
"appPassword": {
|
|
"type": "string",
|
|
"description": "Bluesky App Password with DM permission",
|
|
"sensitive": True,
|
|
},
|
|
"sessionString": {
|
|
"type": "string",
|
|
"description": "Persisted session token (auto-managed)",
|
|
"sensitive": True,
|
|
},
|
|
"dmPolicy": {
|
|
"type": "string",
|
|
"enum": ["pairing", "allowlist", "open", "disabled"],
|
|
"default": "pairing",
|
|
},
|
|
"allowFrom": {
|
|
"type": "array",
|
|
"items": {"type": "string"},
|
|
"description": "Allowed DIDs (did:plc:xxx) for allowlist/pairing policies",
|
|
},
|
|
"enableNotifications": {
|
|
"type": "boolean",
|
|
"default": False,
|
|
"description": "Enable @mention notification polling",
|
|
},
|
|
"enableFirehose": {
|
|
"type": "boolean",
|
|
"default": False,
|
|
"description": "Enable Firehose WebSocket (P2 feature)",
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Display name for this account",
|
|
},
|
|
},
|
|
}
|