Use the followed actor so that we don't need to be concerned about what the users path is

merge-requests/30/head
Bob Mottram 2021-02-09 19:02:10 +00:00
parent f97d7f4c6a
commit 530f573763
3 changed files with 9 additions and 6 deletions

View File

@ -2344,15 +2344,15 @@ class PubServer(BaseHTTPRequestHandler):
if debug:
print('You cannot follow the news actor')
else:
if debug:
print('Sending follow request from ' +
followerNickname + ' to ' + followingActor)
print('Sending follow request from ' +
followerNickname + ' to ' + followingActor)
sendFollowRequest(self.server.session,
baseDir, followerNickname,
domain, port,
httpPrefix,
followingNickname,
followingDomain,
followingActor,
followingPort, httpPrefix,
False, self.server.federationList,
self.server.sendThreads,

View File

@ -872,6 +872,7 @@ def followedAccountRejects(session, baseDir: str, httpPrefix: str,
def sendFollowRequest(session, baseDir: str,
nickname: str, domain: str, port: int, httpPrefix: str,
followNickname: str, followDomain: str,
followedActor: str,
followPort: int, followHttpPrefix: str,
clientToServer: bool, federationList: [],
sendThreads: [], postLog: [], cachedWebfingers: {},
@ -880,6 +881,7 @@ def sendFollowRequest(session, baseDir: str,
"""Gets the json object for sending a follow request
"""
if not domainPermitted(followDomain, federationList):
print('You are not permitted to follow the domain ' + followDomain)
return None
fullDomain = getFullDomain(domain, port)
@ -890,8 +892,7 @@ def sendFollowRequest(session, baseDir: str,
statusNumber, published = getStatusNumber()
if followNickname:
followedId = followHttpPrefix + '://' + \
requestDomain + '/users/' + followNickname
followedId = followedActor
followHandle = followNickname + '@' + requestDomain
else:
if debug:

View File

@ -849,10 +849,12 @@ def testFollowBetweenServers():
alicePersonCache = {}
aliceCachedWebfingers = {}
alicePostLog = []
bobActor = httpPrefix + '://' + bobAddress + '/users/bob'
sendResult = \
sendFollowRequest(sessionAlice, aliceDir,
'alice', aliceDomain, alicePort, httpPrefix,
'bob', bobDomain, bobPort, httpPrefix,
'bob', bobDomain, bobActor,
bobPort, httpPrefix,
clientToServer, federationList,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,