Create a list of handles to be followed

merge-requests/30/head
Bob Mottram 2021-01-09 18:12:36 +00:00
parent 118da84fa6
commit e7d0668cd6
2 changed files with 23 additions and 2 deletions

View File

@ -2565,6 +2565,17 @@ class PubServer(BaseHTTPRequestHandler):
elif ('@' in searchStr or
('://' in searchStr and
hasUsersPath(searchStr))):
if searchStr.endswith(':') or \
searchStr.endswith(';') or \
searchStr.endswith('.'):
if callingDomain.endswith('.onion') and onionDomain:
actorStr = 'http://' + onionDomain + usersPath
elif (callingDomain.endswith('.i2p') and i2pDomain):
actorStr = 'http://' + i2pDomain + usersPath
self._redirect_headers(actorStr + '/search',
cookie, callingDomain)
self.server.POSTbusy = False
return
# profile search
nickname = getNicknameFromActor(actorStr)
if not self.server.session:
@ -2580,8 +2591,7 @@ class PubServer(BaseHTTPRequestHandler):
profilePathStr = path.replace('/searchhandle', '')
# are we already following the searched for handle?
if isFollowingActor(baseDir, nickname, domain,
searchStr):
if isFollowingActor(baseDir, nickname, domain, searchStr):
if not hasUsersPath(searchStr):
searchNickname = getNicknameFromActor(searchStr)
searchDomain, searchPort = \

View File

@ -124,6 +124,9 @@ def _updateMovedHandle(baseDir: str, nickname: str, domain: str,
movedToHandle = movedToNickname + '@' + movedToDomainFull
handleLower = handle.lower()
refollowFilename = \
baseDir + '/accounts/' + nickname + '@' + domain + '/refollow.txt'
# unfollow the old handle
with open(followingFilename, 'w+') as f:
for followHandle in followingHandles:
@ -140,6 +143,14 @@ def _updateMovedHandle(baseDir: str, nickname: str, domain: str,
ctr += 1
print('Unfollowed ' + handle + ' who has moved to ' +
movedToHandle)
# save the new handles to the refollow list
if os.path.isfile(refollowFilename):
with open(refollowFilename, 'a+') as f:
f.write(movedToHandle + '\n')
else:
with open(refollowFilename, 'w+') as f:
f.write(movedToHandle + '\n')
return ctr