mirror of https://gitlab.com/bashrc2/epicyon
Stub implementation of masto api
parent
504c25e183
commit
4489cf143a
42
daemon.py
42
daemon.py
|
@ -813,7 +813,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if mastoId is not None:
|
if mastoId is not None:
|
||||||
pathNickname = getNicknameFromMastoApiV1Id(mastoId)
|
pathNickname = getNicknameFromMastoApiV1Id(mastoId)
|
||||||
if pathNickname:
|
if pathNickname:
|
||||||
if '/followers?' in path or '/following?' in path:
|
originalPath = path
|
||||||
|
if '/followers?' in path or \
|
||||||
|
'/following?' in path or \
|
||||||
|
'/search?' in path or \
|
||||||
|
'/relationships?' in path or \
|
||||||
|
'/statuses?' in path:
|
||||||
path = path.split('?')[0]
|
path = path.split('?')[0]
|
||||||
if path.endswith('/followers'):
|
if path.endswith('/followers'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
|
@ -821,11 +826,46 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
elif path.endswith('/following'):
|
elif path.endswith('/following'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API following sent for ' + nickname
|
sendJsonStr = 'masto API following sent for ' + nickname
|
||||||
|
elif path.endswith('/statuses'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API statuses sent for ' + nickname
|
||||||
|
elif path.endswith('/search'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API search sent ' + originalPath
|
||||||
|
elif path.endswith('/relationships'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = \
|
||||||
|
'masto API relationships sent ' + originalPath
|
||||||
else:
|
else:
|
||||||
sendJson = \
|
sendJson = \
|
||||||
getMastoApiV1Account(baseDir, pathNickname, domain)
|
getMastoApiV1Account(baseDir, pathNickname, domain)
|
||||||
sendJsonStr = 'masto API account sent for ' + nickname
|
sendJsonStr = 'masto API account sent for ' + nickname
|
||||||
|
|
||||||
|
if path.startswith('/api/v1/blocks'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API instance blocks sent'
|
||||||
|
elif path.startswith('/api/v1/favorites'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API favorites sent'
|
||||||
|
elif path.startswith('/api/v1/follow_requests'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API follow requests sent'
|
||||||
|
elif path.startswith('/api/v1/mutes'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API mutes sent'
|
||||||
|
elif path.startswith('/api/v1/notifications'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API notifications sent'
|
||||||
|
elif path.startswith('/api/v1/reports'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API reports sent'
|
||||||
|
elif path.startswith('/api/v1/statuses'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API statuses sent'
|
||||||
|
elif path.startswith('/api/v1/timelines'):
|
||||||
|
sendJson = []
|
||||||
|
sendJsonStr = 'masto API timelines sent'
|
||||||
|
|
||||||
adminNickname = getConfigParam(self.server.baseDir, 'admin')
|
adminNickname = getConfigParam(self.server.baseDir, 'admin')
|
||||||
if adminNickname and path == '/api/v1/instance':
|
if adminNickname and path == '/api/v1/instance':
|
||||||
instanceDescriptionShort = \
|
instanceDescriptionShort = \
|
||||||
|
|
|
@ -64,7 +64,7 @@ def getMastoApiV1Account(baseDir: str, nickname: str, domain: str) -> {}:
|
||||||
"acct": nickname,
|
"acct": nickname,
|
||||||
"display_name": accountJson['name'],
|
"display_name": accountJson['name'],
|
||||||
"locked": accountJson['manuallyApprovesFollowers'],
|
"locked": accountJson['manuallyApprovesFollowers'],
|
||||||
"created_at": "",
|
"created_at": "2016-10-05T10:30:00Z",
|
||||||
"followers_count": 0,
|
"followers_count": 0,
|
||||||
"following_count": 0,
|
"following_count": 0,
|
||||||
"statuses_count": 0,
|
"statuses_count": 0,
|
||||||
|
|
Loading…
Reference in New Issue