social media crossposting tool. 3rd time's the charm
mastodon
misskey
crossposting
bluesky
1from abc import ABC
2from typing import Any
3from cross.service import Service
4from util.util import normalize_service_url
5
6def validate_and_transform(data: dict[str, Any]):
7 if not data["handle"] and not data["did"]:
8 raise KeyError("no 'handle' or 'did' specified for bluesky input!")
9
10 if "did" in data:
11 did = str(data["did"]) # only did:web and did:plc are supported
12 if not did.startswith("did:plc:") and not did.startswith("did:web:"):
13 raise ValueError(f"Invalid handle {did}!")
14
15 if "pds" in data:
16 data["pds"] = normalize_service_url(data["pds"])
17
18class BlueskyService(ABC, Service):
19 pass