diff --git a/acceptreject.py b/acceptreject.py index d7abadd4..894db12f 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -85,7 +85,7 @@ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ if not messageJson.get('object'): return if not messageJson['object'].get('type'): - return + return if not messageJson['object']['type']=='Follow': return if debug: @@ -96,7 +96,7 @@ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ # no, this isn't a mistake if not messageJson['object'].get('object'): print('DEBUG: no object within Follow activity') - return + return if not messageJson.get('to'): if debug: print('DEBUG: No "to" parameter in follow Accept') @@ -115,7 +115,7 @@ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ return if not nickname: if debug: - print('DEBUG: nickname not found in '+thisActor) + print('DEBUG: nickname not found in '+thisActor) return if acceptedPort: if '/'+acceptedDomain+':'+str(acceptedPort)+'/users/'+nickname not in thisActor: @@ -132,7 +132,7 @@ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ print('Expected: /'+acceptedDomain+'/users/'+nickname) print('Actual: '+thisActor) print('DEBUG: unrecognized actor '+thisActor) - return + return followedActor=messageJson['object']['object'] followedDomain,port=getDomainFromActor(followedActor) if not followedDomain: @@ -166,7 +166,7 @@ def acceptFollow(baseDir: str,domain : str,messageJson: {}, \ nickname+'@'+acceptedDomainFull+ \ ' from '+followedNickname+'@'+followedDomainFull+ \ ' but they have been unfollowed') - return + return if followPerson(baseDir, \ nickname,acceptedDomainFull, \ diff --git a/announce.py b/announce.py index a62ea5ec..206228ea 100644 --- a/announce.py +++ b/announce.py @@ -78,7 +78,7 @@ def undoAnnounceCollectionEntry(recentPostsCache: {}, \ baseDir: str,postFilename: str, \ actor: str,domain: str,debug: bool) -> None: """Undoes an announce for a particular actor by removing it from - the "shares" collection within a post. Note that the "shares" + the "shares" collection within a post. Note that the "shares" collection has no relation to shared items in shares.py. It's shares of posts, not shares of physical objects. """ @@ -169,7 +169,7 @@ def updateAnnounceCollection(recentPostsCache: {}, \ "totalItems": 1, 'items': [{ 'type': 'Announce', - 'actor': actor + 'actor': actor }] } postJsonObject['object']['shares']=announcementsJson @@ -274,7 +274,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \ httpPrefix,True,clientToServer,federationList, \ sendThreads,postLog,cachedWebfingers,personCache, \ debug,projectVersion) - + return newAnnounce def announcePublic(session,baseDir: str,federationList: [], \ @@ -386,7 +386,7 @@ def undoAnnounce(session,baseDir: str,federationList: [], \ 'https://www.w3.org/ns/activitystreams#Public', \ httpPrefix,True,clientToServer,federationList, \ sendThreads,postLog,cachedWebfingers,personCache,debug) - + return newUndoAnnounce def undoAnnouncePublic(session,baseDir: str,federationList: [], \ @@ -495,7 +495,7 @@ def sendAnnounceViaServer(baseDir: str,session, \ inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName= \ getPersonBox(baseDir,session,wfRequest,personCache, \ projectVersion,httpPrefix,fromNickname,fromDomain,postToBox) - + if not inboxUrl: if debug: print('DEBUG: No '+postToBox+' was found for '+handle) @@ -504,9 +504,9 @@ def sendAnnounceViaServer(baseDir: str,session, \ if debug: print('DEBUG: No actor was found for '+handle) return 4 - + authHeader=createBasicAuthHeader(fromNickname,password) - + headers={ 'host': fromDomain, \ 'Content-type': 'application/json', \ diff --git a/auth.py b/auth.py index bd99561e..d9742e9d 100644 --- a/auth.py +++ b/auth.py @@ -22,7 +22,7 @@ def hashPassword(password: str) -> str: salt, 100000) pwdhash=binascii.hexlify(pwdhash) return (salt+pwdhash).decode('ascii') - + def verifyPassword(storedPassword: str,providedPassword: str) -> bool: """Verify a stored password against one provided by user """ diff --git a/availability.py b/availability.py index e45720d4..f1ac3814 100644 --- a/availability.py +++ b/availability.py @@ -88,7 +88,7 @@ def sendAvailabilityViaServer(baseDir: str,session, \ if port!=80 and port!=443: if ':' not in domain: domainFull=domain+':'+str(port) - + toUrl=httpPrefix+'://'+domainFull+'/users/'+nickname ccUrl=httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers' @@ -117,7 +117,7 @@ def sendAvailabilityViaServer(baseDir: str,session, \ inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName= \ getPersonBox(baseDir,session,wfRequest,personCache, \ projectVersion,httpPrefix,nickname,domain,postToBox) - + if not inboxUrl: if debug: print('DEBUG: No '+postToBox+' was found for '+handle) @@ -126,9 +126,9 @@ def sendAvailabilityViaServer(baseDir: str,session, \ if debug: print('DEBUG: No actor was found for '+handle) return 4 - + authHeader=createBasicAuthHeader(Nickname,password) - + headers={ 'host': domain, \ 'Content-type': 'application/json', \ diff --git a/blocking.py b/blocking.py index 3bfca126..a0660f1c 100644 --- a/blocking.py +++ b/blocking.py @@ -14,7 +14,7 @@ def addGlobalBlock(baseDir: str, \ """Global block which applies to all accounts """ blockingFilename=baseDir+'/accounts/blocking.txt' - if not blockNickname.startswith('#'): + if not blockNickname.startswith('#'): blockHandle=blockNickname+'@'+blockDomain if os.path.isfile(blockingFilename): if blockHandle in open(blockingFilename).read(): @@ -54,7 +54,7 @@ def removeGlobalBlock(baseDir: str, \ """Unblock the given global block """ unblockingFilename=baseDir+'/accounts/blocking.txt' - if not unblockNickname.startswith('#'): + if not unblockNickname.startswith('#'): unblockHandle=unblockNickname+'@'+unblockDomain if os.path.isfile(unblockingFilename): if unblockHandle in open(unblockingFilename).read(): diff --git a/blog.py b/blog.py index 7a7f6e40..f4ac0230 100644 --- a/blog.py +++ b/blog.py @@ -171,7 +171,7 @@ def htmlBlogPostContent(authorized: bool, \ # posts from the domain are expected to have an attributedTo field if restrictToDomain: return '' - + if postJsonObject['object'].get('published'): if 'T' in postJsonObject['object']['published']: blogStr+='
'+file.read()+'
' + editBlogText=''+file.read()+'
' cssFilename=baseDir+'/epicyon-profile.css' if os.path.isfile(baseDir+'/epicyon.css'): - cssFilename=baseDir+'/epicyon.css' + cssFilename=baseDir+'/epicyon.css' with open(cssFilename, 'r') as cssFile: editBlogCSS=cssFile.read() if httpPrefix!='https': @@ -606,7 +606,7 @@ def htmlEditBlog(mediaInstance: bool,translate: {}, \ editBlogForm=htmlHeader(cssFilename,editBlogCSS) mentionsStr='' - + editBlogForm+= \ '