forked from indymedia/epicyon
Simplify
parent
b86cfdf42d
commit
861e46fa67
|
@ -9,7 +9,7 @@ __status__ = "Production"
|
||||||
import os
|
import os
|
||||||
from auth import createPassword
|
from auth import createPassword
|
||||||
|
|
||||||
def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,requestedDomain: str,nickname=None) -> None:
|
def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,domain: str,requestedActor: str) -> None:
|
||||||
# This is sent to the capabilities endpoint /caps/new
|
# This is sent to the capabilities endpoint /caps/new
|
||||||
# which could be instance wide or for a particular person
|
# which could be instance wide or for a particular person
|
||||||
capId=createPassword(32)
|
capId=createPassword(32)
|
||||||
|
@ -20,16 +20,11 @@ def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,requestedDomain: str,ni
|
||||||
"inbox": "write",
|
"inbox": "write",
|
||||||
"objects": "read"
|
"objects": "read"
|
||||||
},
|
},
|
||||||
"actor": httpPrefix+"://"+requestedDomain
|
"actor": requestedActor
|
||||||
}
|
}
|
||||||
# requesting for a particular person
|
|
||||||
if nickname:
|
|
||||||
# does the account exist for this person?
|
|
||||||
if os.path.isdir(baseDir+'/accounts/'+nickname+'@'+requestedDomain):
|
|
||||||
capRequest['scope']=httpPrefix+"://"+requestedDomain+'/users/'+nickname
|
|
||||||
#TODO
|
#TODO
|
||||||
|
|
||||||
def sendCapabilitiesAccept(baseDir: str,httpPrefix: str,domain: str,acceptedDomain: str,nickname=None) -> None:
|
def sendCapabilitiesAccept(baseDir: str,httpPrefix: str,nickname: str,domain: str,acceptedActor: str) -> None:
|
||||||
# This gets returned to capabilities requester
|
# This gets returned to capabilities requester
|
||||||
capId=createPassword(32)
|
capId=createPassword(32)
|
||||||
capAccept = {
|
capAccept = {
|
||||||
|
@ -39,15 +34,11 @@ def sendCapabilitiesAccept(baseDir: str,httpPrefix: str,domain: str,acceptedDoma
|
||||||
"inbox": "write",
|
"inbox": "write",
|
||||||
"objects": "read"
|
"objects": "read"
|
||||||
},
|
},
|
||||||
"scope": httpPrefix+"://"+acceptedDomain,
|
"scope": acceptedActor,
|
||||||
"actor": httpPrefix+"://"+domain
|
"actor": httpPrefix+"://"+domain
|
||||||
}
|
}
|
||||||
|
|
||||||
# accepting for a particular person
|
|
||||||
if nickname:
|
if nickname:
|
||||||
# does the account exist for this person?
|
capAccept['actor']=httpPrefix+"://"+domain+'/users/'+nickname
|
||||||
if os.path.isdir(baseDir+'/accounts/'+nickname+'@'+acceptedDomain):
|
|
||||||
capAccept['scope']=httpPrefix+"://"+acceptedDomain+'/users/'+nickname
|
|
||||||
#TODO
|
#TODO
|
||||||
|
|
||||||
def isCapable(actor: str,capsJson: []) -> bool:
|
def isCapable(actor: str,capsJson: []) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue