mirror of https://gitlab.com/bashrc2/epicyon
Always allow capabilities requests
parent
02bcea9ce1
commit
31ccb80830
3
posts.py
3
posts.py
|
@ -460,7 +460,8 @@ def threadSendPost(session,postJsonObject: {},federationList: [],capsList: [],\
|
||||||
backoffTime=60
|
backoffTime=60
|
||||||
for attempt in range(20):
|
for attempt in range(20):
|
||||||
postResult = postJson(session,postJsonObject,federationList, \
|
postResult = postJson(session,postJsonObject,federationList, \
|
||||||
capsList,inboxUrl,signatureHeaderJson)
|
capsList,inboxUrl,signatureHeaderJson, \
|
||||||
|
"inbox:write")
|
||||||
if postResult:
|
if postResult:
|
||||||
postLog.append(postJsonObject['published']+' '+postResult+'\n')
|
postLog.append(postJsonObject['published']+' '+postResult+'\n')
|
||||||
# keep the length of the log finite
|
# keep the length of the log finite
|
||||||
|
|
13
session.py
13
session.py
|
@ -39,13 +39,16 @@ def getJson(session,url: str,headers: {},params: {}) -> {}:
|
||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def postJson(session,postJsonObject: {},federationList: [],capsList: [],inboxUrl: str,headers: {}) -> str:
|
def postJson(session,postJsonObject: {},federationList: [],capsList: [],inboxUrl: str,headers: {},capability: str) -> str:
|
||||||
"""Post a json message to the inbox of another person
|
"""Post a json message to the inbox of another person
|
||||||
|
Supplying a capability, such as "inbox:write"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# check that we are posting to a permitted domain
|
# always allow capability requests
|
||||||
if not urlPermitted(inboxUrl,federationList,capsList,"inbox:write"):
|
if not capability.startswith('cap'):
|
||||||
return None
|
# check that we are posting to a permitted domain
|
||||||
|
if not urlPermitted(inboxUrl,federationList,capsList,capability):
|
||||||
|
return None
|
||||||
|
|
||||||
postResult = session.post(url = inboxUrl, data = json.dumps(postJsonObject), headers=headers)
|
postResult = session.post(url = inboxUrl, data = json.dumps(postJsonObject), headers=headers)
|
||||||
return postResult.text
|
return postResult.text
|
||||||
|
|
Loading…
Reference in New Issue