mirror of https://gitlab.com/bashrc2/epicyon
Ensure port numbers are attached when needed
parent
972bceeafa
commit
707cbd7d56
|
@ -34,7 +34,9 @@ def createAcceptReject(baseDir: str,federationList: [], \
|
|||
if not urlPermitted(objectJson['actor'],federationList,"inbox:write"):
|
||||
return None
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
newAccept = {
|
||||
|
|
10
announce.py
10
announce.py
|
@ -186,7 +186,9 @@ def createAnnounce(session,baseDir: str,federationList: [], \
|
|||
if ':' in domain:
|
||||
domain=domain.split(':')[0]
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
statusNumber,published = getStatusNumber()
|
||||
|
@ -238,6 +240,7 @@ def announcePublic(session,baseDir: str,federationList: [], \
|
|||
"""Makes a public announcement
|
||||
"""
|
||||
fromDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fromDomain=domain+':'+str(port)
|
||||
|
@ -263,6 +266,7 @@ def repeatPost(session,baseDir: str,federationList: [], \
|
|||
"""Repeats a given status post
|
||||
"""
|
||||
announcedDomain=announceDomain
|
||||
if announcePort:
|
||||
if announcePort!=80 and announcePort!=443:
|
||||
if ':' not in announcedDomain:
|
||||
announcedDomain=announcedDomain+':'+str(announcePort)
|
||||
|
@ -297,7 +301,9 @@ def undoAnnounce(session,baseDir: str,federationList: [], \
|
|||
if ':' in domain:
|
||||
domain=domain.split(':')[0]
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
newUndoAnnounce = {
|
||||
|
@ -343,6 +349,7 @@ def undoAnnouncePublic(session,baseDir: str,federationList: [], \
|
|||
"""Undoes a public announcement
|
||||
"""
|
||||
fromDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fromDomain=domain+':'+str(port)
|
||||
|
@ -368,6 +375,7 @@ def undoRepeatPost(session,baseDir: str,federationList: [], \
|
|||
"""Undoes a status post repeat
|
||||
"""
|
||||
announcedDomain=announceDomain
|
||||
if announcePort:
|
||||
if announcePort!=80 and announcePort!=443:
|
||||
if ':' not in announcedDomain:
|
||||
announcedDomain=announcedDomain+':'+str(announcePort)
|
||||
|
@ -396,7 +404,9 @@ def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
|||
withDigest=True
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
|
|
@ -81,7 +81,9 @@ def sendAvailabilityViaServer(session,nickname: str,password: str,
|
|||
return 6
|
||||
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
||||
toUrl = httpPrefix+'://'+domainFull+'/users/'+nickname
|
||||
|
|
|
@ -148,7 +148,9 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
@ -218,7 +220,9 @@ def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
@ -326,6 +330,7 @@ def outboxBlock(baseDir: str,httpPrefix: str, \
|
|||
domainBlockedFull=domainBlocked
|
||||
if portBlocked:
|
||||
if portBlocked!=80 and portBlocked!=443:
|
||||
if ':' not in domainBlocked:
|
||||
domainBlockedFull=domainBlocked+':'+str(portBlocked)
|
||||
|
||||
addBlock(baseDir,nickname,domain, \
|
||||
|
@ -397,6 +402,7 @@ def outboxUndoBlock(baseDir: str,httpPrefix: str, \
|
|||
domainBlockedFull=domainBlocked
|
||||
if portBlocked:
|
||||
if portBlocked!=80 and portBlocked!=443:
|
||||
if ':' not in domainBlocked:
|
||||
domainBlockedFull=domainBlocked+':'+str(portBlocked)
|
||||
|
||||
removeBlock(baseDir,nickname,domain, \
|
||||
|
|
|
@ -110,7 +110,9 @@ def capabilitiesAccept(baseDir: str,httpPrefix: str, \
|
|||
return None
|
||||
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port !=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
# make directories to store capabilities
|
||||
|
@ -169,7 +171,9 @@ def capabilitiesUpdate(baseDir: str,httpPrefix: str, \
|
|||
return None
|
||||
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port !=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
# Get the filename of the capability
|
||||
|
|
|
@ -2271,6 +2271,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
fullBlockDomain=blockDomain
|
||||
if blockPort:
|
||||
if blockPort!=80 and blockPort!=443:
|
||||
if ':' not in blockDomain:
|
||||
fullBlockDomain=blockDomain+':'+str(blockPort)
|
||||
if '@' in moderationText:
|
||||
fullBlockDomain=moderationText.split('@')[1]
|
||||
|
@ -2285,6 +2286,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
fullBlockDomain=blockDomain
|
||||
if blockPort:
|
||||
if blockPort!=80 and blockPort!=443:
|
||||
if ':' not in blockDomain:
|
||||
fullBlockDomain=blockDomain+':'+str(blockPort)
|
||||
if '@' in moderationText:
|
||||
fullBlockDomain=moderationText.split('@')[1]
|
||||
|
@ -2487,6 +2489,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
blockingDomainFull=blockingDomain
|
||||
if blockingPort:
|
||||
if blockingPort!=80 and blockingPort!=443:
|
||||
if ':' not in blockingDomain:
|
||||
blockingDomainFull=blockingDomain+':'+str(blockingPort)
|
||||
if blockerNickname==blockingNickname and \
|
||||
blockingDomain==self.server.domain and \
|
||||
|
@ -2517,6 +2520,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
blockingDomainFull=blockingDomain
|
||||
if blockingPort:
|
||||
if blockingPort!=80 and blockingPort!=443:
|
||||
if ':' not in blockingDomain:
|
||||
blockingDomainFull=blockingDomain+':'+str(blockingPort)
|
||||
if blockerNickname==blockingNickname and \
|
||||
blockingDomain==self.server.domain and \
|
||||
|
@ -2813,7 +2817,9 @@ def runDaemon(projectVersion, \
|
|||
httpd.domain=domain
|
||||
httpd.port=port
|
||||
httpd.domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
httpd.domainFull=domain+':'+str(port)
|
||||
httpd.httpPrefix=httpPrefix
|
||||
httpd.debug=debug
|
||||
|
|
|
@ -42,7 +42,9 @@ def createDelete(session,baseDir: str,federationList: [], \
|
|||
if ':' in domain:
|
||||
domain=domain.split(':')[0]
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
statusNumber,published = getStatusNumber()
|
||||
|
@ -91,7 +93,9 @@ def sendDeleteViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
@ -157,6 +161,7 @@ def deletePublic(session,baseDir: str,federationList: [], \
|
|||
"""Makes a public delete activity
|
||||
"""
|
||||
fromDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fromDomain=domain+':'+str(port)
|
||||
|
@ -182,6 +187,7 @@ def deletePostPub(session,baseDir: str,federationList: [], \
|
|||
"""Deletes a given status post
|
||||
"""
|
||||
deletedDomain=deleteDomain
|
||||
if deletePort:
|
||||
if deletePort!=80 and deletePort!=443:
|
||||
if ':' not in deletedDomain:
|
||||
deletedDomain=deletedDomain+':'+str(deletePort)
|
||||
|
|
26
follow.py
26
follow.py
|
@ -42,6 +42,7 @@ def isFollowingActor(baseDir: str,nickname: str,domain: str,actor: str) -> bool:
|
|||
followerHandle=followerNickname+'@'+followerDomain
|
||||
if followerPort:
|
||||
if followerPort!=80 and followerPort!=443:
|
||||
if ':' not in followerHandle:
|
||||
followerHandle+=':'+str(followerPort)
|
||||
if followerHandle in open(followersFile).read():
|
||||
return True
|
||||
|
@ -208,7 +209,9 @@ def getFollowingFeed(baseDir: str,domain: str,port: int,path: str, \
|
|||
if not validNickname(nickname):
|
||||
return None
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
if headerOnly:
|
||||
|
@ -299,10 +302,11 @@ def storeFollowRequest(baseDir: str, \
|
|||
if not os.path.isdir(accountsDir):
|
||||
return False
|
||||
|
||||
if port!=80 and port!=443:
|
||||
approveHandle=nickname+'@'+domain+':'+str(fromPort)
|
||||
else:
|
||||
approveHandle=nickname+'@'+domain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in domain:
|
||||
approveHandle=nickname+'@'+domain+':'+str(fromPort)
|
||||
|
||||
# add to a file which contains a list of requests
|
||||
approveFollowsFilename=accountsDir+'/followrequests.txt'
|
||||
|
@ -353,6 +357,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
if tempPort:
|
||||
fromPort=tempPort
|
||||
if tempPort!=80 and tempPort!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(tempPort)
|
||||
if not domainPermitted(domain,federationList):
|
||||
if debug:
|
||||
|
@ -378,6 +383,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
domainToFollowFull=domainToFollow
|
||||
if tempPort:
|
||||
if tempPort!=80 and tempPort!=443:
|
||||
if ':' not in domainToFollow:
|
||||
domainToFollowFull=domainToFollow+':'+str(tempPort)
|
||||
nicknameToFollow=getNicknameFromActor(messageJson['object'])
|
||||
if not nicknameToFollow:
|
||||
|
@ -467,12 +473,16 @@ def sendFollowRequest(session,baseDir: str, \
|
|||
|
||||
fullDomain=domain
|
||||
followActor=httpPrefix+'://'+domain+'/users/'+nickname
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
followActor=httpPrefix+'://'+domain+':'+str(port)+'/users/'+nickname
|
||||
|
||||
requestDomain=followDomain
|
||||
if followPort:
|
||||
if followPort!=80 and followPort!=443:
|
||||
if ':' not in followDomain:
|
||||
requestDomain=followDomain+':'+str(followPort)
|
||||
|
||||
statusNumber,published = getStatusNumber()
|
||||
|
@ -511,11 +521,15 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
followDomainFull=followDomain
|
||||
if followPort:
|
||||
if followPort!=80 and followPort!=443:
|
||||
if ':' not in followDomain:
|
||||
followDomainFull=followDomain+':'+str(followPort)
|
||||
|
||||
followActor=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname
|
||||
|
@ -587,10 +601,14 @@ def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
followDomainFull=followDomain
|
||||
if followPort:
|
||||
if followPort!=80 and followPort!=443:
|
||||
if ':' not in followDomain:
|
||||
followDomainFull=followDomain+':'+str(followPort)
|
||||
|
||||
followActor=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname
|
||||
|
@ -745,6 +763,7 @@ def outboxUndoFollow(baseDir: str,messageJson: {},debug: bool) -> None:
|
|||
domainFollowerFull=domainFollower
|
||||
if portFollower:
|
||||
if portFollower!=80 and portFollower!=443:
|
||||
if ':' not in domainFollower:
|
||||
domainFollowerFull=domainFollower+':'+str(portFollower)
|
||||
|
||||
nicknameFollowing=getNicknameFromActor(messageJson['object']['object'])
|
||||
|
@ -752,6 +771,7 @@ def outboxUndoFollow(baseDir: str,messageJson: {},debug: bool) -> None:
|
|||
domainFollowingFull=domainFollowing
|
||||
if portFollowing:
|
||||
if portFollowing!=80 and portFollowing!=443:
|
||||
if ':' not in domainFollowing:
|
||||
domainFollowingFull=domainFollowing+':'+str(portFollowing)
|
||||
|
||||
if unfollowPerson(baseDir,nicknameFollower,domainFollowerFull, \
|
||||
|
|
6
inbox.py
6
inbox.py
|
@ -187,6 +187,7 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str
|
|||
return None
|
||||
if postPort:
|
||||
if postPort!=80 and postPort!=443:
|
||||
if ':' not in postDomain:
|
||||
postDomain=postDomain+':'+str(postPort)
|
||||
|
||||
if postJsonObject.get('object'):
|
||||
|
@ -368,7 +369,9 @@ def inboxPostRecipients(baseDir :str,postJsonObject :{},httpPrefix :str,domain :
|
|||
if ':' in domain:
|
||||
domain=domain.split(':')[0]
|
||||
domainBase=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
domainMatch='/'+domain+'/users/'
|
||||
|
||||
|
@ -485,6 +488,7 @@ def receiveUndoFollow(session,baseDir: str,httpPrefix: str, \
|
|||
domainFollowerFull=domainFollower
|
||||
if portFollower:
|
||||
if portFollower!=80 and portFollower!=443:
|
||||
if ':' not in domainFollower:
|
||||
domainFollowerFull=domainFollower+':'+str(portFollower)
|
||||
|
||||
nicknameFollowing=getNicknameFromActor(messageJson['object']['object'])
|
||||
|
@ -492,6 +496,7 @@ def receiveUndoFollow(session,baseDir: str,httpPrefix: str, \
|
|||
domainFollowingFull=domainFollowing
|
||||
if portFollowing:
|
||||
if portFollowing!=80 and portFollowing!=443:
|
||||
if ':' not in domainFollowing:
|
||||
domainFollowingFull=domainFollowing+':'+str(portFollowing)
|
||||
|
||||
if unfollowerOfPerson(baseDir, \
|
||||
|
@ -719,6 +724,7 @@ def receiveDelete(session,handle: str,baseDir: str, \
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
deletePrefix=httpPrefix+'://'+domainFull+'/'
|
||||
if not allowDeletion and \
|
||||
|
|
23
like.py
23
like.py
|
@ -137,6 +137,7 @@ def like(session,baseDir: str,federationList: [],nickname: str,domain: str,port:
|
|||
return None
|
||||
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
@ -196,6 +197,7 @@ def likePost(session,baseDir: str,federationList: [], \
|
|||
"""Likes a given status post
|
||||
"""
|
||||
likeDomain=likeDomain
|
||||
if likePort:
|
||||
if likePort!=80 and likePort!=443:
|
||||
if ':' not in likeDomain:
|
||||
likeDomain=likeDomain+':'+str(likePort)
|
||||
|
@ -204,10 +206,11 @@ def likePost(session,baseDir: str,federationList: [], \
|
|||
httpPrefix + '://'+likeDomain+'/users/'+likeNickname+ \
|
||||
'/statuses/'+str(likeStatusNumber)
|
||||
|
||||
if likePort!=80 and likePort!=443:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+':'+str(likePort)+'/users/'+likeNickname
|
||||
else:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+'/users/'+likeNickname
|
||||
if likePort:
|
||||
if likePort!=80 and likePort!=443:
|
||||
if ':' not in likeDomain:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+':'+str(likePort)+'/users/'+likeNickname
|
||||
|
||||
return like(session,baseDir,federationList,nickname,domain,port, \
|
||||
ccList,httpPrefix,objectUrl,clientToServer, \
|
||||
|
@ -227,6 +230,7 @@ def undolike(session,baseDir: str,federationList: [],nickname: str,domain: str,p
|
|||
return None
|
||||
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
@ -291,17 +295,20 @@ def undoLikePost(session,baseDir: str,federationList: [], \
|
|||
"""Removes a liked post
|
||||
"""
|
||||
likeDomain=likeDomain
|
||||
if likePort:
|
||||
if likePort!=80 and likePort!=443:
|
||||
if ':' not in likeDomain:
|
||||
likeDomain=likeDomain+':'+str(likePort)
|
||||
|
||||
objectUrl = \
|
||||
httpPrefix + '://'+likeDomain+'/users/'+likeNickname+ \
|
||||
'/statuses/'+str(likeStatusNumber)
|
||||
|
||||
if likePort!=80 and likePort!=443:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+':'+str(likePort)+'/users/'+likeNickname
|
||||
else:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+'/users/'+likeNickname
|
||||
if likePort:
|
||||
if likePort!=80 and likePort!=443:
|
||||
if ':' not in likeDomain:
|
||||
ccUrl=httpPrefix+'://'+likeDomain+':'+str(likePort)+'/users/'+likeNickname
|
||||
|
||||
return undoLike(session,baseDir,federationList,nickname,domain,port, \
|
||||
ccList,httpPrefix,objectUrl,clientToServer, \
|
||||
|
@ -319,7 +326,9 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = ['https://www.w3.org/ns/activitystreams#Public']
|
||||
|
@ -391,7 +400,9 @@ def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = ['https://www.w3.org/ns/activitystreams#Public']
|
||||
|
|
1
media.py
1
media.py
|
@ -67,6 +67,7 @@ def attachImage(baseDir: str,httpPrefix: str,domain: str,port: int, \
|
|||
mediaType='image/gif'
|
||||
fileExtension='gif'
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
|
|
@ -56,7 +56,9 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \
|
|||
if ':' in domain:
|
||||
domain=domain.split(':')[0]
|
||||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
handle=nickname.lower()+'@'+domain.lower()
|
||||
|
@ -135,7 +137,9 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
storeWebfingerEndpoint(nickname,domain,port,baseDir,webfingerEndpoint)
|
||||
|
||||
handle=nickname.lower()+'@'+domain.lower()
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
newPerson = {'@context': ['https://www.w3.org/ns/activitystreams',
|
||||
|
@ -545,6 +549,7 @@ def canRemovePost(baseDir: str,nickname: str,domain: str,port: int,postId: str)
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
||||
# is the post by the admin?
|
||||
|
@ -570,6 +575,7 @@ def removeTagsForNickname(baseDir: str,nickname: str,domain: str,port: int) -> N
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
matchStr=domainFull+'/users/'+nickname+'/'
|
||||
directory = os.fsencode(baseDir+'/tags/')
|
||||
|
|
23
posts.py
23
posts.py
|
@ -431,6 +431,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
|
|||
tags=[]
|
||||
hashtagsDict={}
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
@ -604,6 +605,7 @@ def outboxMessageCreateWrap(httpPrefix: str, \
|
|||
https://www.w3.org/TR/activitypub/#object-without-create
|
||||
"""
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
@ -638,7 +640,9 @@ def postIsAddressedToFollowers(baseDir: str,
|
|||
postJsonObject: {}) -> bool:
|
||||
"""Returns true if the given post is addressed to followers of the nickname
|
||||
"""
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
if not postJsonObject.get('object'):
|
||||
|
@ -699,6 +703,7 @@ def createPublicPost(baseDir: str,
|
|||
"""Public post
|
||||
"""
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
@ -719,6 +724,7 @@ def createUnlistedPost(baseDir: str,
|
|||
"""Unlisted post. This has the #Public and followers links inverted.
|
||||
"""
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
@ -739,6 +745,7 @@ def createFollowersOnlyPost(baseDir: str,
|
|||
"""Followers only post
|
||||
"""
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
@ -810,6 +817,7 @@ def createReportPost(baseDir: str,
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
||||
# add a title to distinguish moderation reports from other posts
|
||||
|
@ -917,6 +925,7 @@ def sendPost(projectVersion: str, \
|
|||
"""
|
||||
withDigest=True
|
||||
|
||||
if toPort:
|
||||
if toPort!=80 and toPort!=443:
|
||||
if ':' not in toDomain:
|
||||
toDomain=toDomain+':'+str(toPort)
|
||||
|
@ -1010,6 +1019,7 @@ def sendPostViaServer(projectVersion: str, \
|
|||
return 6
|
||||
withDigest=True
|
||||
|
||||
if toPort:
|
||||
if toPort!=80 and toPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomain=fromDomain+':'+str(fromPort)
|
||||
|
@ -1049,6 +1059,7 @@ def sendPostViaServer(projectVersion: str, \
|
|||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
cc=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname+'/followers'
|
||||
else:
|
||||
|
@ -1057,7 +1068,9 @@ def sendPostViaServer(projectVersion: str, \
|
|||
toPersonId=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname+'/followers'
|
||||
else:
|
||||
toDomainFull=toDomain
|
||||
if toPort!=80 and toDomain!=443:
|
||||
if toPort:
|
||||
if toPort!=80 and toPort!=443:
|
||||
if ':' not in toDomain:
|
||||
toDomainFull=toDomain+':'+str(toPort)
|
||||
toPersonId=httpPrefix+'://'+toDomainFull+'/users/'+toNickname
|
||||
postJsonObject = \
|
||||
|
@ -1273,10 +1286,12 @@ def sendToNamedAddresses(session,baseDir: str, \
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
toDomainFull=toDomain
|
||||
if toPort:
|
||||
if toPort!=80 and toPort!=443:
|
||||
if ':' not in toDomain:
|
||||
toDomainFull=toDomain+':'+str(toPort)
|
||||
print('DEBUG: Post sending s2s: '+nickname+'@'+domainFull+' to '+toNickname+'@'+toDomainFull)
|
||||
cc=[]
|
||||
|
@ -1359,7 +1374,9 @@ def createModeration(baseDir: str,nickname: str,domain: str,port: int,httpPrefix
|
|||
boxDir = createPersonDir(nickname,domain,baseDir,'inbox')
|
||||
boxname='moderation'
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
if not pageNumber:
|
||||
|
@ -1433,7 +1450,9 @@ def createBoxBase(baseDir: str,boxname: str, \
|
|||
if boxname=='inbox':
|
||||
sharedBoxDir = createPersonDir('inbox',domain,baseDir,boxname)
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
pageStr='?page=true'
|
||||
|
@ -1660,7 +1679,9 @@ def getPublicPostsOfPerson(nickname: str,domain: str, \
|
|||
federationList=[]
|
||||
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
handle=httpPrefix+"://"+domainFull+"/@"+nickname
|
||||
wfRequest = \
|
||||
|
|
3
roles.py
3
roles.py
|
@ -183,6 +183,7 @@ def outboxDelegate(baseDir: str,authenticatedNickname: str,messageJson: {},debug
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
role=messageJson['object']['object'].split(';')[1].strip().lower()
|
||||
|
||||
|
@ -216,7 +217,9 @@ def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
delegatorDomainFull=delegatorDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in delegatorDomain:
|
||||
delegatorDomainFull=delegatorDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = httpPrefix+'://'+delegatorDomainFull+'/users/'+nickname
|
||||
|
|
|
@ -101,7 +101,9 @@ def addShare(baseDir: str, \
|
|||
if imageFilename:
|
||||
if os.path.isfile(imageFilename):
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
if not os.path.isdir(baseDir+'/sharefiles'):
|
||||
os.mkdir(baseDir+'/sharefiles')
|
||||
|
@ -203,7 +205,9 @@ def getSharesFeedForPerson(baseDir: str, \
|
|||
if not validNickname(nickname):
|
||||
return None
|
||||
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
handleDomain=domain
|
||||
|
@ -283,7 +287,9 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
@ -370,7 +376,9 @@ def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
|||
return 6
|
||||
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
if ':' not in fromDomain:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
|
|
@ -98,7 +98,9 @@ def sendSkillViaServer(session,nickname: str,password: str,
|
|||
return 6
|
||||
|
||||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
||||
toUrl = httpPrefix+'://'+domainFull+'/users/'+nickname
|
||||
|
|
2
tests.py
2
tests.py
|
@ -88,7 +88,9 @@ def testHttpsigBase(withDigest):
|
|||
messageBodyJsonStr=json.dumps(messageBodyJson)
|
||||
|
||||
headersDomain=domain
|
||||
if port:
|
||||
if port!=80 and port !=443:
|
||||
if ':' not in domain:
|
||||
headersDomain=domain+':'+str(port)
|
||||
|
||||
dateStr=strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
||||
|
|
1
utils.py
1
utils.py
|
@ -156,6 +156,7 @@ def removeAttachment(baseDir: str,httpPrefix: str,domain: str,postJson: {}):
|
|||
return
|
||||
if not postJson['attachment'][0].get('url'):
|
||||
return
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
|
|
@ -79,7 +79,9 @@ def storeWebfingerEndpoint(nickname: str,domain: str,port: int,baseDir: str, \
|
|||
wfJson: {}) -> bool:
|
||||
"""Stores webfinger endpoint for a user to a file
|
||||
"""
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
handle=nickname+'@'+domain
|
||||
wfSubdir='/wfendpoints'
|
||||
|
@ -95,7 +97,9 @@ def createWebfingerEndpoint(nickname: str,domain: str,port: int, \
|
|||
"""Creates a webfinger endpoint for a user
|
||||
"""
|
||||
originalDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domain=domain+':'+str(port)
|
||||
|
||||
account = {
|
||||
|
@ -178,6 +182,7 @@ def webfingerLookup(path: str,baseDir: str,port: int,debug: bool) -> {}:
|
|||
if debug:
|
||||
print('DEBUG: WEBFINGER no @ in handle '+handle)
|
||||
return None
|
||||
if port:
|
||||
if port!=80 and port !=443:
|
||||
if ':' not in handle:
|
||||
handle=handle+':'+str(port)
|
||||
|
|
|
@ -225,6 +225,7 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
|||
domainFull=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
domainFull=domain+':'+str(port)
|
||||
|
||||
actorFilename=baseDir+'/accounts/'+nickname+'@'+domain+'.json'
|
||||
|
@ -1013,6 +1014,7 @@ def individualPostAsHtml(baseDir: str, \
|
|||
fullDomain=domain
|
||||
if port:
|
||||
if port!=80 and port!=443:
|
||||
if ':' not in domain:
|
||||
fullDomain=domain+':'+str(port)
|
||||
|
||||
if fullDomain not in postJsonObject['actor']:
|
||||
|
@ -1040,6 +1042,7 @@ def individualPostAsHtml(baseDir: str, \
|
|||
actorDomainFull=actorDomain
|
||||
if actorPort:
|
||||
if actorPort!=80 and actorPort!=443:
|
||||
if ':' not in actorDomain:
|
||||
actorDomainFull=actorDomain+':'+str(actorPort)
|
||||
if isBlocked(baseDir,nickname,domain,actorNickname,actorDomainFull):
|
||||
blockUnblockStr='<a href="/users/'+nickname+'?unblock='+postJsonObject['actor']+';'+avatarUrl+'">Unblock</a>'
|
||||
|
@ -1520,6 +1523,7 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
|||
searchDomainFull=searchDomain
|
||||
if searchPort:
|
||||
if searchPort!=80 and searchPort!=443:
|
||||
if ':' not in searchDomain:
|
||||
searchDomainFull=searchDomain+':'+str(searchPort)
|
||||
|
||||
profileStr=''
|
||||
|
|
Loading…
Reference in New Issue