28 lines
787 B
Python
28 lines
787 B
Python
"""The platform registry: name -> driver class and its site."""
|
|||
|
|
from dialects.akkoma import Akkoma
|
||
|
|
from dialects.gts import Gts
|
||
|
|
from dialects.hollo import Hollo
|
||
|
|
from dialects.lemmy_api import LemmyApi
|
||
|
|
from dialects.mastodon import Mastodon
|
||
|
|
from dialects.misskey_api import Misskey, Sharkey
|
||
|
|
from dialects.privapub import PrivaPub
|
||
|
|
|
||
|
|
DRIVERS = {
|
||
|
|
"privapub": (PrivaPub, "privapub.test"),
|
||
|
|
"gts": (Gts, "gts.test"),
|
||
|
|
"mastodon": (Mastodon, "mastodon.test"),
|
||
|
|
"misskey": (Misskey, "misskey.test"),
|
||
|
|
"sharkey": (Sharkey, "sharkey.test"),
|
||
|
|
"akkoma": (Akkoma, "akkoma.test"),
|
||
|
|
"lemmy": (LemmyApi, "lemmy.test"),
|
||
|
|
"hollo": (Hollo, "hollo.test"),
|
||
|
|
}
|
||
|
|
|
||
|
|
_made = {}
|
||
|
|
|
||
|
|
|
||
|
|
def driver(platform):
|
||
|
|
if platform not in _made:
|
||
|
|
cls, host = DRIVERS[platform]
|
||
|
|
_made[platform] = cls(host)
|
||
|
|
return _made[platform]
|