Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main

main
Bob Mottram 2020-07-14 23:10:24 +01:00
commit 33f4d4e16f
3 changed files with 9 additions and 6 deletions

View File

@ -21,4 +21,5 @@ clean:
rm -f gemini/EN/*~ rm -f gemini/EN/*~
rm -f scripts/*~ rm -f scripts/*~
rm -f deploy/*~ rm -f deploy/*~
rm -f translations/*~
rm -rf __pycache__ rm -rf __pycache__

View File

@ -7808,7 +7808,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlUnfollowConfirm(self.server.translate, htmlUnfollowConfirm(self.server.translate,
self.server.baseDir, self.server.baseDir,
originPathStr, usersPath,
optionsActor, optionsActor,
optionsAvatarUrl).encode('utf-8') optionsAvatarUrl).encode('utf-8')
self._set_headers('text/html', len(msg), self._set_headers('text/html', len(msg),

View File

@ -94,7 +94,7 @@ def isFollowingActor(baseDir: str,
followingFile = baseDir + '/accounts/' + handle + '/following.txt' followingFile = baseDir + '/accounts/' + handle + '/following.txt'
if not os.path.isfile(followingFile): if not os.path.isfile(followingFile):
return False return False
if actor in open(followingFile).read(): if actor.lower() in open(followingFile).read().lower():
return True return True
followingNickname = getNicknameFromActor(actor) followingNickname = getNicknameFromActor(actor)
if not followingNickname: if not followingNickname:
@ -106,7 +106,7 @@ def isFollowingActor(baseDir: str,
if followingPort != 80 and followingPort != 443: if followingPort != 80 and followingPort != 443:
if ':' not in followingHandle: if ':' not in followingHandle:
followingHandle += ':' + str(followingPort) followingHandle += ':' + str(followingPort)
if followingHandle in open(followingFile).read(): if followingHandle.lower() in open(followingFile).read().lower():
return True return True
return False return False
@ -202,23 +202,25 @@ def unfollowPerson(baseDir: str, nickname: str, domain: str,
if debug: if debug:
print('DEBUG: follow file ' + filename + ' was not found') print('DEBUG: follow file ' + filename + ' was not found')
return False return False
if handleToUnfollow not in open(filename).read(): if handleToUnfollow.lower() not in open(filename).read().lower():
if debug: if debug:
print('DEBUG: handle to unfollow ' + handleToUnfollow + print('DEBUG: handle to unfollow ' + handleToUnfollow +
' is not in ' + filename) ' is not in ' + filename)
return return
with open(filename, "r") as f: with open(filename, "r") as f:
lines = f.readlines() lines = f.readlines()
handleToUnfollowLower = handleToUnfollow.lower()
with open(filename, "w") as f: with open(filename, "w") as f:
for line in lines: for line in lines:
if line.strip("\n").strip("\r") != handleToUnfollow: if line.strip("\n").strip("\r").lower() != handleToUnfollowLower:
f.write(line) f.write(line)
# write to an unfollowed file so that if a follow accept # write to an unfollowed file so that if a follow accept
# later arrives then it can be ignored # later arrives then it can be ignored
unfollowedFilename = baseDir + '/accounts/' + handle + '/unfollowed.txt' unfollowedFilename = baseDir + '/accounts/' + handle + '/unfollowed.txt'
if os.path.isfile(unfollowedFilename): if os.path.isfile(unfollowedFilename):
if handleToUnfollow not in open(unfollowedFilename).read(): if handleToUnfollowLower not in \
open(unfollowedFilename).read().lower():
with open(filename, "a+") as f: with open(filename, "a+") as f:
f.write(handleToUnfollow + '\n') f.write(handleToUnfollow + '\n')
else: else: