mirror of https://gitlab.com/bashrc2/epicyon
Mastodon-style user agent
parent
89136958b9
commit
ef89dda935
22
announce.py
22
announce.py
|
@ -173,7 +173,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \
|
|||
clientToServer: bool, \
|
||||
sendThreads: [],postLog: [], \
|
||||
personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates an announce message
|
||||
Typically toUrl will be https://www.w3.org/ns/activitystreams#Public
|
||||
and ccUrl might be a specific person favorited or repeated and the
|
||||
|
@ -224,7 +224,8 @@ def createAnnounce(session,baseDir: str,federationList: [], \
|
|||
announceNickname,announceDomain,announcePort, \
|
||||
'https://www.w3.org/ns/activitystreams#Public', \
|
||||
httpPrefix,True,clientToServer,federationList, \
|
||||
sendThreads,postLog,cachedWebfingers,personCache,debug)
|
||||
sendThreads,postLog,cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
|
||||
return newAnnounce
|
||||
|
||||
|
@ -233,7 +234,7 @@ def announcePublic(session,baseDir: str,federationList: [], \
|
|||
objectUrl: str,clientToServer: bool, \
|
||||
sendThreads: [],postLog: [], \
|
||||
personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Makes a public announcement
|
||||
"""
|
||||
fromDomain=domain
|
||||
|
@ -249,7 +250,7 @@ def announcePublic(session,baseDir: str,federationList: [], \
|
|||
objectUrl,True,clientToServer, \
|
||||
sendThreads,postLog, \
|
||||
personCache,cachedWebfingers, \
|
||||
debug)
|
||||
debug,projectVersion)
|
||||
|
||||
def repeatPost(session,baseDir: str,federationList: [], \
|
||||
nickname: str, domain: str, port: int, httpPrefix: str, \
|
||||
|
@ -258,7 +259,7 @@ def repeatPost(session,baseDir: str,federationList: [], \
|
|||
announceStatusNumber: int,clientToServer: bool, \
|
||||
sendThreads: [],postLog: [], \
|
||||
personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Repeats a given status post
|
||||
"""
|
||||
announcedDomain=announceDomain
|
||||
|
@ -274,7 +275,7 @@ def repeatPost(session,baseDir: str,federationList: [], \
|
|||
objectUrl,clientToServer, \
|
||||
sendThreads,postLog, \
|
||||
personCache,cachedWebfingers, \
|
||||
debug)
|
||||
debug,projectVersion)
|
||||
|
||||
def undoAnnounce(session,baseDir: str,federationList: [], \
|
||||
nickname: str, domain: str, port: int, \
|
||||
|
@ -385,7 +386,7 @@ def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,repeatObjectUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates an announce message via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -418,7 +419,9 @@ def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -428,7 +431,8 @@ def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
|
@ -73,7 +73,7 @@ def sendAvailabilityViaServer(session,nickname: str,password: str,
|
|||
httpPrefix: str, \
|
||||
status: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Sets the availability for a person via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -98,7 +98,8 @@ def sendAvailabilityViaServer(session,nickname: str,password: str,
|
|||
handle=httpPrefix+'://'+domainFull+'/@'+nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -108,7 +109,8 @@ def sendAvailabilityViaServer(session,nickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
16
blocking.py
16
blocking.py
|
@ -140,7 +140,7 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,blockedUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a block via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -166,7 +166,8 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -176,7 +177,8 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
@ -208,7 +210,7 @@ def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,blockedUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a block via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -238,7 +240,8 @@ def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -248,7 +251,8 @@ def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
79
daemon.py
79
daemon.py
|
@ -304,7 +304,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.postLog, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
messageJson,self.server.debug)
|
||||
messageJson,self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
if self.server.debug:
|
||||
print('DEBUG: handle any unfollow requests')
|
||||
outboxUndoFollow(self.server.baseDir,messageJson,self.server.debug)
|
||||
|
@ -369,7 +370,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.postLog, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
messageJson,self.server.debug)
|
||||
messageJson,self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
return True
|
||||
|
||||
def _updateInboxQueue(self,nickname: str,messageJson: {}) -> int:
|
||||
|
@ -717,7 +719,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
htmlHashtagSearch(self.server.baseDir,hashtag,pageNumber, \
|
||||
maxPostsInFeed,self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache)
|
||||
self.server.personCache, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion)
|
||||
self._set_headers('text/html',cookie)
|
||||
if hashtagStr:
|
||||
self.wfile.write(hashtagStr.encode())
|
||||
|
@ -791,7 +795,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.postLog, \
|
||||
self.server.personCache, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.debug)
|
||||
self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
if announceJson:
|
||||
self._postToOutbox(announceJson)
|
||||
self.server.GETbusy=False
|
||||
|
@ -845,7 +850,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
self.server.acceptedCaps, \
|
||||
self.server.debug)
|
||||
self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
self._redirect_headers(originPathStr,cookie)
|
||||
self.server.GETbusy=False
|
||||
return
|
||||
|
@ -1022,7 +1028,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers,self.server.personCache, \
|
||||
nickname,self.server.domain,self.server.port, \
|
||||
authorized,postJsonObject).encode('utf-8'))
|
||||
authorized,postJsonObject, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(postJsonObject).encode('utf-8'))
|
||||
|
@ -1074,7 +1082,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
nickname, \
|
||||
self.server.domain, \
|
||||
self.server.port, \
|
||||
repliesJson).encode('utf-8'))
|
||||
repliesJson, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(repliesJson).encode('utf-8'))
|
||||
|
@ -1113,7 +1123,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
nickname, \
|
||||
self.server.domain, \
|
||||
self.server.port, \
|
||||
repliesJson).encode('utf-8'))
|
||||
repliesJson, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(repliesJson).encode('utf-8'))
|
||||
|
@ -1136,7 +1148,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.baseDir)
|
||||
if getPerson:
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
True, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -1167,7 +1180,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.baseDir)
|
||||
if getPerson:
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
True, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -1210,7 +1224,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers,self.server.personCache, \
|
||||
nickname,self.server.domain,self.server.port, \
|
||||
authorized,postJsonObject).encode('utf-8'))
|
||||
authorized,postJsonObject, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(postJsonObject).encode('utf-8'))
|
||||
|
@ -1262,7 +1278,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain, \
|
||||
self.server.port, \
|
||||
inboxFeed, \
|
||||
self.server.allowDeletion).encode('utf-8'))
|
||||
self.server.allowDeletion, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(inboxFeed).encode('utf-8'))
|
||||
|
@ -1319,7 +1337,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain, \
|
||||
self.server.port, \
|
||||
outboxFeed, \
|
||||
self.server.allowDeletion).encode('utf-8'))
|
||||
self.server.allowDeletion, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(outboxFeed).encode('utf-8'))
|
||||
|
@ -1369,7 +1389,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain, \
|
||||
self.server.port, \
|
||||
moderationFeed, \
|
||||
True).encode('utf-8'))
|
||||
True, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion).encode('utf-8'))
|
||||
else:
|
||||
self._set_headers('application/json',None)
|
||||
self.wfile.write(json.dumps(moderationFeed).encode('utf-8'))
|
||||
|
@ -1410,7 +1432,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
authorized, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -1449,7 +1472,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
authorized, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -1486,7 +1510,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session= \
|
||||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
authorized, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -1513,7 +1538,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session= \
|
||||
createSession(self.server.domain,self.server.port,self.server.useTor)
|
||||
self._set_headers('text/html',cookie)
|
||||
self.wfile.write(htmlProfile(self.server.baseDir, \
|
||||
self.wfile.write(htmlProfile(self.server.projectVersion, \
|
||||
self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
authorized, \
|
||||
self.server.ocapAlways, \
|
||||
|
@ -2236,7 +2262,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
htmlHashtagSearch(self.server.baseDir,searchStr[1:],1, \
|
||||
maxPostsInFeed,self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache)
|
||||
self.server.personCache, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.projectVersion)
|
||||
if hashtagStr:
|
||||
self._login_headers('text/html')
|
||||
self.wfile.write(hashtagStr.encode('utf-8'))
|
||||
|
@ -2260,7 +2288,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
self.server.debug)
|
||||
self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
if profileStr:
|
||||
self._login_headers('text/html')
|
||||
self.wfile.write(profileStr.encode('utf-8'))
|
||||
|
@ -2314,7 +2343,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.postLog, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
self.server.debug)
|
||||
self.server.debug, \
|
||||
self.server.projectVersion)
|
||||
self._redirect_headers(originPathStr,cookie)
|
||||
self.server.POSTbusy=False
|
||||
return
|
||||
|
@ -2661,7 +2691,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
self.server.POSTbusy=False
|
||||
|
||||
def runDaemon(instanceId,clientToServer: bool, \
|
||||
def runDaemon(projectVersion, \
|
||||
instanceId,clientToServer: bool, \
|
||||
baseDir: str,domain: str, \
|
||||
port=80,proxyPort=80,httpPrefix='https', \
|
||||
fedList=[],noreply=False,nolike=False,nopics=False, \
|
||||
|
@ -2679,6 +2710,7 @@ def runDaemon(instanceId,clientToServer: bool, \
|
|||
serverAddress = ('', proxyPort)
|
||||
httpd = ThreadingHTTPServer(serverAddress, PubServer)
|
||||
# max POST size of 10M
|
||||
httpd.projectVersion=projectVersion
|
||||
httpd.maxPostLength=1024*1024*10
|
||||
httpd.domain=domain
|
||||
httpd.port=port
|
||||
|
@ -2732,7 +2764,8 @@ def runDaemon(instanceId,clientToServer: bool, \
|
|||
print('Creating inbox queue')
|
||||
httpd.thrInboxQueue= \
|
||||
threadWithTrace(target=runInboxQueue, \
|
||||
args=(baseDir,httpPrefix,httpd.sendThreads, \
|
||||
args=(projectVersion, \
|
||||
baseDir,httpPrefix,httpd.sendThreads, \
|
||||
httpd.postLog,httpd.cachedWebfingers, \
|
||||
httpd.personCache,httpd.inboxQueue, \
|
||||
domain,port,useTor,httpd.federationList, \
|
||||
|
|
|
@ -83,7 +83,7 @@ def sendDeleteViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,deleteObjectUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a delete request message via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -108,7 +108,8 @@ def sendDeleteViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -118,7 +119,8 @@ def sendDeleteViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
49
epicyon.py
49
epicyon.py
|
@ -296,7 +296,8 @@ if args.posts:
|
|||
nickname=args.posts.split('@')[0]
|
||||
domain=args.posts.split('@')[1]
|
||||
getPublicPostsOfPerson(nickname,domain,False,True, \
|
||||
args.tor,args.port,httpPrefix,debug)
|
||||
args.tor,args.port,httpPrefix,debug, \
|
||||
__version__)
|
||||
sys.exit()
|
||||
|
||||
if args.postsraw:
|
||||
|
@ -308,7 +309,8 @@ if args.postsraw:
|
|||
nickname=args.postsraw.split('@')[0]
|
||||
domain=args.postsraw.split('@')[1]
|
||||
getPublicPostsOfPerson(nickname,domain,False,False, \
|
||||
args.tor,args.port,httpPrefix,debug)
|
||||
args.tor,args.port,httpPrefix,debug, \
|
||||
__version__)
|
||||
sys.exit()
|
||||
|
||||
baseDir=args.baseDir
|
||||
|
@ -429,7 +431,7 @@ if args.approve:
|
|||
sendThreads,postLog, \
|
||||
cachedWebfingers,personCache, \
|
||||
acceptedCaps, \
|
||||
debug)
|
||||
debug,__version__)
|
||||
sys.exit()
|
||||
|
||||
if args.deny:
|
||||
|
@ -514,7 +516,8 @@ if args.message:
|
|||
followersOnly=False
|
||||
print('Sending post to '+args.sendto)
|
||||
|
||||
sendPostViaServer(baseDir,session,args.nickname,args.password, \
|
||||
sendPostViaServer(__version__, \
|
||||
baseDir,session,args.nickname,args.password, \
|
||||
domain,port, \
|
||||
toNickname,toDomain,toPort,ccUrl, \
|
||||
httpPrefix,sendMessage,followersOnly, \
|
||||
|
@ -544,7 +547,7 @@ if args.announce:
|
|||
domain,port, \
|
||||
httpPrefix,args.announce, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -596,7 +599,7 @@ if args.itemName:
|
|||
args.location, \
|
||||
args.duration, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -622,7 +625,7 @@ if args.undoItemName:
|
|||
httpPrefix, \
|
||||
args.undoItemName, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -646,7 +649,7 @@ if args.like:
|
|||
domain,port, \
|
||||
httpPrefix,args.like, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -670,7 +673,7 @@ if args.undolike:
|
|||
domain,port, \
|
||||
httpPrefix,args.undolike, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -694,7 +697,7 @@ if args.delete:
|
|||
domain,port, \
|
||||
httpPrefix,args.delete, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -727,7 +730,7 @@ if args.follow:
|
|||
followNickname,followDomain,followPort, \
|
||||
httpPrefix, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,__version__)
|
||||
for t in range(20):
|
||||
time.sleep(1)
|
||||
# TODO some method to know if it worked
|
||||
|
@ -761,7 +764,7 @@ if args.unfollow:
|
|||
followNickname,followDomain,followPort, \
|
||||
httpPrefix, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,__version__)
|
||||
for t in range(20):
|
||||
time.sleep(1)
|
||||
# TODO some method to know if it worked
|
||||
|
@ -798,13 +801,14 @@ if args.actor:
|
|||
httpPrefix='https'
|
||||
port=443
|
||||
session = createSession(domain,port,useTor)
|
||||
wfRequest = webfingerHandle(session,nickname+'@'+domain,httpPrefix,wfCache)
|
||||
wfRequest = webfingerHandle(session,nickname+'@'+domain,httpPrefix,wfCache, \
|
||||
domain,__version__)
|
||||
if not wfRequest:
|
||||
print('Unable to webfinger '+nickname+'@'+domain)
|
||||
sys.exit()
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
personUrl = getUserUrl(wfRequest)
|
||||
personJson = getJson(session,personUrl,asHeader,None)
|
||||
personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,domain)
|
||||
if personJson:
|
||||
pprint(personJson)
|
||||
else:
|
||||
|
@ -814,7 +818,7 @@ if args.actor:
|
|||
if args.json:
|
||||
session = createSession(domain,port,True)
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
testJson = getJson(session,args.json,asHeader,None)
|
||||
testJson = getJson(session,args.json,asHeader,None,__version__,httpPrefix,domain)
|
||||
pprint(testJson)
|
||||
sys.exit()
|
||||
|
||||
|
@ -986,7 +990,7 @@ if args.skill:
|
|||
httpPrefix, \
|
||||
args.skill,args.skillLevelPercent, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1011,7 +1015,7 @@ if args.availability:
|
|||
httpPrefix, \
|
||||
args.availability, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1055,7 +1059,7 @@ if args.block:
|
|||
domain,port, \
|
||||
httpPrefix,args.block, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1092,7 +1096,7 @@ if args.delegate:
|
|||
httpPrefix,args.delegate, \
|
||||
args.project,args.role, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1125,7 +1129,7 @@ if args.undelegate:
|
|||
httpPrefix,args.delegate, \
|
||||
args.project,None, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1159,7 +1163,7 @@ if args.unblock:
|
|||
domain,port, \
|
||||
httpPrefix,args.unblock, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -1257,7 +1261,8 @@ if args.testdata:
|
|||
followerOfPerson(baseDir,nickname,domain,'maxboardroom',domainFull,federationList,False)
|
||||
setConfigParam(baseDir,'admin',nickname)
|
||||
|
||||
runDaemon(instanceId,args.client,baseDir, \
|
||||
runDaemon(__version__, \
|
||||
instanceId,args.client,baseDir, \
|
||||
domain,port,proxyPort,httpPrefix, \
|
||||
federationList, \
|
||||
args.noreply,args.nolike,args.nopics, \
|
||||
|
|
30
follow.py
30
follow.py
|
@ -332,7 +332,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
port: int,sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
messageJson: {},federationList: [], \
|
||||
debug : bool, \
|
||||
debug : bool,projectVersion: str, \
|
||||
acceptedCaps=["inbox:write","objects:read"]) -> bool:
|
||||
"""Receives a follow request within the POST section of HTTPServer
|
||||
"""
|
||||
|
@ -412,7 +412,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
messageJson,acceptedCaps, \
|
||||
sendThreads,postLog, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,projectVersion)
|
||||
|
||||
def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
||||
nicknameToFollow: str,domainToFollow: str,port: int, \
|
||||
|
@ -421,7 +421,7 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
|||
followJson: {},acceptedCaps: [], \
|
||||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool):
|
||||
debug: bool,projectVersion: str):
|
||||
"""The person receiving a follow request accepts the new follower
|
||||
and sends back an Accept activity
|
||||
"""
|
||||
|
@ -445,7 +445,7 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
|||
httpPrefix,True,clientToServer, \
|
||||
federationList, \
|
||||
sendThreads,postLog,cachedWebfingers, \
|
||||
personCache,debug)
|
||||
personCache,debug,projectVersion)
|
||||
|
||||
def sendFollowRequest(session,baseDir: str, \
|
||||
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||
|
@ -453,7 +453,8 @@ def sendFollowRequest(session,baseDir: str, \
|
|||
followPort: int,followHttpPrefix: str, \
|
||||
clientToServer: bool,federationList: [], \
|
||||
sendThreads: [],postLog: [],cachedWebfingers: {}, \
|
||||
personCache: {},debug : bool) -> {}:
|
||||
personCache: {},debug : bool, \
|
||||
projectVersion: str) -> {}:
|
||||
"""Gets the json object for sending a follow request
|
||||
"""
|
||||
if not domainPermitted(followDomain,federationList):
|
||||
|
@ -487,7 +488,8 @@ def sendFollowRequest(session,baseDir: str, \
|
|||
'https://www.w3.org/ns/activitystreams#Public', \
|
||||
httpPrefix,True,clientToServer, \
|
||||
federationList, \
|
||||
sendThreads,postLog,cachedWebfingers,personCache, debug)
|
||||
sendThreads,postLog,cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
|
||||
return newFollowJson
|
||||
|
||||
|
@ -496,7 +498,7 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
followNickname: str,followDomain: str,followPort: int, \
|
||||
httpPrefix: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a follow request via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -527,7 +529,8 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -537,7 +540,8 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
@ -570,7 +574,7 @@ def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
followNickname: str,followDomain: str,followPort: int, \
|
||||
httpPrefix: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a unfollow request via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -602,7 +606,8 @@ def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -612,7 +617,8 @@ def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
14
inbox.py
14
inbox.py
|
@ -83,7 +83,8 @@ def validInboxFilenames(baseDir: str,nickname: str,domain: str, \
|
|||
return False
|
||||
return True
|
||||
|
||||
def getPersonPubKey(session,personUrl: str,personCache: {},debug: bool) -> str:
|
||||
def getPersonPubKey(session,personUrl: str,personCache: {},debug: bool, \
|
||||
projectVersion: str,httpPrefix: str,domain: str) -> str:
|
||||
if not personUrl:
|
||||
return None
|
||||
personUrl=personUrl.replace('#main-key','')
|
||||
|
@ -96,7 +97,7 @@ def getPersonPubKey(session,personUrl: str,personCache: {},debug: bool) -> str:
|
|||
if debug:
|
||||
print('DEBUG: Obtaining public key for '+personUrl)
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
personJson = getJson(session,personUrl,asHeader,None)
|
||||
personJson = getJson(session,personUrl,asHeader,None,projectVersion,httpPrefix,domain)
|
||||
if not personJson:
|
||||
return None
|
||||
pubKey=None
|
||||
|
@ -980,7 +981,8 @@ def restoreQueueItems(baseDir: str,queue: []) -> None:
|
|||
for qfile in queuefiles:
|
||||
queue.append(os.path.join(queueDir, qfile))
|
||||
|
||||
def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
||||
def runInboxQueue(projectVersion: str, \
|
||||
baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {},queue: [], \
|
||||
domain: str,port: int,useTor: bool,federationList: [], \
|
||||
ocapAlways: bool,maxReplies: int, \
|
||||
|
@ -1104,7 +1106,9 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
|||
queue.pop(0)
|
||||
continue
|
||||
|
||||
pubKey=getPersonPubKey(session,keyId,personCache,debug)
|
||||
pubKey= \
|
||||
getPersonPubKey(session,keyId,personCache,debug, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
if pubKey:
|
||||
print('DEBUG: public key: '+str(pubKey))
|
||||
break
|
||||
|
@ -1161,7 +1165,7 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
|||
personCache, \
|
||||
queueJson['post'], \
|
||||
federationList, \
|
||||
debug, \
|
||||
debug,projectVersion, \
|
||||
acceptedCaps=["inbox:write","objects:read"]):
|
||||
if debug:
|
||||
print('DEBUG: Follow accepted from '+keyId)
|
||||
|
|
31
like.py
31
like.py
|
@ -127,7 +127,7 @@ def updateLikesCollection(postFilename: str,objectUrl: str, actor: str,debug: bo
|
|||
def like(session,baseDir: str,federationList: [],nickname: str,domain: str,port: int, \
|
||||
ccList: [],httpPrefix: str,objectUrl: str,clientToServer: bool, \
|
||||
sendThreads: [],postLog: [],personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a like
|
||||
actor is the person doing the liking
|
||||
'to' might be a specific person (actor) whose post was liked
|
||||
|
@ -176,7 +176,8 @@ def like(session,baseDir: str,federationList: [],nickname: str,domain: str,port:
|
|||
likedPostNickname,likedPostDomain,likedPostPort, \
|
||||
'https://www.w3.org/ns/activitystreams#Public', \
|
||||
httpPrefix,True,clientToServer,federationList, \
|
||||
sendThreads,postLog,cachedWebfingers,personCache,debug)
|
||||
sendThreads,postLog,cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
|
||||
return newLikeJson
|
||||
|
||||
|
@ -187,7 +188,7 @@ def likePost(session,baseDir: str,federationList: [], \
|
|||
likeStatusNumber: int,clientToServer: bool, \
|
||||
sendThreads: [],postLog: [], \
|
||||
personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Likes a given status post
|
||||
"""
|
||||
likeDomain=likeDomain
|
||||
|
@ -205,12 +206,13 @@ def likePost(session,baseDir: str,federationList: [], \
|
|||
|
||||
return like(session,baseDir,federationList,nickname,domain,port, \
|
||||
ccList,httpPrefix,objectUrl,clientToServer, \
|
||||
sendThreads,postLog,personCache,cachedWebfingers,debug)
|
||||
sendThreads,postLog,personCache,cachedWebfingers, \
|
||||
debug,projectVersion)
|
||||
|
||||
def undolike(session,baseDir: str,federationList: [],nickname: str,domain: str,port: int, \
|
||||
ccList: [],httpPrefix: str,objectUrl: str,clientToServer: bool, \
|
||||
sendThreads: [],postLog: [],personCache: {},cachedWebfingers: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Removes a like
|
||||
actor is the person doing the liking
|
||||
'to' might be a specific person (actor) whose post was liked
|
||||
|
@ -266,7 +268,8 @@ def undolike(session,baseDir: str,federationList: [],nickname: str,domain: str,p
|
|||
likedPostNickname,likedPostDomain,likedPostPort, \
|
||||
'https://www.w3.org/ns/activitystreams#Public', \
|
||||
httpPrefix,True,clientToServer,federationList, \
|
||||
sendThreads,postLog,cachedWebfingers,personCache,debug)
|
||||
sendThreads,postLog,cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
@ -303,7 +306,7 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,likeUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Creates a like via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -331,7 +334,8 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -341,7 +345,8 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
@ -373,7 +378,7 @@ def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
|||
fromDomain: str,fromPort: int, \
|
||||
httpPrefix: str,likeUrl: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Undo a like via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -405,7 +410,8 @@ def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -415,7 +421,8 @@ def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
|
@ -41,7 +41,8 @@ def manualApproveFollowRequest(session,baseDir: str, \
|
|||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
acceptedCaps: [], \
|
||||
debug: bool) -> None:
|
||||
debug: bool, \
|
||||
projectVersion: str) -> None:
|
||||
"""Manually approve a follow request
|
||||
"""
|
||||
handle=nickname+'@'+domain
|
||||
|
@ -81,7 +82,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
|
|||
followJson,acceptedCaps, \
|
||||
sendThreads,postLog, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug)
|
||||
debug,projectVersion)
|
||||
os.remove(followActivityfilename)
|
||||
else:
|
||||
approvefilenew.write(handle)
|
||||
|
|
74
posts.py
74
posts.py
|
@ -117,8 +117,10 @@ def getUserUrl(wfRequest) -> str:
|
|||
return link['href']
|
||||
return None
|
||||
|
||||
def parseUserFeed(session,feedUrl: str,asHeader: {}) -> None:
|
||||
feedJson = getJson(session,feedUrl,asHeader,None)
|
||||
def parseUserFeed(session,feedUrl: str,asHeader: {}, \
|
||||
projectVersion: str,httpPrefix: str,domain: str) -> None:
|
||||
feedJson = getJson(session,feedUrl,asHeader,None, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
if not feedJson:
|
||||
return
|
||||
|
||||
|
@ -133,10 +135,12 @@ def parseUserFeed(session,feedUrl: str,asHeader: {}) -> None:
|
|||
nextUrl = feedJson['next']
|
||||
|
||||
if nextUrl:
|
||||
for item in parseUserFeed(session,nextUrl,asHeader):
|
||||
for item in parseUserFeed(session,nextUrl,asHeader, \
|
||||
projectVersion,httpPrefix,domain):
|
||||
yield item
|
||||
|
||||
def getPersonBox(session,wfRequest: {},personCache: {}, \
|
||||
projectVersion: str,httpPrefix: str,domain: str, \
|
||||
boxName='inbox') -> (str,str,str,str,str,str,str,str):
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
personUrl = getUserUrl(wfRequest)
|
||||
|
@ -144,7 +148,8 @@ def getPersonBox(session,wfRequest: {},personCache: {}, \
|
|||
return None,None,None,None,None,None,None,None
|
||||
personJson = getPersonFromCache(personUrl,personCache)
|
||||
if not personJson:
|
||||
personJson = getJson(session,personUrl,asHeader,None)
|
||||
personJson = getJson(session,personUrl,asHeader,None, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
if not personJson:
|
||||
return None,None,None,None,None,None,None,None
|
||||
boxJson=None
|
||||
|
@ -195,7 +200,8 @@ def getPosts(session,outboxUrl: str,maxPosts: int, \
|
|||
maxEmoji: int,maxAttachments: int, \
|
||||
federationList: [], \
|
||||
personCache: {},raw: bool, \
|
||||
simple: bool,debug: bool) -> {}:
|
||||
simple: bool,debug: bool, \
|
||||
projectVersion: str,httpPrefix: str,domain: str) -> {}:
|
||||
"""Gets public posts from an outbox
|
||||
"""
|
||||
personPosts={}
|
||||
|
@ -206,7 +212,8 @@ def getPosts(session,outboxUrl: str,maxPosts: int, \
|
|||
if raw:
|
||||
result = []
|
||||
i = 0
|
||||
for item in parseUserFeed(session,outboxUrl,asHeader):
|
||||
for item in parseUserFeed(session,outboxUrl,asHeader, \
|
||||
projectVersion,httpPrefix,domain):
|
||||
result.append(item)
|
||||
i += 1
|
||||
if i == maxPosts:
|
||||
|
@ -215,7 +222,8 @@ def getPosts(session,outboxUrl: str,maxPosts: int, \
|
|||
return None
|
||||
|
||||
i = 0
|
||||
for item in parseUserFeed(session,outboxUrl,asHeader):
|
||||
for item in parseUserFeed(session,outboxUrl,asHeader, \
|
||||
projectVersion,httpPrefix,domain):
|
||||
if not item.get('id'):
|
||||
if debug:
|
||||
print('No id')
|
||||
|
@ -896,7 +904,8 @@ def threadSendPost(session,postJsonObject: {},federationList: [],\
|
|||
time.sleep(backoffTime)
|
||||
backoffTime *= 2
|
||||
|
||||
def sendPost(session,baseDir: str,nickname: str, domain: str, port: int, \
|
||||
def sendPost(projectVersion: str, \
|
||||
session,baseDir: str,nickname: str, domain: str, port: int, \
|
||||
toNickname: str, toDomain: str, toPort: int, cc: str, \
|
||||
httpPrefix: str, content: str, followersOnly: bool, \
|
||||
saveToFile: bool, clientToServer: bool, \
|
||||
|
@ -915,7 +924,8 @@ def sendPost(session,baseDir: str,nickname: str, domain: str, port: int, \
|
|||
handle=httpPrefix+'://'+toDomain+'/@'+toNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
return 1
|
||||
|
||||
|
@ -926,7 +936,8 @@ def sendPost(session,baseDir: str,nickname: str, domain: str, port: int, \
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,postToBox)
|
||||
|
||||
# If there are more than one followers on the target domain
|
||||
# then send to the shared inbox indead of the individual inbox
|
||||
|
@ -982,7 +993,8 @@ def sendPost(session,baseDir: str,nickname: str, domain: str, port: int, \
|
|||
thr.start()
|
||||
return 0
|
||||
|
||||
def sendPostViaServer(baseDir,session,fromNickname: str,password: str, \
|
||||
def sendPostViaServer(projectVersion: str, \
|
||||
baseDir,session,fromNickname: str,password: str, \
|
||||
fromDomain: str, fromPort: int, \
|
||||
toNickname: str, toDomain: str, toPort: int, cc: str, \
|
||||
httpPrefix: str, content: str, followersOnly: bool, \
|
||||
|
@ -1003,7 +1015,8 @@ def sendPostViaServer(baseDir,session,fromNickname: str,password: str, \
|
|||
handle=httpPrefix+'://'+fromDomain+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: webfinger failed for '+handle)
|
||||
|
@ -1013,7 +1026,8 @@ def sendPostViaServer(baseDir,session,fromNickname: str,password: str, \
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
@ -1103,7 +1117,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
|
|||
httpPrefix: str, saveToFile: bool, clientToServer: bool, \
|
||||
federationList: [], \
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {}, \
|
||||
personCache: {}, debug: bool) -> int:
|
||||
personCache: {}, debug: bool,projectVersion: str) -> int:
|
||||
"""Sends a signed json object to an inbox/outbox
|
||||
"""
|
||||
if debug:
|
||||
|
@ -1126,7 +1140,8 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
|
|||
print('DEBUG: handle - '+handle+' toPort '+str(toPort))
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest=webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest=webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: webfinger for '+handle+' failed')
|
||||
|
@ -1139,7 +1154,8 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
|
|||
|
||||
# get the actor inbox/outbox/capabilities for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInboxUrl,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,postToBox)
|
||||
|
||||
if nickname=='capabilities':
|
||||
inboxUrl=capabilityAcquisition
|
||||
|
@ -1209,7 +1225,8 @@ def sendToNamedAddresses(session,baseDir: str, \
|
|||
httpPrefix: str,federationList: [], \
|
||||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
postJsonObject: {},debug: bool) -> None:
|
||||
postJsonObject: {},debug: bool, \
|
||||
projectVersion: str) -> None:
|
||||
"""sends a post to the specific named addresses in to/cc
|
||||
"""
|
||||
if not session:
|
||||
|
@ -1265,14 +1282,15 @@ def sendToNamedAddresses(session,baseDir: str, \
|
|||
cc,httpPrefix,True,clientToServer, \
|
||||
federationList, \
|
||||
sendThreads,postLog,cachedWebfingers, \
|
||||
personCache,debug)
|
||||
personCache,debug,projectVersion)
|
||||
|
||||
def sendToFollowers(session,baseDir: str, \
|
||||
nickname: str, domain: str, port: int, \
|
||||
httpPrefix: str,federationList: [], \
|
||||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
postJsonObject: {},debug: bool) -> None:
|
||||
postJsonObject: {},debug: bool, \
|
||||
projectVersion: str) -> None:
|
||||
"""sends a post to the followers of the given nickname
|
||||
"""
|
||||
if not session:
|
||||
|
@ -1317,7 +1335,7 @@ def sendToFollowers(session,baseDir: str, \
|
|||
cc,httpPrefix,True,clientToServer, \
|
||||
federationList, \
|
||||
sendThreads,postLog,cachedWebfingers, \
|
||||
personCache,debug)
|
||||
personCache,debug,projectVersion)
|
||||
if debug:
|
||||
print('DEBUG: End of sendToFollowers')
|
||||
|
||||
|
@ -1629,7 +1647,7 @@ def archivePostsForPerson(httpPrefix: str,nickname: str,domain: str,baseDir: str
|
|||
def getPublicPostsOfPerson(nickname: str,domain: str, \
|
||||
raw: bool,simple: bool,useTor: bool, \
|
||||
port: int,httpPrefix: str, \
|
||||
debug: bool) -> None:
|
||||
debug: bool,projectVersion: str) -> None:
|
||||
""" This is really just for test purposes
|
||||
"""
|
||||
session = createSession(domain,port,useTor)
|
||||
|
@ -1642,12 +1660,14 @@ def getPublicPostsOfPerson(nickname: str,domain: str, \
|
|||
domainFull=domain+':'+str(port)
|
||||
handle=httpPrefix+"://"+domainFull+"/@"+nickname
|
||||
wfRequest = \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
sys.exit()
|
||||
|
||||
personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,preferredName= \
|
||||
getPersonBox(session,wfRequest,personCache,'outbox')
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,'outbox')
|
||||
wfResult = json.dumps(wfRequest, indent=4, sort_keys=True)
|
||||
|
||||
maxMentions=10
|
||||
|
@ -1655,7 +1675,8 @@ def getPublicPostsOfPerson(nickname: str,domain: str, \
|
|||
maxAttachments=5
|
||||
userPosts = getPosts(session,personUrl,30,maxMentions,maxEmoji, \
|
||||
maxAttachments,federationList, \
|
||||
personCache,raw,simple,debug)
|
||||
personCache,raw,simple,debug, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
#print(str(userPosts))
|
||||
|
||||
def sendCapabilitiesUpdate(session,baseDir: str,httpPrefix: str, \
|
||||
|
@ -1663,7 +1684,8 @@ def sendCapabilitiesUpdate(session,baseDir: str,httpPrefix: str, \
|
|||
followerUrl,updateCaps: [], \
|
||||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
federationList :[],debug :bool) -> int:
|
||||
federationList :[],debug :bool, \
|
||||
projectVersion: str) -> int:
|
||||
"""When the capabilities for a follower are changed this
|
||||
sends out an update. followerUrl is the actor of the follower.
|
||||
"""
|
||||
|
@ -1690,7 +1712,7 @@ def sendCapabilitiesUpdate(session,baseDir: str,httpPrefix: str, \
|
|||
httpPrefix,True,clientToServer, \
|
||||
federationList, \
|
||||
sendThreads,postLog,cachedWebfingers, \
|
||||
personCache,debug)
|
||||
personCache,debug,projectVersion)
|
||||
|
||||
def populateRepliesJson(baseDir: str,nickname: str,domain: str,postRepliesFilename: str,authorized: bool,repliesJson: {}) -> None:
|
||||
# populate the items list with replies
|
||||
|
|
8
roles.py
8
roles.py
|
@ -207,7 +207,7 @@ def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
|||
httpPrefix: str,nickname: str, \
|
||||
project: str,role: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""A delegator creates a role for a person via c2s
|
||||
Setting role to an empty string or None removes the role
|
||||
"""
|
||||
|
@ -243,7 +243,8 @@ def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+delegatorDomainFull+'/@'+delegatorNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
delegatorDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -253,7 +254,8 @@ def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,delegatorDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
|
@ -26,7 +26,7 @@ def createSession(domain: str, port: int, onionRoute: bool):
|
|||
return session
|
||||
|
||||
def getJson(session,url: str,headers: {},params: {}, \
|
||||
version='0.01',httpPrefix='https',domain='testdomain') -> {}:
|
||||
version='0.0.1',httpPrefix='https',domain='testdomain') -> {}:
|
||||
sessionParams={}
|
||||
sessionHeaders={}
|
||||
if headers:
|
||||
|
|
17
shares.py
17
shares.py
|
@ -274,7 +274,8 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
|||
location: str, \
|
||||
duration: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool, \
|
||||
projectVersion: str) -> {}:
|
||||
"""Creates an item share via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -310,7 +311,8 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -320,7 +322,8 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
@ -359,7 +362,7 @@ def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
|||
httpPrefix: str, \
|
||||
displayName: str, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Undoes a share via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -390,7 +393,8 @@ def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -400,7 +404,8 @@ def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
|
@ -90,7 +90,7 @@ def sendSkillViaServer(session,nickname: str,password: str,
|
|||
httpPrefix: str, \
|
||||
skill: str,skillLevelPercent: int, \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool) -> {}:
|
||||
debug: bool,projectVersion: str) -> {}:
|
||||
"""Sets a skill for a person via c2s
|
||||
"""
|
||||
if not session:
|
||||
|
@ -119,7 +119,8 @@ def sendSkillViaServer(session,nickname: str,password: str,
|
|||
handle=httpPrefix+'://'+domainFull+'/@'+nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers)
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
print('DEBUG: announce webfinger failed for '+handle)
|
||||
|
@ -129,7 +130,8 @@ def sendSkillViaServer(session,nickname: str,password: str,
|
|||
|
||||
# get the actor inbox for the To handle
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,postToBox)
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,postToBox)
|
||||
|
||||
if not inboxUrl:
|
||||
if debug:
|
||||
|
|
40
tests.py
40
tests.py
|
@ -191,7 +191,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerAliceRunning
|
||||
testServerAliceRunning = True
|
||||
print('Server running: Alice')
|
||||
runDaemon("instanceId",False,path,domain,port,port, \
|
||||
runDaemon(__version__,"instanceId",False,path,domain,port,port, \
|
||||
httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies, \
|
||||
|
@ -244,7 +244,7 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerBobRunning
|
||||
testServerBobRunning = True
|
||||
print('Server running: Bob')
|
||||
runDaemon("instanceId",False,path,domain,port,port, \
|
||||
runDaemon(__version__,"instanceId",False,path,domain,port,port, \
|
||||
httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies, \
|
||||
|
@ -277,7 +277,7 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerEveRunning
|
||||
testServerEveRunning = True
|
||||
print('Server running: Eve')
|
||||
runDaemon("instanceId",False,path,domain,port,port, \
|
||||
runDaemon(__version__,"instanceId",False,path,domain,port,port, \
|
||||
httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies,allowDeletion,True)
|
||||
|
@ -354,7 +354,8 @@ def testPostMessageBetweenServers():
|
|||
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==0
|
||||
|
||||
sendResult = \
|
||||
sendPost(sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
|
||||
sendPost(__version__, \
|
||||
sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
|
||||
'bob', bobDomain, bobPort, ccUrl, httpPrefix, \
|
||||
'Why is a mouse when it spins? #sillyquestion', followersOnly, \
|
||||
saveToFile, clientToServer,attachedImageFilename, \
|
||||
|
@ -410,7 +411,8 @@ def testPostMessageBetweenServers():
|
|||
'bob',bobDomain,bobPort,httpPrefix, \
|
||||
'alice',aliceDomain,alicePort,[], \
|
||||
statusNumber,False,bobSendThreads,bobPostLog, \
|
||||
bobPersonCache,bobCachedWebfingers,True)
|
||||
bobPersonCache,bobCachedWebfingers, \
|
||||
True,__version__)
|
||||
|
||||
for i in range(20):
|
||||
if 'likes' in open(outboxPostFilename).read():
|
||||
|
@ -436,7 +438,7 @@ def testPostMessageBetweenServers():
|
|||
objectUrl, \
|
||||
False,bobSendThreads,bobPostLog, \
|
||||
bobPersonCache,bobCachedWebfingers, \
|
||||
True)
|
||||
True,__version__)
|
||||
announceMessageArrived=False
|
||||
for i in range(10):
|
||||
time.sleep(1)
|
||||
|
@ -558,7 +560,8 @@ def testFollowBetweenServers():
|
|||
'bob',bobDomain,bobPort,httpPrefix, \
|
||||
clientToServer,federationList, \
|
||||
aliceSendThreads,alicePostLog, \
|
||||
aliceCachedWebfingers,alicePersonCache,True)
|
||||
aliceCachedWebfingers,alicePersonCache, \
|
||||
True,__version__)
|
||||
print('sendResult: '+str(sendResult))
|
||||
|
||||
bobCapsFilename=bobDir+'/accounts/bob@'+bobDomain+'/ocap/accept/'+httpPrefix+':##'+aliceDomain+':'+str(alicePort)+'#users#alice.json'
|
||||
|
@ -592,7 +595,8 @@ def testFollowBetweenServers():
|
|||
evePostLog=[]
|
||||
useBlurhash=False
|
||||
sendResult = \
|
||||
sendPost(sessionEve,eveDir,'eve', eveDomain, evePort, \
|
||||
sendPost(__version__, \
|
||||
sessionEve,eveDir,'eve', eveDomain, evePort, \
|
||||
'bob', bobDomain, bobPort, ccUrl, \
|
||||
httpPrefix, 'Eve message', followersOnly, \
|
||||
saveToFile, clientToServer,None,None, \
|
||||
|
@ -626,7 +630,8 @@ def testFollowBetweenServers():
|
|||
alicePostLog=[]
|
||||
useBlurhash=False
|
||||
sendResult = \
|
||||
sendPost(sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
|
||||
sendPost(__version__, \
|
||||
sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
|
||||
'bob', bobDomain, bobPort, ccUrl, \
|
||||
httpPrefix, 'Alice message', followersOnly, saveToFile, \
|
||||
clientToServer,None,None,useBlurhash, federationList, \
|
||||
|
@ -679,7 +684,7 @@ def testFollowBetweenServers():
|
|||
newCapabilities, \
|
||||
bobSendThreads, bobPostLog, \
|
||||
bobCachedWebfingers,bobPersonCache, \
|
||||
federationList,True)
|
||||
federationList,True,__version__)
|
||||
|
||||
bobChanged=False
|
||||
bobNewCapsJson=None
|
||||
|
@ -1120,7 +1125,8 @@ def testClientToServer():
|
|||
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==0
|
||||
assert len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==0
|
||||
sendResult= \
|
||||
sendPostViaServer(aliceDir,sessionAlice,'alice',password, \
|
||||
sendPostViaServer(__version__, \
|
||||
aliceDir,sessionAlice,'alice',password, \
|
||||
aliceDomain,alicePort, \
|
||||
'bob',bobDomain,bobPort,None, \
|
||||
httpPrefix,'Sent from my ActivityPub client',followersOnly, \
|
||||
|
@ -1170,7 +1176,7 @@ def testClientToServer():
|
|||
'bob',bobDomain,bobPort, \
|
||||
httpPrefix, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for t in range(10):
|
||||
if os.path.isfile(bobDir+'/accounts/bob@'+bobDomain+'/followers.txt'):
|
||||
if 'alice@'+aliceDomain+':'+str(alicePort) in open(bobDir+'/accounts/bob@'+bobDomain+'/followers.txt').read():
|
||||
|
@ -1192,7 +1198,7 @@ def testClientToServer():
|
|||
'alice',aliceDomain,alicePort, \
|
||||
httpPrefix, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for t in range(10):
|
||||
if os.path.isfile(aliceDir+'/accounts/alice@'+aliceDomain+'/followers.txt'):
|
||||
if 'bob@'+bobDomain+':'+str(bobPort) in open(aliceDir+'/accounts/alice@'+aliceDomain+'/followers.txt').read():
|
||||
|
@ -1220,7 +1226,7 @@ def testClientToServer():
|
|||
bobDomain,bobPort, \
|
||||
httpPrefix,outboxPostId, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(20):
|
||||
if os.path.isdir(outboxPath) and os.path.isdir(inboxPath):
|
||||
if len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==2:
|
||||
|
@ -1240,7 +1246,7 @@ def testClientToServer():
|
|||
bobDomain,bobPort, \
|
||||
httpPrefix,outboxPostId, \
|
||||
cachedWebfingers, \
|
||||
personCache,True)
|
||||
personCache,True,__version__)
|
||||
for i in range(20):
|
||||
if os.path.isdir(outboxPath) and os.path.isdir(inboxPath):
|
||||
if len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==3:
|
||||
|
@ -1262,7 +1268,7 @@ def testClientToServer():
|
|||
aliceDomain,alicePort, \
|
||||
httpPrefix,outboxPostId, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for i in range(30):
|
||||
if os.path.isdir(inboxPath):
|
||||
if len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==postsBefore-1:
|
||||
|
@ -1282,7 +1288,7 @@ def testClientToServer():
|
|||
'bob',bobDomain,bobPort, \
|
||||
httpPrefix, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
True,__version__)
|
||||
for t in range(10):
|
||||
if 'alice@'+aliceDomain+':'+str(alicePort) not in open(bobDir+'/accounts/bob@'+bobDomain+'/followers.txt').read():
|
||||
if 'bob@'+bobDomain+':'+str(bobPort) not in open(aliceDir+'/accounts/alice@'+aliceDomain+'/following.txt').read():
|
||||
|
|
|
@ -35,7 +35,8 @@ def parseHandle(handle: str) -> (str,str):
|
|||
|
||||
return nickname, domain
|
||||
|
||||
def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}) -> {}:
|
||||
def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}, \
|
||||
fromDomain: str,projectVersion: str) -> {}:
|
||||
if not session:
|
||||
print('WARN: No session specified for webfingerHandle')
|
||||
return None
|
||||
|
@ -55,7 +56,7 @@ def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}) ->
|
|||
par = {'resource': 'acct:{}'.format(nickname+'@'+wfDomain)}
|
||||
hdr = {'Accept': 'application/jrd+json'}
|
||||
try:
|
||||
result = getJson(session, url, hdr, par)
|
||||
result = getJson(session, url, hdr, par,projectVersion,httpPrefix,fromDomain)
|
||||
except:
|
||||
print("Unable to webfinger " + url)
|
||||
print('headers: '+str(hdr))
|
||||
|
|
|
@ -153,7 +153,8 @@ def htmlModerationInfo(baseDir: str) -> str:
|
|||
return infoForm
|
||||
|
||||
def htmlHashtagSearch(baseDir: str,hashtag: str,pageNumber: int,postsPerPage: int,
|
||||
session,wfRequest: {},personCache: {}) -> str:
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show a page containing search results for a hashtag
|
||||
"""
|
||||
if hashtag.startswith('#'):
|
||||
|
@ -204,7 +205,9 @@ def htmlHashtagSearch(baseDir: str,hashtag: str,pageNumber: int,postsPerPage: in
|
|||
hashtagSearchForm+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,postJsonObject, \
|
||||
None,True,False,False)
|
||||
None,True,False, \
|
||||
httpPrefix,projectVersion, \
|
||||
False)
|
||||
index-=1
|
||||
|
||||
if endIndex>0:
|
||||
|
@ -643,7 +646,8 @@ def htmlFooter() -> str:
|
|||
def htmlProfilePosts(baseDir: str,httpPrefix: str, \
|
||||
authorized: bool,ocapAlways: bool, \
|
||||
nickname: str,domain: str,port: int, \
|
||||
session,wfRequest: {},personCache: {}) -> str:
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
projectVersion: str) -> str:
|
||||
"""Shows posts on the profile screen
|
||||
"""
|
||||
profileStr=''
|
||||
|
@ -659,14 +663,16 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \
|
|||
if item['type']=='Create' or item['type']=='Announce':
|
||||
profileStr+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,item,None,True,False,False)
|
||||
nickname,domain,port,item,None,True,False, \
|
||||
httpPrefix,projectVersion, \
|
||||
False)
|
||||
return profileStr
|
||||
|
||||
def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
||||
authorized: bool,ocapAlways: bool, \
|
||||
nickname: str,domain: str,port: int, \
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
followingJson: {}, \
|
||||
followingJson: {},projectVersion: str, \
|
||||
buttons: []) -> str:
|
||||
"""Shows following on the profile screen
|
||||
"""
|
||||
|
@ -674,7 +680,9 @@ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
|||
for item in followingJson['orderedItems']:
|
||||
profileStr+= \
|
||||
individualFollowAsHtml(session,wfRequest,personCache, \
|
||||
domain,item,authorized,nickname,buttons)
|
||||
domain,item,authorized,nickname, \
|
||||
httpPrefix,projectVersion, \
|
||||
buttons)
|
||||
return profileStr
|
||||
|
||||
def htmlProfileRoles(nickname: str,domain: str,rolesJson: {}) -> str:
|
||||
|
@ -724,7 +732,8 @@ def htmlProfileShares(nickname: str,domain: str,sharesJson: {}) -> str:
|
|||
profileStr='<div class="share-title">'+profileStr+'</div>'
|
||||
return profileStr
|
||||
|
||||
def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
||||
def htmlProfile(projectVersion: str, \
|
||||
baseDir: str,httpPrefix: str,authorized: bool, \
|
||||
ocapAlways: bool,profileJson: {},selected: str, \
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
extraJson=None) -> str:
|
||||
|
@ -837,13 +846,15 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
|||
profileStr+= \
|
||||
htmlProfilePosts(baseDir,httpPrefix,authorized, \
|
||||
ocapAlways,nickname,domain,port, \
|
||||
session,wfRequest,personCache)
|
||||
session,wfRequest,personCache, \
|
||||
projectVersion)
|
||||
if selected=='following':
|
||||
profileStr+= \
|
||||
htmlProfileFollowing(baseDir,httpPrefix, \
|
||||
authorized,ocapAlways,nickname, \
|
||||
domain,port,session, \
|
||||
wfRequest,personCache,extraJson, \
|
||||
projectVersion, \
|
||||
["unfollow"])
|
||||
if selected=='followers':
|
||||
profileStr+= \
|
||||
|
@ -851,6 +862,7 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
|||
authorized,ocapAlways,nickname, \
|
||||
domain,port,session, \
|
||||
wfRequest,personCache,extraJson, \
|
||||
projectVersion,
|
||||
["block"])
|
||||
if selected=='roles':
|
||||
profileStr+= \
|
||||
|
@ -869,6 +881,8 @@ def individualFollowAsHtml(session,wfRequest: {}, \
|
|||
followUrl: str, \
|
||||
authorized: bool, \
|
||||
actorNickname: str, \
|
||||
httpPrefix: str, \
|
||||
projectVersion: str, \
|
||||
buttons=[]) -> str:
|
||||
nickname=getNicknameFromActor(followUrl)
|
||||
domain,port=getDomainFromActor(followUrl)
|
||||
|
@ -876,7 +890,8 @@ def individualFollowAsHtml(session,wfRequest: {}, \
|
|||
avatarUrl=followUrl+'/avatar.png'
|
||||
if domain not in followUrl:
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,'outbox')
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,'outbox')
|
||||
if avatarUrl2:
|
||||
avatarUrl=avatarUrl2
|
||||
if preferredName:
|
||||
|
@ -916,7 +931,9 @@ def individualPostAsHtml(baseDir: str, \
|
|||
nickname: str,domain: str,port: int, \
|
||||
postJsonObject: {}, \
|
||||
avatarUrl: str, showAvatarDropdown: bool,
|
||||
allowDeletion: bool,showIcons=False) -> str:
|
||||
allowDeletion: bool, \
|
||||
httpPrefix: str, projectVersion: str, \
|
||||
showIcons=False) -> str:
|
||||
""" Shows a single post as html
|
||||
"""
|
||||
titleStr=''
|
||||
|
@ -925,7 +942,7 @@ def individualPostAsHtml(baseDir: str, \
|
|||
if isinstance(postJsonObject['object'], str):
|
||||
# get the announced post
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
announcedJson = getJson(session,postJsonObject['object'],asHeader,None)
|
||||
announcedJson = getJson(session,postJsonObject['object'],asHeader,None,projectVersion,httpPrefix,domain)
|
||||
if announcedJson:
|
||||
if not announcedJson.get('type'):
|
||||
return ''
|
||||
|
@ -1000,7 +1017,8 @@ def individualPostAsHtml(baseDir: str, \
|
|||
|
||||
if fullDomain not in postJsonObject['actor']:
|
||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
||||
getPersonBox(session,wfRequest,personCache,'outbox')
|
||||
getPersonBox(session,wfRequest,personCache, \
|
||||
projectVersion,httpPrefix,domain,'outbox')
|
||||
if avatarUrl2:
|
||||
avatarUrl=avatarUrl2
|
||||
if preferredName:
|
||||
|
@ -1129,7 +1147,8 @@ def individualPostAsHtml(baseDir: str, \
|
|||
def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \
|
||||
wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,timelineJson: {}, \
|
||||
boxName: str,allowDeletion: bool) -> str:
|
||||
boxName: str,allowDeletion: bool, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the timeline as html
|
||||
"""
|
||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||
|
@ -1212,7 +1231,9 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \
|
|||
itemCtr+=1
|
||||
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,item,None,True, \
|
||||
allowDeletion,showIndividualPostIcons)
|
||||
allowDeletion, \
|
||||
httpPrefix,projectVersion,
|
||||
showIndividualPostIcons)
|
||||
|
||||
# page down arrow
|
||||
if itemCtr>=itemsPerPage:
|
||||
|
@ -1223,39 +1244,46 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \
|
|||
def htmlInbox(pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||
allowDeletion: bool) -> str:
|
||||
allowDeletion: bool, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the inbox as html
|
||||
"""
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,inboxJson,'inbox',allowDeletion)
|
||||
nickname,domain,port,inboxJson,'inbox',allowDeletion, \
|
||||
httpPrefix,projectVersion)
|
||||
|
||||
def htmlModeration(pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||
allowDeletion: bool) -> str:
|
||||
allowDeletion: bool, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the moderation feed as html
|
||||
"""
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,inboxJson,'moderation',allowDeletion)
|
||||
nickname,domain,port,inboxJson,'moderation',allowDeletion, \
|
||||
httpPrefix,projectVersion)
|
||||
|
||||
def htmlOutbox(pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,outboxJson: {}, \
|
||||
allowDeletion: bool) -> str:
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the Outbox as html
|
||||
"""
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,outboxJson,'outbox',allowDeletion)
|
||||
nickname,domain,port,outboxJson,'outbox',allowDeletion, \
|
||||
httpPrefix,projectVersion)
|
||||
|
||||
def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,authorized: bool, \
|
||||
postJsonObject: {}) -> str:
|
||||
postJsonObject: {},httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show an individual post as html
|
||||
"""
|
||||
postStr='<script>'+contentWarningScript()+'</script>'
|
||||
postStr+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,postJsonObject,None,True,False,False)
|
||||
nickname,domain,port,postJsonObject,None,True,False, \
|
||||
httpPrefix,projectVersion,False)
|
||||
messageId=postJsonObject['id'].replace('/activity','')
|
||||
|
||||
# show the previous posts
|
||||
|
@ -1268,7 +1296,9 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
|||
postStr= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,postJsonObject, \
|
||||
None,True,False,False)+postStr
|
||||
None,True,False, \
|
||||
httpPrefix,projectVersion, \
|
||||
False)+postStr
|
||||
|
||||
# show the following posts
|
||||
postFilename=locatePost(baseDir,nickname,domain,messageId)
|
||||
|
@ -1283,18 +1313,21 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
|||
for item in repliesJson['orderedItems']:
|
||||
postStr+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,item,None,True,False,False)
|
||||
nickname,domain,port,item,None,True,False, \
|
||||
httpPrefix,projectVersion,False)
|
||||
return htmlHeader()+postStr+htmlFooter()
|
||||
|
||||
def htmlPostReplies(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,repliesJson: {}) -> str:
|
||||
nickname: str,domain: str,port: int,repliesJson: {}, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the replies to an individual post as html
|
||||
"""
|
||||
repliesStr=''
|
||||
if repliesJson.get('orderedItems'):
|
||||
for item in repliesJson['orderedItems']:
|
||||
repliesStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,item,None,True,False,False)
|
||||
nickname,domain,port,item,None,True,False, \
|
||||
httpPrefix,projectVersion,False)
|
||||
|
||||
return htmlHeader()+repliesStr+htmlFooter()
|
||||
|
||||
|
@ -1453,7 +1486,7 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
|||
nickname: str,domain: str,port: int, \
|
||||
profileHandle: str, \
|
||||
session,wfRequest: {},personCache: {},
|
||||
debug: bool) -> str:
|
||||
debug: bool,projectVersion: str) -> str:
|
||||
"""Show a profile page after a search for a fediverse address
|
||||
"""
|
||||
if '/users/' in profileHandle:
|
||||
|
@ -1491,14 +1524,15 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
|||
|
||||
profileStr=''
|
||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||
wf = webfingerHandle(session,searchNickname+'@'+searchDomainFull,httpPrefix,wfRequest)
|
||||
wf = webfingerHandle(session,searchNickname+'@'+searchDomainFull,httpPrefix,wfRequest, \
|
||||
domain,projectVersion)
|
||||
if not wf:
|
||||
if debug:
|
||||
print('DEBUG: Unable to webfinger '+searchNickname+'@'+searchDomainFull)
|
||||
return None
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
personUrl = getUserUrl(wf)
|
||||
profileJson = getJson(session,personUrl,asHeader,None)
|
||||
profileJson = getJson(session,personUrl,asHeader,None,projectVersion,httpPrefix,domain)
|
||||
if not profileJson:
|
||||
if debug:
|
||||
print('DEBUG: No actor returned from '+personUrl)
|
||||
|
@ -1566,7 +1600,8 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
|||
individualPostAsHtml(baseDir, \
|
||||
session,wfRequest,personCache, \
|
||||
nickname,domain,port, \
|
||||
item,avatarUrl,False,False,False)
|
||||
item,avatarUrl,False,False, \
|
||||
httpPrefix,projectVersion,False)
|
||||
i+=1
|
||||
if i>=20:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue