mirror of https://gitlab.com/bashrc2/epicyon
Show calling domain for api endpoints
parent
a661a368ca
commit
e617de5f14
|
|
@ -121,57 +121,73 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
||||||
path = path.split('?')[0]
|
path = path.split('?')[0]
|
||||||
if path.endswith('/followers'):
|
if path.endswith('/followers'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API followers sent for ' + nickname
|
sendJsonStr = \
|
||||||
|
'masto API followers sent for ' + nickname + \
|
||||||
|
' ' + callingDomain
|
||||||
elif path.endswith('/following'):
|
elif path.endswith('/following'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API following sent for ' + nickname
|
sendJsonStr = \
|
||||||
|
'masto API following sent for ' + nickname + \
|
||||||
|
' ' + callingDomain
|
||||||
elif path.endswith('/statuses'):
|
elif path.endswith('/statuses'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API statuses sent for ' + nickname
|
sendJsonStr = \
|
||||||
|
'masto API statuses sent for ' + nickname + \
|
||||||
|
' ' + callingDomain
|
||||||
elif path.endswith('/search'):
|
elif path.endswith('/search'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API search sent ' + originalPath
|
sendJsonStr = \
|
||||||
|
'masto API search sent ' + originalPath + \
|
||||||
|
' ' + callingDomain
|
||||||
elif path.endswith('/relationships'):
|
elif path.endswith('/relationships'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = \
|
sendJsonStr = \
|
||||||
'masto API relationships sent ' + originalPath
|
'masto API relationships sent ' + originalPath + \
|
||||||
|
' ' + callingDomain
|
||||||
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 + \
|
||||||
|
' ' + callingDomain
|
||||||
|
|
||||||
# NOTE: adding support for '/api/v1/directory seems to create
|
# NOTE: adding support for '/api/v1/directory seems to create
|
||||||
# federation problems, so avoid implementing that
|
# federation problems, so avoid implementing that
|
||||||
|
|
||||||
if path.startswith('/api/v1/blocks'):
|
if path.startswith('/api/v1/blocks'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API instance blocks sent ' + path
|
sendJsonStr = \
|
||||||
|
'masto API instance blocks sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/favorites'):
|
elif path.startswith('/api/v1/favorites'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API favorites sent ' + path
|
sendJsonStr = 'masto API favorites sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/follow_requests'):
|
elif path.startswith('/api/v1/follow_requests'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API follow requests sent ' + path
|
sendJsonStr = \
|
||||||
|
'masto API follow requests sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/mutes'):
|
elif path.startswith('/api/v1/mutes'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API mutes sent ' + path
|
sendJsonStr = \
|
||||||
|
'masto API mutes sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/notifications'):
|
elif path.startswith('/api/v1/notifications'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API notifications sent ' + path
|
sendJsonStr = \
|
||||||
|
'masto API notifications sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/reports'):
|
elif path.startswith('/api/v1/reports'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API reports sent ' + path
|
sendJsonStr = 'masto API reports sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/statuses'):
|
elif path.startswith('/api/v1/statuses'):
|
||||||
sendJson = []
|
sendJson = []
|
||||||
sendJsonStr = 'masto API statuses sent ' + path
|
sendJsonStr = 'masto API statuses sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/timelines'):
|
elif path.startswith('/api/v1/timelines'):
|
||||||
sendJson = {
|
sendJson = {
|
||||||
'error': 'This method requires an authenticated user'
|
'error': 'This method requires an authenticated user'
|
||||||
}
|
}
|
||||||
sendJsonStr = 'masto API timelines sent ' + path
|
sendJsonStr = 'masto API timelines sent ' + path + ' ' + callingDomain
|
||||||
elif path.startswith('/api/v1/custom_emojis'):
|
elif path.startswith('/api/v1/custom_emojis'):
|
||||||
sendJson = customEmoji
|
sendJson = customEmoji
|
||||||
sendJsonStr = 'masto API custom emojis sent ' + path
|
sendJsonStr = \
|
||||||
|
'masto API custom emojis sent ' + path + ' ' + callingDomain
|
||||||
|
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if adminNickname and path == '/api/v1/instance':
|
if adminNickname and path == '/api/v1/instance':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue