diff --git a/acceptreject.py b/acceptreject.py index 5a9681d45..981836c58 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -184,7 +184,7 @@ def _acceptFollow(base_dir: str, domain: str, messageJson: {}, def receiveAcceptReject(session, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool) -> bool: """Receives an Accept or Reject within the POST section of HTTPServer """ diff --git a/announce.py b/announce.py index 6d2974686..65b48896a 100644 --- a/announce.py +++ b/announce.py @@ -121,7 +121,7 @@ def createAnnounce(session, base_dir: str, federationList: [], objectUrl: str, saveToFile: bool, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates an announce message @@ -171,7 +171,7 @@ def createAnnounce(session, base_dir: str, federationList: [], announceActor = \ objectUrl.split('/' + announceNickname + '/')[0] + \ '/' + announceNickname - if hasGroupType(base_dir, announceActor, personCache): + if hasGroupType(base_dir, announceActor, person_cache): groupAccount = True if announceNickname and announceDomain: @@ -179,7 +179,7 @@ def createAnnounce(session, base_dir: str, federationList: [], nickname, domain, port, announceNickname, announceDomain, announcePort, None, http_prefix, True, client_to_server, federationList, - send_threads, postLog, cachedWebfingers, personCache, + send_threads, postLog, cachedWebfingers, person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 639633) @@ -190,7 +190,7 @@ def announcePublic(session, base_dir: str, federationList: [], nickname: str, domain: str, port: int, http_prefix: str, objectUrl: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Makes a public announcement @@ -204,7 +204,7 @@ def announcePublic(session, base_dir: str, federationList: [], toUrl, ccUrl, http_prefix, objectUrl, True, client_to_server, send_threads, postLog, - personCache, cachedWebfingers, + person_cache, cachedWebfingers, debug, project_version, signingPrivateKeyPem) @@ -213,7 +213,7 @@ def sendAnnounceViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, repeatObjectUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates an announce message via c2s @@ -267,7 +267,7 @@ def sendAnnounceViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 73528) @@ -306,7 +306,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, repeatObjectUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undo an announce message via c2s @@ -352,7 +352,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 73528) diff --git a/availability.py b/availability.py index 04a54ad15..d17ae5d89 100644 --- a/availability.py +++ b/availability.py @@ -81,7 +81,7 @@ def sendAvailabilityViaServer(base_dir: str, session, domain: str, port: int, http_prefix: str, status: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Sets the availability for a person via c2s @@ -127,7 +127,7 @@ def sendAvailabilityViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 57262) diff --git a/blog.py b/blog.py index a8ebe62e1..2b23c4de3 100644 --- a/blog.py +++ b/blog.py @@ -192,7 +192,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool, handle: str, restrictToDomain: bool, peertubeInstances: [], systemLanguage: str, - personCache: {}, + person_cache: {}, blogSeparator: str = '
' @@ -507,7 +507,7 @@ def htmlBlogPage(authorized: bool, session, nickname: str, domain: str, port: int, noOfItems: int, pageNumber: int, peertubeInstances: [], systemLanguage: str, - personCache: {}, debug: bool) -> str: + person_cache: {}, debug: bool) -> str: """Returns a html blog page containing posts """ if ' ' in nickname or '@' in nickname or \ @@ -571,7 +571,7 @@ def htmlBlogPage(authorized: bool, session, None, True, peertubeInstances, systemLanguage, - personCache) + person_cache) if len(timelineJson['orderedItems']) >= noOfItems: blogStr += navigateStr @@ -730,7 +730,7 @@ def htmlBlogView(authorized: bool, translate: {}, domain: str, port: int, noOfItems: int, peertubeInstances: [], systemLanguage: str, - personCache: {}, debug: bool) -> str: + person_cache: {}, debug: bool) -> str: """Show the blog main page """ blogStr = '' @@ -749,7 +749,7 @@ def htmlBlogView(authorized: bool, base_dir, http_prefix, translate, nickname, domain, port, noOfItems, 1, peertubeInstances, - systemLanguage, personCache, debug) + systemLanguage, person_cache, debug) domainFull = getFullDomain(domain, port) diff --git a/bookmarks.py b/bookmarks.py index 998b066b1..c1797360b 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -255,7 +255,7 @@ def bookmark(recentPostsCache: {}, objectUrl: str, actorBookmarked: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str) -> {}: """Creates a bookmark actor is the person doing the bookmarking @@ -314,7 +314,7 @@ def undoBookmark(recentPostsCache: {}, objectUrl: str, actorBookmarked: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str) -> {}: """Removes a bookmark actor is the person doing the bookmarking @@ -374,7 +374,7 @@ def sendBookmarkViaServer(base_dir: str, session, nickname: str, password: str, domain: str, fromPort: int, http_prefix: str, bookmarkUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a bookmark via c2s @@ -424,7 +424,7 @@ def sendBookmarkViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 58391) @@ -464,7 +464,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session, nickname: str, password: str, domain: str, fromPort: int, http_prefix: str, bookmarkUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Removes a bookmark via c2s @@ -514,7 +514,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 52594) diff --git a/cache.py b/cache.py index a846ba36f..233838a2b 100644 --- a/cache.py +++ b/cache.py @@ -18,7 +18,7 @@ from utils import getUserPaths def _removePersonFromCache(base_dir: str, personUrl: str, - personCache: {}) -> bool: + person_cache: {}) -> bool: """Removes an actor from the cache """ cacheFilename = base_dir + '/cache/actors/' + \ @@ -28,13 +28,13 @@ def _removePersonFromCache(base_dir: str, personUrl: str, os.remove(cacheFilename) except OSError: print('EX: unable to delete cached actor ' + str(cacheFilename)) - if personCache.get(personUrl): - del personCache[personUrl] + if person_cache.get(personUrl): + del person_cache[personUrl] def checkForChangedActor(session, base_dir: str, http_prefix: str, domainFull: str, - personUrl: str, avatarUrl: str, personCache: {}, + personUrl: str, avatarUrl: str, person_cache: {}, timeoutSec: int): """Checks if the avatar url exists and if not then the actor has probably changed without receiving an actor/Person Update. @@ -47,11 +47,11 @@ def checkForChangedActor(session, base_dir: str, return if urlExists(session, avatarUrl, timeoutSec, http_prefix, domainFull): return - _removePersonFromCache(base_dir, personUrl, personCache) + _removePersonFromCache(base_dir, personUrl, person_cache) def storePersonInCache(base_dir: str, personUrl: str, - personJson: {}, personCache: {}, + personJson: {}, person_cache: {}, allowWriteToFile: bool) -> None: """Store an actor in the cache """ @@ -60,7 +60,7 @@ def storePersonInCache(base_dir: str, personUrl: str, return currTime = datetime.datetime.utcnow() - personCache[personUrl] = { + person_cache[personUrl] = { "actor": personJson, "timestamp": currTime.strftime("%Y-%m-%dT%H:%M:%SZ") } @@ -77,13 +77,13 @@ def storePersonInCache(base_dir: str, personUrl: str, saveJson(personJson, cacheFilename) -def getPersonFromCache(base_dir: str, personUrl: str, personCache: {}, +def getPersonFromCache(base_dir: str, personUrl: str, person_cache: {}, allowWriteToFile: bool) -> {}: """Get an actor from the cache """ # if the actor is not in memory then try to load it from file loadedFromFile = False - if not personCache.get(personUrl): + if not person_cache.get(personUrl): # does the person exist as a cached file? cacheFilename = base_dir + '/cache/actors/' + \ personUrl.replace('/', '#') + '.json' @@ -92,25 +92,25 @@ def getPersonFromCache(base_dir: str, personUrl: str, personCache: {}, personJson = loadJson(actorFilename) if personJson: storePersonInCache(base_dir, personUrl, personJson, - personCache, False) + person_cache, False) loadedFromFile = True - if personCache.get(personUrl): + if person_cache.get(personUrl): if not loadedFromFile: # update the timestamp for the last time the actor was retrieved currTime = datetime.datetime.utcnow() currTimeStr = currTime.strftime("%Y-%m-%dT%H:%M:%SZ") - personCache[personUrl]['timestamp'] = currTimeStr - return personCache[personUrl]['actor'] + person_cache[personUrl]['timestamp'] = currTimeStr + return person_cache[personUrl]['actor'] return None -def expirePersonCache(personCache: {}): +def expirePersonCache(person_cache: {}): """Expires old entries from the cache in memory """ currTime = datetime.datetime.utcnow() removals = [] - for personUrl, cacheJson in personCache.items(): + for personUrl, cacheJson in person_cache.items(): cacheTime = datetime.datetime.strptime(cacheJson['timestamp'], "%Y-%m-%dT%H:%M:%SZ") daysSinceCached = (currTime - cacheTime).days @@ -118,7 +118,7 @@ def expirePersonCache(personCache: {}): removals.append(personUrl) if len(removals) > 0: for personUrl in removals: - del personCache[personUrl] + del person_cache[personUrl] print(str(len(removals)) + ' actors were expired from the cache') @@ -137,7 +137,7 @@ def getWebfingerFromCache(handle: str, cachedWebfingers: {}) -> {}: def getPersonPubKey(base_dir: str, session, personUrl: str, - personCache: {}, debug: bool, + person_cache: {}, debug: bool, project_version: str, http_prefix: str, domain: str, onion_domain: str, signingPrivateKeyPem: str) -> str: @@ -153,7 +153,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str, personUrl.replace(possibleUsersPath + 'inbox', '/inbox') break personJson = \ - getPersonFromCache(base_dir, personUrl, personCache, True) + getPersonFromCache(base_dir, personUrl, person_cache, True) if not personJson: if debug: print('DEBUG: Obtaining public key for ' + personUrl) @@ -183,5 +183,5 @@ def getPersonPubKey(base_dir: str, session, personUrl: str, if debug: print('DEBUG: Public key not found for ' + personUrl) - storePersonInCache(base_dir, personUrl, personJson, personCache, True) + storePersonInCache(base_dir, personUrl, personJson, person_cache, True) return pubKey diff --git a/daemon.py b/daemon.py index a2f070e78..a8a103a94 100644 --- a/daemon.py +++ b/daemon.py @@ -734,7 +734,7 @@ class PubServer(BaseHTTPRequestHandler): pubKey = \ getPersonPubKey(self.server.base_dir, self.server.session, keyId, - self.server.personCache, self.server.debug, + self.server.person_cache, self.server.debug, self.server.project_version, self.server.http_prefix, self.server.domain, self.server.onion_domain, @@ -1289,7 +1289,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.send_threads, self.server.postLog, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.allow_deletion, self.server.proxy_type, version, self.server.debug, @@ -2718,7 +2718,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.port, None, self.server.project_version, @@ -2852,7 +2852,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.port, None, self.server.project_version, @@ -2956,7 +2956,7 @@ class PubServer(BaseHTTPRequestHandler): self.postToNickname = pathUsersSection.split('/')[0] groupAccount = hasGroupType(self.server.base_dir, followingActor, - self.server.personCache) + self.server.person_cache) unfollowAccount(self.server.base_dir, self.postToNickname, self.server.domain, followingNickname, followingDomainFull, @@ -3050,7 +3050,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.send_threads, self.server.postLog, self.server.cachedWebfingers, - self.server.personCache, debug, + self.server.person_cache, debug, self.server.project_version, self.server.signingPrivateKeyPem) if callingDomain.endswith('.onion') and onion_domain: @@ -3302,7 +3302,7 @@ class PubServer(BaseHTTPRequestHandler): maxPostsInHashtagFeed, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, http_prefix, self.server.project_version, self.server.yt_replace_domain, @@ -3398,7 +3398,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, port, self.server.yt_replace_domain, self.server.twitter_replacement_domain, @@ -3466,7 +3466,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, port, self.server.yt_replace_domain, self.server.twitter_replacement_domain, @@ -3522,7 +3522,7 @@ class PubServer(BaseHTTPRequestHandler): getAvatarImageUrl(self.server.session, base_dir, http_prefix, actor, - self.server.personCache, + self.server.person_cache, None, True, self.server.signingPrivateKeyPem) profilePathStr += \ @@ -3563,7 +3563,7 @@ class PubServer(BaseHTTPRequestHandler): searchStr, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.debug, self.server.project_version, self.server.yt_replace_domain, @@ -6498,10 +6498,10 @@ class PubServer(BaseHTTPRequestHandler): onion_domain, self.server.cachedWebfingers) # also copy to the actors cache and - # personCache in memory + # person_cache in memory storePersonInCache(base_dir, actorJson['id'], actorJson, - self.server.personCache, + self.server.person_cache, True) # clear any cached images for this actor idStr = actorJson['id'].replace('/', '-') @@ -7104,7 +7104,7 @@ class PubServer(BaseHTTPRequestHandler): movedTo = '' actorJson = getPersonFromCache(base_dir, optionsActor, - self.server.personCache, + self.server.person_cache, True) if actorJson: if actorJson.get('movedTo'): @@ -7137,7 +7137,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, self.server.domainFull, optionsActor, optionsProfileUrl, - self.server.personCache, 5) + self.server.person_cache, 5) accessKeys = self.server.accessKeys if '/users/' in path: @@ -7542,7 +7542,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir, hashtag, pageNumber, maxPostsInHashtagFeed, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, http_prefix, self.server.project_version, self.server.yt_replace_domain, @@ -7605,7 +7605,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir, hashtag, maxPostsInFeed, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, http_prefix, self.server.project_version, self.server.yt_replace_domain, @@ -7698,7 +7698,7 @@ class PubServer(BaseHTTPRequestHandler): repeatUrl, False, False, self.server.send_threads, self.server.postLog, - self.server.personCache, + self.server.person_cache, self.server.cachedWebfingers, debug, self.server.project_version, @@ -7751,7 +7751,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, announceJson, None, True, @@ -7913,7 +7913,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.send_threads, self.server.postLog, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, debug, self.server.project_version, self.server.signingPrivateKeyPem) @@ -8068,7 +8068,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.send_threads, self.server.postLog, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, debug, self.server.project_version, self.server.signingPrivateKeyPem) @@ -8210,7 +8210,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, likedPostJson, None, True, @@ -8365,7 +8365,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, likedPostJson, None, True, @@ -8548,7 +8548,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, reactionPostJson, None, True, @@ -8721,7 +8721,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, reactionPostJson, None, True, @@ -8821,7 +8821,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, port, post_json_object, self.server.http_prefix, @@ -8909,7 +8909,7 @@ class PubServer(BaseHTTPRequestHandler): bookmarkUrl, bookmarkActor, False, self.server.send_threads, self.server.postLog, - self.server.personCache, + self.server.person_cache, self.server.cachedWebfingers, self.server.debug, self.server.project_version) @@ -8941,7 +8941,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, bookmarkPostJson, None, True, @@ -9035,7 +9035,7 @@ class PubServer(BaseHTTPRequestHandler): bookmarkUrl, undoActor, False, self.server.send_threads, self.server.postLog, - self.server.personCache, + self.server.person_cache, self.server.cachedWebfingers, debug, self.server.project_version) @@ -9069,7 +9069,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.postToNickname, domain, self.server.port, bookmarkPostJson, None, True, @@ -9172,7 +9172,7 @@ class PubServer(BaseHTTPRequestHandler): deleteUrl, http_prefix, self.server.project_version, self.server.cachedWebfingers, - self.server.personCache, callingDomain, + self.server.person_cache, callingDomain, self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.show_published_date_only, @@ -9271,7 +9271,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, self.server.port, mutePostJson, avatarUrl, showAvatarOptions, @@ -9381,7 +9381,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, self.server.port, mutePostJson, avatarUrl, showAvatarOptions, @@ -9489,7 +9489,7 @@ class PubServer(BaseHTTPRequestHandler): translate = self.server.translate session = self.server.session cachedWebfingers = self.server.cachedWebfingers - personCache = self.server.personCache + person_cache = self.server.person_cache project_version = self.server.project_version ytDomain = self.server.yt_replace_domain twitter_replacement_domain = \ @@ -9503,7 +9503,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, @@ -9581,7 +9581,7 @@ class PubServer(BaseHTTPRequestHandler): translate = self.server.translate session = self.server.session cachedWebfingers = self.server.cachedWebfingers - personCache = self.server.personCache + person_cache = self.server.person_cache project_version = self.server.project_version ytDomain = self.server.yt_replace_domain twitter_replacement_domain = \ @@ -9595,7 +9595,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, @@ -9704,7 +9704,7 @@ class PubServer(BaseHTTPRequestHandler): getPerson, 'roles', self.server.session, cachedWebfingers, - self.server.personCache, + self.server.person_cache, yt_replace_domain, twitter_replacement_domain, self.server.show_published_date_only, @@ -9820,7 +9820,7 @@ class PubServer(BaseHTTPRequestHandler): getPerson, 'skills', self.server.session, cachedWebfingers, - self.server.personCache, + self.server.person_cache, yt_replace_domain, twitter_replacement_domain, show_published_date_only, @@ -9985,7 +9985,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, authorized, post_json_object, @@ -10158,7 +10158,7 @@ class PubServer(BaseHTTPRequestHandler): max_recent_posts: int, translate: {}, cachedWebfingers: {}, - personCache: {}, + person_cache: {}, allow_deletion: bool, project_version: str, yt_replace_domain: str, @@ -10237,7 +10237,7 @@ class PubServer(BaseHTTPRequestHandler): session, base_dir, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, @@ -10390,7 +10390,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -10535,7 +10535,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -10676,7 +10676,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -10818,7 +10818,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -10969,7 +10969,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11121,7 +11121,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11232,7 +11232,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11317,7 +11317,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11439,7 +11439,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11579,7 +11579,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, outboxFeed, self.server.allow_deletion, @@ -11712,7 +11712,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, base_dir, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, nickname, domain, port, @@ -11845,7 +11845,7 @@ class PubServer(BaseHTTPRequestHandler): getPerson, sharesFileType, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.show_published_date_only, @@ -11966,7 +11966,7 @@ class PubServer(BaseHTTPRequestHandler): getPerson, 'following', self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.show_published_date_only, @@ -12086,7 +12086,7 @@ class PubServer(BaseHTTPRequestHandler): getPerson, 'followers', self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.show_published_date_only, @@ -12222,7 +12222,7 @@ class PubServer(BaseHTTPRequestHandler): actorJson, 'posts', self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.show_published_date_only, @@ -12391,7 +12391,7 @@ class PubServer(BaseHTTPRequestHandler): maxPostsInBlogsFeed, pageNumber, self.server.peertubeInstances, self.server.systemLanguage, - self.server.personCache, + self.server.person_cache, self.server.debug) if msg is not None: msg = msg.encode('utf-8') @@ -12986,7 +12986,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.session, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.port, post_json_object, self.server.project_version, @@ -14062,7 +14062,7 @@ class PubServer(BaseHTTPRequestHandler): maxPostsInBlogsFeed, self.server.peertubeInstances, self.server.systemLanguage, - self.server.personCache, + self.server.person_cache, self.server.debug) if msg is not None: msg = msg.encode('utf-8') @@ -14166,7 +14166,7 @@ class PubServer(BaseHTTPRequestHandler): post_json_object, self.server.peertubeInstances, self.server.systemLanguage, - self.server.personCache, + self.server.person_cache, self.server.debug, self.server.content_license_url) if msg is not None: @@ -15170,7 +15170,7 @@ class PubServer(BaseHTTPRequestHandler): accessKeys = self.server.keyShortcuts[nickname] # show the calendar screen - msg = htmlCalendar(self.server.personCache, + msg = htmlCalendar(self.server.person_cache, self.server.cssCache, self.server.translate, self.server.base_dir, self.path, @@ -15917,7 +15917,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.max_recent_posts, self.server.translate, self.server.cachedWebfingers, - self.server.personCache, + self.server.person_cache, self.server.allow_deletion, self.server.project_version, self.server.yt_replace_domain, @@ -18739,7 +18739,7 @@ def runDaemon(content_license_url: str, shared_items_federated_domains.copy() httpd.base_dir = base_dir httpd.instance_id = instance_id - httpd.personCache = {} + httpd.person_cache = {} httpd.cachedWebfingers = {} httpd.faviconsCache = {} httpd.proxy_type = proxy_type @@ -18863,7 +18863,7 @@ def runDaemon(content_license_url: str, print('Creating cache expiry thread') httpd.thrCache = \ threadWithTrace(target=expireCache, - args=(base_dir, httpd.personCache, + args=(base_dir, httpd.person_cache, httpd.http_prefix, archiveDir, httpd.maxPostsInBox), daemon=True) @@ -18925,7 +18925,7 @@ def runDaemon(content_license_url: str, project_version, base_dir, http_prefix, httpd.send_threads, httpd.postLog, httpd.cachedWebfingers, - httpd.personCache, httpd.inboxQueue, + httpd.person_cache, httpd.inboxQueue, domain, onion_domain, i2p_domain, port, proxy_type, httpd.federationList, diff --git a/delete.py b/delete.py index cbe13c6a6..c1d7c36ef 100644 --- a/delete.py +++ b/delete.py @@ -30,7 +30,7 @@ def sendDeleteViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, deleteObjectUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a delete request message via c2s @@ -77,7 +77,7 @@ def sendDeleteViaServer(base_dir: str, session, (inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, - base_dir, session, wfRequest, personCache, + base_dir, session, wfRequest, person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 53036) diff --git a/desktop_client.py b/desktop_client.py index b24309e65..198573157 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -415,7 +415,7 @@ def _sayCommand(content: str, sayStr: str, screenreader: str, def _desktopReplyToPost(session, postId: str, base_dir: str, nickname: str, password: str, domain: str, port: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, subject: str, screenreader: str, systemLanguage: str, espeak, conversationId: str, @@ -473,7 +473,7 @@ def _desktopReplyToPost(session, postId: str, http_prefix, replyMessage, followersOnly, commentsEnabled, attach, mediaType, attachedImageDescription, city, - cachedWebfingers, personCache, isArticle, + cachedWebfingers, person_cache, isArticle, systemLanguage, low_bandwidth, content_license_url, debug, postId, postId, @@ -487,7 +487,7 @@ def _desktopReplyToPost(session, postId: str, def _desktopNewPost(session, base_dir: str, nickname: str, password: str, domain: str, port: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, screenreader: str, systemLanguage: str, espeak, low_bandwidth: bool, @@ -540,7 +540,7 @@ def _desktopNewPost(session, http_prefix, newMessage, followersOnly, commentsEnabled, attach, mediaType, attachedImageDescription, city, - cachedWebfingers, personCache, isArticle, + cachedWebfingers, person_cache, isArticle, systemLanguage, low_bandwidth, content_license_url, debug, None, None, @@ -670,7 +670,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str, systemLanguage: str, screenreader: str, espeak, translate: {}, yourActor: str, - domainFull: str, personCache: {}, + domainFull: str, person_cache: {}, signingPrivateKeyPem: str, blockedCache: {}) -> {}: """Reads a post from the given timeline @@ -711,7 +711,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str, allow_local_network_access, recentPostsCache, False, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) if post_json_object2: @@ -1128,7 +1128,7 @@ def _desktopShowBox(indent: str, def _desktopNewDM(session, toHandle: str, base_dir: str, nickname: str, password: str, domain: str, port: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, screenreader: str, systemLanguage: str, espeak, low_bandwidth: bool, @@ -1151,7 +1151,7 @@ def _desktopNewDM(session, toHandle: str, _desktopNewDMbase(session, handle, base_dir, nickname, password, domain, port, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, screenreader, systemLanguage, espeak, low_bandwidth, @@ -1162,7 +1162,7 @@ def _desktopNewDM(session, toHandle: str, def _desktopNewDMbase(session, toHandle: str, base_dir: str, nickname: str, password: str, domain: str, port: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, screenreader: str, systemLanguage: str, espeak, low_bandwidth: bool, @@ -1255,7 +1255,7 @@ def _desktopNewDMbase(session, toHandle: str, http_prefix, newMessage, followersOnly, commentsEnabled, attach, mediaType, attachedImageDescription, city, - cachedWebfingers, personCache, isArticle, + cachedWebfingers, person_cache, isArticle, systemLanguage, low_bandwidth, content_license_url, debug, None, None, @@ -1388,7 +1388,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, messageStr = None content = None cachedWebfingers = {} - personCache = {} + person_cache = {} newRepliesExist = False newDMsExist = False pgpKeyUpload = False @@ -1433,7 +1433,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, pgpPublicKeyUpload(base_dir, session, nickname, password, domain, port, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, False, signingPrivateKeyPem) sayStr = indent + 'PGP public key uploaded' @@ -1452,7 +1452,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, 1, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) @@ -1643,7 +1643,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, pageNumber, postIndex, boxJson, systemLanguage, screenreader, espeak, translate, yourActor, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) print('') @@ -1727,7 +1727,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _desktopReplyToPost(sessionReply, postId, base_dir, nickname, password, domain, port, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, subject, screenreader, systemLanguage, espeak, conversationId, @@ -1764,7 +1764,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _desktopNewDM(sessionPost, toHandle, base_dir, nickname, password, domain, port, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, screenreader, systemLanguage, espeak, low_bandwidth, @@ -1776,7 +1776,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _desktopNewPost(sessionPost, base_dir, nickname, password, domain, port, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, screenreader, systemLanguage, espeak, low_bandwidth, @@ -1806,7 +1806,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, post_json_object['id'], - cachedWebfingers, personCache, + cachedWebfingers, person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -1847,7 +1847,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, post_json_object['id'], cachedWebfingers, - personCache, + person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -1877,7 +1877,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, post_json_object['id'], - cachedWebfingers, personCache, + cachedWebfingers, person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -1919,7 +1919,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, domain, port, http_prefix, post_json_object['id'], cachedWebfingers, - personCache, + person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -1949,7 +1949,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, post_json_object['id'], - cachedWebfingers, personCache, + cachedWebfingers, person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -1985,7 +1985,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, blockActor, cachedWebfingers, - personCache, + person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -2031,7 +2031,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, blockActor, cachedWebfingers, - personCache, + person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -2060,7 +2060,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, post_json_object['id'], - cachedWebfingers, personCache, + cachedWebfingers, person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -2091,7 +2091,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, postId, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -2126,7 +2126,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, domain, port, http_prefix, postId, cachedWebfingers, - personCache, + person_cache, True, __version__, signingPrivateKeyPem) refreshTimeline = True @@ -2143,7 +2143,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, currPage, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followRequestsJson: @@ -2163,7 +2163,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, currPage, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followingJson: @@ -2184,7 +2184,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, nickname, password, domain, port, http_prefix, currPage, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followersJson: @@ -2224,7 +2224,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, followPort, http_prefix, cachedWebfingers, - personCache, + person_cache, debug, __version__, signingPrivateKeyPem) else: @@ -2259,7 +2259,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, followPort, http_prefix, cachedWebfingers, - personCache, + person_cache, debug, __version__, signingPrivateKeyPem) else: @@ -2288,7 +2288,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, approveHandle, cachedWebfingers, - personCache, + person_cache, debug, __version__, signingPrivateKeyPem) @@ -2321,7 +2321,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, denyHandle, cachedWebfingers, - personCache, + person_cache, debug, __version__, signingPrivateKeyPem) @@ -2411,7 +2411,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, allow_local_network_access, recentPostsCache, False, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) if post_json_object2: @@ -2496,7 +2496,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, http_prefix, post_json_object['id'], cachedWebfingers, - personCache, + person_cache, False, __version__, signingPrivateKeyPem) refreshTimeline = True diff --git a/epicyon.py b/epicyon.py index 8e1cc63fe..a5b5c8112 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1185,7 +1185,7 @@ if args.approve: send_threads = [] postLog = [] cachedWebfingers = {} - personCache = {} + person_cache = {} if not domain: domain = getConfigParam(base_dir, 'domain') signingPrivateKeyPem = None @@ -1197,7 +1197,7 @@ if args.approve: args.approve, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) sys.exit() @@ -1213,7 +1213,7 @@ if args.deny: send_threads = [] postLog = [] cachedWebfingers = {} - personCache = {} + person_cache = {} if not domain: domain = getConfigParam(base_dir, 'domain') signingPrivateKeyPem = None @@ -1225,7 +1225,7 @@ if args.deny: args.deny, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) sys.exit() @@ -1297,7 +1297,7 @@ if args.message: city = 'London, England' send_threads = [] postLog = [] - personCache = {} + person_cache = {} cachedWebfingers = {} subject = args.subject attach = args.attach @@ -1321,7 +1321,7 @@ if args.message: http_prefix, sendMessage, followersOnly, args.commentsEnabled, attach, mediaType, attachedImageDescription, city, - cachedWebfingers, personCache, isArticle, + cachedWebfingers, person_cache, isArticle, args.language, args.low_bandwidth, args.content_license_url, args.debug, replyTo, replyTo, args.conversationId, subject) @@ -1343,7 +1343,7 @@ if args.announce: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1355,7 +1355,7 @@ if args.announce: sendAnnounceViaServer(base_dir, session, args.nickname, args.password, domain, port, http_prefix, args.announce, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1448,7 +1448,7 @@ if args.itemName: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1469,7 +1469,7 @@ if args.itemName: args.itemCategory, args.location, args.duration, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, args.itemPrice, args.itemCurrency, signingPrivateKeyPem) @@ -1491,7 +1491,7 @@ if args.undoItemName: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1505,7 +1505,7 @@ if args.undoItemName: domain, port, http_prefix, args.undoItemName, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1553,7 +1553,7 @@ if args.wantedItemName: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1574,7 +1574,7 @@ if args.wantedItemName: args.itemCategory, args.location, args.duration, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, args.itemPrice, args.itemCurrency, signingPrivateKeyPem) @@ -1596,7 +1596,7 @@ if args.undoWantedItemName: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1610,7 +1610,7 @@ if args.undoWantedItemName: domain, port, http_prefix, args.undoWantedItemName, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1630,7 +1630,7 @@ if args.like: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1643,7 +1643,7 @@ if args.like: args.nickname, args.password, domain, port, http_prefix, args.like, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1669,7 +1669,7 @@ if args.react: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1682,7 +1682,7 @@ if args.react: args.nickname, args.password, domain, port, http_prefix, args.react, args.emoji, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1702,7 +1702,7 @@ if args.undolike: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1715,7 +1715,7 @@ if args.undolike: args.nickname, args.password, domain, port, http_prefix, args.undolike, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): @@ -1742,7 +1742,7 @@ if args.undoreact: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1755,7 +1755,7 @@ if args.undoreact: args.nickname, args.password, domain, port, http_prefix, args.undoreact, args.emoji, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): @@ -1776,7 +1776,7 @@ if args.bookmark: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1789,7 +1789,7 @@ if args.bookmark: args.nickname, args.password, domain, port, http_prefix, args.bookmark, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): @@ -1810,7 +1810,7 @@ if args.unbookmark: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1823,7 +1823,7 @@ if args.unbookmark: args.nickname, args.password, domain, port, http_prefix, args.unbookmark, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1843,7 +1843,7 @@ if args.delete: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -1856,7 +1856,7 @@ if args.delete: args.nickname, args.password, domain, port, http_prefix, args.delete, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -1885,7 +1885,7 @@ if args.follow: followDomain, followPort = getDomainFromActor(args.follow) session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} followHttpPrefix = http_prefix if args.follow.startswith('https'): @@ -1901,7 +1901,7 @@ if args.follow: domain, port, followNickname, followDomain, followPort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) for t in range(20): time.sleep(1) @@ -1931,7 +1931,7 @@ if args.unfollow: followDomain, followPort = getDomainFromActor(args.unfollow) session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} followHttpPrefix = http_prefix if args.follow.startswith('https'): @@ -1947,7 +1947,7 @@ if args.unfollow: domain, port, followNickname, followDomain, followPort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) for t in range(20): time.sleep(1) @@ -1968,7 +1968,7 @@ if args.followingList: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} followHttpPrefix = http_prefix if not domain: @@ -1982,7 +1982,7 @@ if args.followingList: args.nickname, args.password, domain, port, http_prefix, args.pageNumber, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followingJson: pprint(followingJson) @@ -2001,7 +2001,7 @@ if args.followersList: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} followHttpPrefix = http_prefix if not domain: @@ -2015,7 +2015,7 @@ if args.followersList: args.nickname, args.password, domain, port, http_prefix, args.pageNumber, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followersJson: @@ -2035,7 +2035,7 @@ if args.followRequestsList: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} followHttpPrefix = http_prefix if not domain: @@ -2049,7 +2049,7 @@ if args.followRequestsList: args.nickname, args.password, domain, port, http_prefix, args.pageNumber, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, __version__, signingPrivateKeyPem) if followRequestsJson: pprint(followRequestsJson) @@ -2496,7 +2496,7 @@ if args.skill: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2511,7 +2511,7 @@ if args.skill: domain, port, http_prefix, args.skill, args.skillLevelPercent, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -2531,7 +2531,7 @@ if args.availability: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2545,7 +2545,7 @@ if args.availability: domain, port, http_prefix, args.availability, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -2645,7 +2645,7 @@ if args.block: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2657,7 +2657,7 @@ if args.block: sendBlockViaServer(base_dir, session, nickname, args.password, domain, port, http_prefix, args.block, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -2677,7 +2677,7 @@ if args.mute: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2689,7 +2689,7 @@ if args.mute: sendMuteViaServer(base_dir, session, nickname, args.password, domain, port, http_prefix, args.mute, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -2709,7 +2709,7 @@ if args.unmute: args.password = args.password.replace('\n', '') session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2721,7 +2721,7 @@ if args.unmute: sendUndoMuteViaServer(base_dir, session, nickname, args.password, domain, port, http_prefix, args.unmute, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail @@ -2753,7 +2753,7 @@ if args.unblock: sys.exit() session = createSession(proxy_type) - personCache = {} + person_cache = {} cachedWebfingers = {} if not domain: domain = getConfigParam(base_dir, 'domain') @@ -2765,7 +2765,7 @@ if args.unblock: sendUndoBlockViaServer(base_dir, session, nickname, args.password, domain, port, http_prefix, args.unblock, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(10): # TODO detect send success/fail diff --git a/follow.py b/follow.py index e6ce0b49d..6a8378fe9 100644 --- a/follow.py +++ b/follow.py @@ -719,7 +719,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str, nickname: str, domain: str, fromPort: int, personUrl: str, federationList: [], followJson: {}, send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, removeFollowActivity: bool, signingPrivateKeyPem: str): @@ -762,7 +762,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str, groupAccount = False if followJson: if followJson.get('actor'): - if hasGroupType(base_dir, followJson['actor'], personCache): + if hasGroupType(base_dir, followJson['actor'], person_cache): groupAccount = True return sendSignedJson(acceptJson, session, base_dir, @@ -771,7 +771,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str, http_prefix, True, client_to_server, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, project_version, None, + person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 7856837) @@ -782,7 +782,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str, nickname: str, domain: str, fromPort: int, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str): """The person receiving a follow request rejects the new follower @@ -821,7 +821,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str, client_to_server = False denyHandle = getFullDomain(nickname + '@' + domain, fromPort) groupAccount = False - if hasGroupType(base_dir, personUrl, personCache): + if hasGroupType(base_dir, personUrl, person_cache): groupAccount = True # remove from the follow requests file removeFromFollowRequests(base_dir, nicknameToFollow, domainToFollow, @@ -839,7 +839,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str, http_prefix, True, client_to_server, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, project_version, None, + person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 6393063) @@ -851,7 +851,7 @@ def sendFollowRequest(session, base_dir: str, followPort: int, followHttpPrefix: str, client_to_server: bool, federationList: [], send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, debug: bool, + person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Gets the json object for sending a follow request """ @@ -873,7 +873,7 @@ def sendFollowRequest(session, base_dir: str, if followNickname: followedId = followedActor followHandle = followNickname + '@' + requestDomain - groupAccount = hasGroupType(base_dir, followedActor, personCache) + groupAccount = hasGroupType(base_dir, followedActor, person_cache) if groupAccount: followHandle = '!' + followHandle print('Follow request being sent to group account') @@ -930,7 +930,7 @@ def sendFollowRequest(session, base_dir: str, 'https://www.w3.org/ns/activitystreams#Public', http_prefix, True, client_to_server, federationList, - send_threads, postLog, cachedWebfingers, personCache, + send_threads, postLog, cachedWebfingers, person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 8234389) @@ -943,7 +943,7 @@ def sendFollowRequestViaServer(base_dir: str, session, followNickname: str, followDomain: str, followPort: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a follow request via c2s @@ -992,7 +992,7 @@ def sendFollowRequestViaServer(base_dir: str, session, (inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, - base_dir, session, wfRequest, personCache, + base_dir, session, wfRequest, person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 52025) @@ -1033,7 +1033,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session, followNickname: str, followDomain: str, followPort: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a unfollow request via c2s @@ -1087,7 +1087,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, - wfRequest, personCache, + wfRequest, person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, @@ -1128,7 +1128,7 @@ def getFollowingViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, pageNumber: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Gets a page from the following collection as json @@ -1169,7 +1169,7 @@ def getFollowersViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, pageNumber: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Gets a page from the followers collection as json @@ -1210,7 +1210,7 @@ def getFollowRequestsViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, pageNumber: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Gets a page from the follow requests collection as json @@ -1251,7 +1251,7 @@ def approveFollowRequestViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, approveHandle: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> str: """Approves a follow request @@ -1292,7 +1292,7 @@ def denyFollowRequestViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, denyHandle: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> str: """Denies a follow request diff --git a/inbox.py b/inbox.py index b1db649f8..2bed1da57 100644 --- a/inbox.py +++ b/inbox.py @@ -281,7 +281,7 @@ def storeHashTags(base_dir: str, nickname: str, domain: str, def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int, translate: {}, base_dir: str, http_prefix: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, post_json_object: {}, allow_deletion: bool, boxname: str, @@ -308,7 +308,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int, True, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, avatarUrl, True, allow_deletion, http_prefix, __version__, boxname, @@ -794,7 +794,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str, def _receiveUndo(session, base_dir: str, http_prefix: str, port: int, send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, messageJson: {}, federationList: [], debug: bool) -> bool: """Receives an undo request within the POST section of HTTPServer @@ -825,7 +825,7 @@ def _personReceiveUpdate(base_dir: str, domain: str, port: int, updateNickname: str, updateDomain: str, updatePort: int, - personJson: {}, personCache: {}, + personJson: {}, person_cache: {}, debug: bool) -> bool: """Changes an actor. eg: avatar or display name change """ @@ -865,8 +865,8 @@ def _personReceiveUpdate(base_dir: str, # check that the public keys match. # If they don't then this may be a nefarious attempt to hack an account idx = personJson['id'] - if personCache.get(idx): - if personCache[idx]['actor']['publicKey']['publicKeyPem'] != \ + if person_cache.get(idx): + if person_cache[idx]['actor']['publicKey']['publicKeyPem'] != \ personJson['publicKey']['publicKeyPem']: if debug: print('WARN: Public key does not match when updating actor') @@ -883,7 +883,7 @@ def _personReceiveUpdate(base_dir: str, return False # save to cache in memory storePersonInCache(base_dir, personJson['id'], personJson, - personCache, True) + person_cache, True) # save to cache on file if saveJson(personJson, actorFilename): if debug: @@ -941,7 +941,7 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, messageJson: {}, def _receiveUpdate(recentPostsCache: {}, session, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], nickname: str, debug: bool) -> bool: """Receives an Update activity within the POST section of HTTPServer """ @@ -981,7 +981,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str, updateNickname, updateDomain, updatePort, messageJson['object'], - personCache, debug): + person_cache, debug): print('Person Update: ' + str(messageJson)) if debug: print('DEBUG: Profile update was received for ' + @@ -995,7 +995,7 @@ def _receiveLike(recentPostsCache: {}, http_prefix: str, domain: str, port: int, onion_domain: str, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, @@ -1094,7 +1094,7 @@ def _receiveLike(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, handleName, domain, port, likedPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1117,7 +1117,7 @@ def _receiveUndoLike(recentPostsCache: {}, session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, @@ -1205,7 +1205,7 @@ def _receiveUndoLike(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, handleName, domain, port, likedPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1229,7 +1229,7 @@ def _receiveReaction(recentPostsCache: {}, http_prefix: str, domain: str, port: int, onion_domain: str, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, @@ -1353,7 +1353,7 @@ def _receiveReaction(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, handleName, domain, port, reactionPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1376,7 +1376,7 @@ def _receiveUndoReaction(recentPostsCache: {}, session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, @@ -1480,7 +1480,7 @@ def _receiveUndoReaction(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, handleName, domain, port, reactionPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1503,7 +1503,7 @@ def _receiveBookmark(recentPostsCache: {}, session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, allow_deletion: bool, @@ -1590,7 +1590,7 @@ def _receiveBookmark(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, nickname, domain, port, bookmarkedPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1613,7 +1613,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, allow_deletion: bool, @@ -1701,7 +1701,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, nickname, domain, port, bookmarkedPostJson, None, True, allow_deletion, http_prefix, __version__, @@ -1722,7 +1722,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, allow_deletion: bool, recentPostsCache: {}) -> bool: """Receives a Delete activity within the POST section of HTTPServer @@ -1799,7 +1799,7 @@ def _receiveAnnounce(recentPostsCache: {}, http_prefix: str, domain: str, onion_domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool, translate: {}, yt_replace_domain: str, twitter_replacement_domain: str, @@ -1908,7 +1908,7 @@ def _receiveAnnounce(recentPostsCache: {}, individualPostAsHtml(signingPrivateKeyPem, True, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, nickname, domain, port, messageJson, None, True, allow_deletion, http_prefix, __version__, @@ -1941,7 +1941,7 @@ def _receiveAnnounce(recentPostsCache: {}, allow_local_network_access, recentPostsCache, debug, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) if not post_json_object: @@ -1987,7 +1987,7 @@ def _receiveAnnounce(recentPostsCache: {}, domainFull = getFullDomain(domain, port) updateSpeaker(base_dir, http_prefix, nickname, domain, domainFull, - post_json_object, personCache, + post_json_object, person_cache, translate, lookupActor, themeName) try: @@ -2003,7 +2003,7 @@ def _receiveAnnounce(recentPostsCache: {}, for tries in range(6): pubKey = \ getPersonPubKey(base_dir, session, lookupActor, - personCache, debug, + person_cache, debug, __version__, http_prefix, domain, onion_domain, signingPrivateKeyPem) @@ -2026,7 +2026,7 @@ def _receiveUndoAnnounce(recentPostsCache: {}, session, handle: str, isGroup: bool, base_dir: str, http_prefix: str, domain: str, port: int, send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, messageJson: {}, federationList: [], + person_cache: {}, messageJson: {}, federationList: [], debug: bool) -> bool: """Receives an undo announce activity within the POST section of HTTPServer """ @@ -2190,7 +2190,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str, allow_local_network_access: bool, debug: bool, systemLanguage: str, http_prefix: str, domainFull: str, - personCache: {}) -> bool: + person_cache: {}) -> bool: """Is the content of a received post valid? Check for bad html Check for hellthreads @@ -2266,7 +2266,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str, if not understoodPostLanguage(base_dir, nickname, domain, messageJson, systemLanguage, http_prefix, domainFull, - personCache): + person_cache): return False # check for filtered content if isFiltered(base_dir, nickname, domain, contentStr): @@ -2291,7 +2291,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str, def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str, - domain: str, onion_domain: str, personCache: {}, + domain: str, onion_domain: str, person_cache: {}, post_json_object: {}, debug: bool, signingPrivateKeyPem: str) -> None: """Tries to obtain the actor for the person being replied to @@ -2322,7 +2322,7 @@ def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str, for tries in range(6): pubKey = \ getPersonPubKey(base_dir, session, lookupActor, - personCache, debug, + person_cache, debug, __version__, http_prefix, domain, onion_domain, signingPrivateKeyPem) if pubKey: @@ -2610,7 +2610,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int, post_json_object: {}, http_prefix: str, federationList: [], send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, debug: bool, + person_cache: {}, debug: bool, systemLanguage: str, onion_domain: str, i2p_domain: str, signingPrivateKeyPem: str) -> None: @@ -2663,14 +2663,14 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int, groupActor + '/followers', cc, http_prefix, postId, False, False, send_threads, postLog, - personCache, cachedWebfingers, + person_cache, cachedWebfingers, debug, __version__, signingPrivateKeyPem) sendToFollowersThread(session, base_dir, nickname, domain, onion_domain, i2p_domain, port, http_prefix, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, announceJson, debug, __version__, shared_items_federated_domains, sharedItemFederationTokens, @@ -2792,7 +2792,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str, base_dir: str, nickname: str, domain: str, port: int, sendingHandle: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, translate: {}, debug: bool, lastBounceMessage: [], systemLanguage: str, signingPrivateKeyPem: str, @@ -2867,7 +2867,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str, senderNickname, senderDomain, senderPort, cc, http_prefix, False, False, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, __version__, None, groupAccount, + person_cache, debug, __version__, None, groupAccount, signingPrivateKeyPem, 7238634) return True @@ -2878,7 +2878,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int, federationList: [], send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, + person_cache: {}, translate: {}, debug: bool, lastBounceMessage: [], handle: str, systemLanguage: str, @@ -2957,7 +2957,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int, federationList, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, translate, debug, lastBounceMessage, systemLanguage, @@ -2978,7 +2978,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str, session, onion_domain: str, i2p_domain: str, port: int, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, signingPrivateKeyPem: str, max_recent_posts: int, translate: {}, allow_deletion: bool, @@ -3021,7 +3021,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str, individualPostAsHtml(signingPrivateKeyPem, False, recentPostsCache, max_recent_posts, translate, pageNumber, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, nickname, domain, port, questionJson, None, True, allow_deletion, http_prefix, __version__, @@ -3055,7 +3055,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str, onion_domain, i2p_domain, port, http_prefix, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, post_json_object, debug, __version__, shared_items_federated_domains, sharedItemFederationTokens, @@ -3180,7 +3180,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str, def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, session, keyId: str, handle: str, messageJson: {}, base_dir: str, http_prefix: str, send_threads: [], - postLog: [], cachedWebfingers: {}, personCache: {}, + postLog: [], cachedWebfingers: {}, person_cache: {}, queue: [], domain: str, onion_domain: str, i2p_domain: str, port: int, proxy_type: str, @@ -3219,7 +3219,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, onion_domain, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3241,7 +3241,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3264,7 +3264,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, onion_domain, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3286,7 +3286,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3308,7 +3308,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3330,7 +3330,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, signingPrivateKeyPem, @@ -3355,7 +3355,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, onion_domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, translate, @@ -3377,7 +3377,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug): @@ -3390,7 +3390,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, federationList, debug, allow_deletion, @@ -3419,10 +3419,10 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, post_json_object, max_mentions, max_emoji, allow_local_network_access, debug, systemLanguage, http_prefix, - domainFull, personCache): + domainFull, person_cache): # is the sending actor valid? if not validSendingActor(session, base_dir, nickname, domain, - personCache, post_json_object, + person_cache, post_json_object, signingPrivateKeyPem, debug, unit_test): return False @@ -3454,7 +3454,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, post_json_object, recentPostsCache, session, onion_domain, i2p_domain, port, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, signingPrivateKeyPem, max_recent_posts, translate, allow_deletion, @@ -3478,7 +3478,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, federationList, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, translate, debug, lastBounceMessage, handle, systemLanguage, @@ -3504,7 +3504,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, allow_local_network_access, recentPostsCache, debug, systemLanguage, - domainFull, personCache, signingPrivateKeyPem): + domainFull, person_cache, signingPrivateKeyPem): # media index will be updated updateIndexList.append('tlmedia') if isBlogPost(post_json_object): @@ -3514,7 +3514,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, # get the avatar for a reply/announce _obtainAvatarForReplyPost(session, base_dir, http_prefix, domain, onion_domain, - personCache, post_json_object, debug, + person_cache, post_json_object, debug, signingPrivateKeyPem) # save the post to file @@ -3545,7 +3545,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, domainFull = getFullDomain(domain, port) updateSpeaker(base_dir, http_prefix, nickname, domain, domainFull, - post_json_object, personCache, + post_json_object, person_cache, translate, None, themeName) if not unit_test: if debug: @@ -3558,7 +3558,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, translate, base_dir, http_prefix, session, cachedWebfingers, - personCache, + person_cache, handleName, domain, port, post_json_object, @@ -3610,7 +3610,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, _sendToGroupMembers(session, base_dir, handle, port, post_json_object, http_prefix, federationList, send_threads, - postLog, cachedWebfingers, personCache, + postLog, cachedWebfingers, person_cache, debug, systemLanguage, onion_domain, i2p_domain, signingPrivateKeyPem) @@ -3847,7 +3847,7 @@ def _checkJsonSignature(base_dir: str, queueJson: {}) -> (bool, bool): def _receiveFollowRequest(session, base_dir: str, http_prefix: str, port: int, send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, messageJson: {}, federationList: [], debug: bool, project_version: str, max_followers: int, onion_domain: str, @@ -3933,7 +3933,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, # is the actor sending the request valid? if not validSendingActor(session, base_dir, nicknameToFollow, domainToFollow, - personCache, messageJson, + person_cache, messageJson, signingPrivateKeyPem, debug, unit_test): print('REJECT spam follow request ' + approveHandle) return False @@ -3969,7 +3969,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, if debug: print('Obtaining the following actor: ' + messageJson['actor']) if not getPersonPubKey(base_dir, session, messageJson['actor'], - personCache, debug, project_version, + person_cache, debug, project_version, http_prefix, domainToFollow, onion_domain, signingPrivateKeyPem): if debug: @@ -3977,7 +3977,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, messageJson['actor']) groupAccount = \ - hasGroupType(base_dir, messageJson['actor'], personCache) + hasGroupType(base_dir, messageJson['actor'], person_cache) if groupAccount and isGroupAccount(base_dir, nickname, domain): print('Group cannot follow a group') return False @@ -4006,7 +4006,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, if debug: print('Obtaining the following actor: ' + messageJson['actor']) if not getPersonPubKey(base_dir, session, messageJson['actor'], - personCache, debug, project_version, + person_cache, debug, project_version, http_prefix, domainToFollow, onion_domain, signingPrivateKeyPem): if debug: @@ -4019,7 +4019,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, if approveHandle not in open(followersFilename).read(): groupAccount = \ hasGroupType(base_dir, - messageJson['actor'], personCache) + messageJson['actor'], person_cache) if debug: print(approveHandle + ' / ' + messageJson['actor'] + ' is Group: ' + str(groupAccount)) @@ -4055,7 +4055,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str, nickname, domain, fromPort, messageJson['actor'], federationList, messageJson, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, project_version, True, signingPrivateKeyPem) @@ -4064,7 +4064,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, project_version: str, base_dir: str, http_prefix: str, send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, queue: [], + cachedWebfingers: {}, person_cache: {}, queue: [], domain: str, onion_domain: str, i2p_domain: str, port: int, proxy_type: str, @@ -4233,7 +4233,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, pubKey = \ getPersonPubKey(base_dir, session, keyId, - personCache, debug, + person_cache, debug, project_version, http_prefix, domain, onion_domain, signingPrivateKeyPem) if pubKey: @@ -4348,7 +4348,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, base_dir, http_prefix, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, queueJson['post'], federationList, debug): @@ -4369,7 +4369,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, base_dir, http_prefix, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, queueJson['post'], federationList, debug, project_version, @@ -4393,7 +4393,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, if receiveAcceptReject(session, base_dir, http_prefix, domain, port, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, queueJson['post'], federationList, debug): print('Queue: Accept/Reject received from ' + keyId) @@ -4412,7 +4412,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, domain, port, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, queueJson['post'], federationList, queueJson['postNickname'], @@ -4494,7 +4494,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, base_dir, http_prefix, send_threads, postLog, cachedWebfingers, - personCache, queue, + person_cache, queue, domain, onion_domain, i2p_domain, port, proxy_type, diff --git a/languages.py b/languages.py index 574a770b4..9cea10894 100644 --- a/languages.py +++ b/languages.py @@ -92,7 +92,7 @@ def setActorLanguages(base_dir: str, actorJson: {}, languagesStr: str) -> None: def understoodPostLanguage(base_dir: str, nickname: str, domain: str, messageJson: {}, systemLanguage: str, http_prefix: str, domainFull: str, - personCache: {}) -> bool: + person_cache: {}) -> bool: """Returns true if the post is written in a language understood by this account """ @@ -106,7 +106,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str, if msgObject['contentMap'].get(systemLanguage): return True personUrl = localActorUrl(http_prefix, nickname, domainFull) - actorJson = getPersonFromCache(base_dir, personUrl, personCache, False) + actorJson = getPersonFromCache(base_dir, personUrl, person_cache, False) if not actorJson: print('WARN: unable to load actor to check languages ' + personUrl) return False diff --git a/like.py b/like.py index f86a119da..77c18b515 100644 --- a/like.py +++ b/like.py @@ -75,7 +75,7 @@ def _like(recentPostsCache: {}, objectUrl: str, actorLiked: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a like @@ -106,7 +106,7 @@ def _like(recentPostsCache: {}, if actorLiked: likedPostNickname = getNicknameFromActor(actorLiked) likedPostDomain, likedPostPort = getDomainFromActor(actorLiked) - groupAccount = hasGroupType(base_dir, actorLiked, personCache) + groupAccount = hasGroupType(base_dir, actorLiked, person_cache) else: if hasUsersPath(objectUrl): likedPostNickname = getNicknameFromActor(objectUrl) @@ -115,7 +115,7 @@ def _like(recentPostsCache: {}, actorLiked = \ objectUrl.split('/' + likedPostNickname + '/')[0] + \ '/' + likedPostNickname - groupAccount = hasGroupType(base_dir, actorLiked, personCache) + groupAccount = hasGroupType(base_dir, actorLiked, person_cache) if likedPostNickname: postFilename = locatePost(base_dir, nickname, domain, objectUrl) @@ -136,7 +136,7 @@ def _like(recentPostsCache: {}, likedPostNickname, likedPostDomain, likedPostPort, 'https://www.w3.org/ns/activitystreams#Public', http_prefix, True, client_to_server, federationList, - send_threads, postLog, cachedWebfingers, personCache, + send_threads, postLog, cachedWebfingers, person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 7367374) @@ -150,7 +150,7 @@ def likePost(recentPostsCache: {}, ccList: [], likeStatusNumber: int, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Likes a given status post. This is only used by unit tests @@ -163,7 +163,7 @@ def likePost(recentPostsCache: {}, return _like(recentPostsCache, session, base_dir, federationList, nickname, domain, port, ccList, http_prefix, objectUrl, actorLiked, client_to_server, - send_threads, postLog, personCache, cachedWebfingers, + send_threads, postLog, person_cache, cachedWebfingers, debug, project_version, signingPrivateKeyPem) @@ -171,7 +171,7 @@ def sendLikeViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, likeUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a like via c2s @@ -215,7 +215,7 @@ def sendLikeViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72873) @@ -254,7 +254,7 @@ def sendUndoLikeViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, likeUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undo a like via c2s @@ -303,7 +303,7 @@ def sendUndoLikeViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72625) diff --git a/manualapprove.py b/manualapprove.py index 5dbd59b9a..e58122549 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -25,7 +25,7 @@ def manualDenyFollowRequest(session, base_dir: str, denyHandle: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> None: @@ -64,7 +64,7 @@ def manualDenyFollowRequest(session, base_dir: str, denyNickname, denyDomain, denyPort, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, project_version, signingPrivateKeyPem) @@ -77,7 +77,7 @@ def manualDenyFollowRequestThread(session, base_dir: str, denyHandle: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> None: @@ -92,7 +92,7 @@ def manualDenyFollowRequestThread(session, base_dir: str, denyHandle, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, project_version, signingPrivateKeyPem), daemon=True) @@ -126,7 +126,7 @@ def manualApproveFollowRequest(session, base_dir: str, approveHandle: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> None: @@ -216,7 +216,7 @@ def manualApproveFollowRequest(session, base_dir: str, followJson, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, debug, project_version, False, signingPrivateKeyPem) @@ -283,7 +283,7 @@ def manualApproveFollowRequestThread(session, base_dir: str, approveHandle: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> None: @@ -298,7 +298,7 @@ def manualApproveFollowRequestThread(session, base_dir: str, approveHandle, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, debug, project_version, signingPrivateKeyPem), daemon=True) diff --git a/newsdaemon.py b/newsdaemon.py index b52ff9032..7ff20edf0 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -376,7 +376,7 @@ def _hashtagRemove(http_prefix: str, domainFull: str, post_json_object: {}, def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {}, hashtags: [], http_prefix: str, domain: str, port: int, - personCache: {}, + person_cache: {}, cachedWebfingers: {}, federationList: [], send_threads: [], postLog: [], @@ -539,7 +539,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, translate: {}, recentPostsCache: {}, max_recent_posts: int, session, cachedWebfingers: {}, - personCache: {}, + person_cache: {}, federationList: [], send_threads: [], postLog: [], max_mirrored_articles: int, @@ -682,7 +682,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, savePost = _newswireHashtagProcessing(session, base_dir, blog, hashtags, http_prefix, domain, port, - personCache, cachedWebfingers, + person_cache, cachedWebfingers, federationList, send_threads, postLog, moderated, url, systemLanguage, @@ -829,7 +829,7 @@ def runNewswireDaemon(base_dir: str, httpd, httpd.max_recent_posts, httpd.session, httpd.cachedWebfingers, - httpd.personCache, + httpd.person_cache, httpd.federationList, httpd.send_threads, httpd.postLog, diff --git a/outbox.py b/outbox.py index 6a7875f69..d3c33f43c 100644 --- a/outbox.py +++ b/outbox.py @@ -185,7 +185,7 @@ def postMessageToOutbox(session, translate: {}, recentPostsCache: {}, followersThreads: [], federationList: [], send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, allow_deletion: bool, + person_cache: {}, allow_deletion: bool, proxy_type: str, version: str, debug: bool, yt_replace_domain: str, twitter_replacement_domain: str, @@ -427,7 +427,7 @@ def postMessageToOutbox(session, translate: {}, twitter_replacement_domain, allow_local_network_access, recentPostsCache, debug, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem): inboxUpdateIndex('tlmedia', base_dir, postToNickname + '@' + domain, @@ -458,7 +458,7 @@ def postMessageToOutbox(session, translate: {}, translate, pageNumber, base_dir, session, cachedWebfingers, - personCache, + person_cache, postToNickname, domain, port, messageJson, None, True, allow_deletion, @@ -518,7 +518,7 @@ def postMessageToOutbox(session, translate: {}, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, debug, version, shared_items_federated_domains, @@ -659,7 +659,7 @@ def postMessageToOutbox(session, translate: {}, send_threads, postLog, cachedWebfingers, - personCache, + person_cache, messageJson, debug, version, shared_items_federated_domains, diff --git a/person.py b/person.py index ac01d0889..8a7414bd8 100644 --- a/person.py +++ b/person.py @@ -1603,12 +1603,12 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool, return None, None -def getPersonAvatarUrl(base_dir: str, personUrl: str, personCache: {}, +def getPersonAvatarUrl(base_dir: str, personUrl: str, person_cache: {}, allowDownloads: bool) -> str: """Returns the avatar url for the person """ personJson = \ - getPersonFromCache(base_dir, personUrl, personCache, allowDownloads) + getPersonFromCache(base_dir, personUrl, person_cache, allowDownloads) if not personJson: return None @@ -1656,7 +1656,7 @@ def addActorUpdateTimestamp(actorJson: {}) -> None: def validSendingActor(session, base_dir: str, nickname: str, domain: str, - personCache: {}, + person_cache: {}, post_json_object: {}, signingPrivateKeyPem: str, debug: bool, unit_test: bool) -> bool: @@ -1675,7 +1675,7 @@ def validSendingActor(session, base_dir: str, return True # get their actor - actorJson = getPersonFromCache(base_dir, sendingActor, personCache, True) + actorJson = getPersonFromCache(base_dir, sendingActor, person_cache, True) downloadedActor = False if not actorJson: # download the actor @@ -1765,6 +1765,6 @@ def validSendingActor(session, base_dir: str, if downloadedActor: # if the actor is valid and was downloaded then # store it in the cache, but don't write it to file - storePersonInCache(base_dir, sendingActor, actorJson, personCache, + storePersonInCache(base_dir, sendingActor, actorJson, person_cache, False) return True diff --git a/pgp.py b/pgp.py index 406947cbf..fde3f6733 100644 --- a/pgp.py +++ b/pgp.py @@ -456,7 +456,7 @@ def pgpPublicKeyUpload(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, test: str, signingPrivateKeyPem: str) -> {}: if debug: @@ -577,7 +577,7 @@ def pgpPublicKeyUpload(base_dir: str, session, originDomain = domain (inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, - base_dir, session, wfRequest, personCache, + base_dir, session, wfRequest, person_cache, __version__, http_prefix, nickname, domain, postToBox, 35725) diff --git a/posts.py b/posts.py index 246135ea8..647e92c68 100644 --- a/posts.py +++ b/posts.py @@ -299,13 +299,13 @@ def _getPersonBoxActor(session, base_dir: str, actor: str, profileStr: str, asHeader: {}, debug: bool, project_version: str, http_prefix: str, originDomain: str, - personCache: {}, + person_cache: {}, signingPrivateKeyPem: str, sourceId: int) -> {}: """Returns the actor json for the given actor url """ personJson = \ - getPersonFromCache(base_dir, actor, personCache, True) + getPersonFromCache(base_dir, actor, person_cache, True) if personJson: return personJson @@ -331,7 +331,7 @@ def _getPersonBoxActor(session, base_dir: str, actor: str, def getPersonBox(signingPrivateKeyPem: str, originDomain: str, - base_dir: str, session, wfRequest: {}, personCache: {}, + base_dir: str, session, wfRequest: {}, person_cache: {}, project_version: str, http_prefix: str, nickname: str, domain: str, boxName: str = 'inbox', @@ -369,7 +369,7 @@ def getPersonBox(signingPrivateKeyPem: str, originDomain: str, profileStr, asHeader, debug, project_version, http_prefix, originDomain, - personCache, signingPrivateKeyPem, + person_cache, signingPrivateKeyPem, sourceId) if not personJson: return None, None, None, None, None, None, None, None @@ -424,7 +424,7 @@ def getPersonBox(signingPrivateKeyPem: str, originDomain: str, if personJson.get('movedTo'): displayName += ' ⌂' - storePersonInCache(base_dir, personUrl, personJson, personCache, True) + storePersonInCache(base_dir, personUrl, personJson, person_cache, True) return boxJson, pubKeyId, pubKey, personId, sharedInbox, \ avatarUrl, displayName, isGroup @@ -527,7 +527,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, max_mentions: int, max_emoji: int, maxAttachments: int, federationList: [], - personCache: {}, raw: bool, + person_cache: {}, raw: bool, simple: bool, debug: bool, project_version: str, http_prefix: str, originDomain: str, systemLanguage: str, @@ -746,7 +746,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int, max_mentions: int, max_emoji: int, maxAttachments: int, federationList: [], - personCache: {}, + person_cache: {}, debug: bool, project_version: str, http_prefix: str, domain: str, @@ -813,7 +813,7 @@ def _getPostsForBlockedDomains(base_dir: str, max_mentions: int, max_emoji: int, maxAttachments: int, federationList: [], - personCache: {}, + person_cache: {}, debug: bool, project_version: str, http_prefix: str, domain: str, @@ -2272,7 +2272,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, isArticle: bool, systemLanguage: str, shared_items_federated_domains: [], sharedItemFederationTokens: {}, @@ -2317,7 +2317,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 72533) @@ -2422,7 +2422,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str, commentsEnabled: bool, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, isArticle: bool, systemLanguage: str, low_bandwidth: bool, content_license_url: str, @@ -2465,7 +2465,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomainFull, postToBox, @@ -2614,7 +2614,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str, http_prefix: str, saveToFile: bool, client_to_server: bool, federationList: [], send_threads: [], postLog: [], cachedWebfingers: {}, - personCache: {}, debug: bool, project_version: str, + person_cache: {}, debug: bool, project_version: str, sharedItemsToken: str, groupAccount: bool, signingPrivateKeyPem: str, sourceId: int) -> int: @@ -2680,7 +2680,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, postToBox, sourceId) @@ -2862,7 +2862,7 @@ def _sendToNamedAddresses(session, base_dir: str, onion_domain: str, i2p_domain: str, port: int, http_prefix: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, post_json_object: {}, debug: bool, project_version: str, shared_items_federated_domains: [], @@ -2997,7 +2997,7 @@ def _sendToNamedAddresses(session, base_dir: str, if sharedItemFederationTokens.get(fromDomainFull): sharedItemsToken = sharedItemFederationTokens[fromDomainFull] - groupAccount = hasGroupType(base_dir, address, personCache) + groupAccount = hasGroupType(base_dir, address, person_cache) sendSignedJson(post_json_object, session, base_dir, nickname, fromDomain, port, @@ -3005,7 +3005,7 @@ def _sendToNamedAddresses(session, base_dir: str, cc, fromHttpPrefix, True, client_to_server, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, project_version, + person_cache, debug, project_version, sharedItemsToken, groupAccount, signingPrivateKeyPem, 34436782) @@ -3015,7 +3015,7 @@ def sendToNamedAddressesThread(session, base_dir: str, onion_domain: str, i2p_domain: str, port: int, http_prefix: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, post_json_object: {}, debug: bool, project_version: str, shared_items_federated_domains: [], @@ -3030,7 +3030,7 @@ def sendToNamedAddressesThread(session, base_dir: str, onion_domain, i2p_domain, port, http_prefix, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, post_json_object, debug, project_version, shared_items_federated_domains, @@ -3091,7 +3091,7 @@ def sendToFollowers(session, base_dir: str, onion_domain: str, i2p_domain: str, port: int, http_prefix: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, post_json_object: {}, debug: bool, project_version: str, shared_items_federated_domains: [], @@ -3215,7 +3215,7 @@ def sendToFollowers(session, base_dir: str, cc, fromHttpPrefix, True, client_to_server, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, project_version, + person_cache, debug, project_version, sharedItemsToken, groupAccount, signingPrivateKeyPem, 639342) else: @@ -3244,7 +3244,7 @@ def sendToFollowers(session, base_dir: str, cc, fromHttpPrefix, True, client_to_server, federationList, send_threads, postLog, cachedWebfingers, - personCache, debug, project_version, + person_cache, debug, project_version, sharedItemsToken, groupAccount, signingPrivateKeyPem, 634219) @@ -3264,7 +3264,7 @@ def sendToFollowersThread(session, base_dir: str, onion_domain: str, i2p_domain: str, port: int, http_prefix: str, federationList: [], send_threads: [], postLog: [], - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, post_json_object: {}, debug: bool, project_version: str, shared_items_federated_domains: [], @@ -3279,7 +3279,7 @@ def sendToFollowersThread(session, base_dir: str, onion_domain, i2p_domain, port, http_prefix, federationList, send_threads, postLog, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, post_json_object.copy(), debug, project_version, shared_items_federated_domains, @@ -3461,7 +3461,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str, allow_local_network_access: bool, recentPostsCache: {}, debug: bool, systemLanguage: str, - domainFull: str, personCache: {}, + domainFull: str, person_cache: {}, signingPrivateKeyPem: str) -> bool: """Returns true if the given post has attached image media """ @@ -3476,7 +3476,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str, allow_local_network_access, recentPostsCache, debug, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) if postJsonAnnounce: @@ -3874,7 +3874,7 @@ def _createBoxIndexed(recentPostsCache: {}, return boxItems -def expireCache(base_dir: str, personCache: {}, +def expireCache(base_dir: str, person_cache: {}, http_prefix: str, archiveDir: str, recentPostsCache: {}, maxPostsInBox=32000): @@ -3883,7 +3883,7 @@ def expireCache(base_dir: str, personCache: {}, while True: # once per day time.sleep(60 * 60 * 24) - expirePersonCache(personCache) + expirePersonCache(person_cache) archivePosts(base_dir, http_prefix, archiveDir, recentPostsCache, maxPostsInBox) @@ -4078,7 +4078,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str, if debug: print('Session was not created') return - personCache = {} + person_cache = {} cachedWebfingers = {} federationList = [] groupAccount = False @@ -4107,7 +4107,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, 'outbox', 62524) @@ -4121,7 +4121,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str, maxAttachments = 5 _getPosts(session, personUrl, 30, max_mentions, max_emoji, maxAttachments, federationList, - personCache, raw, simple, debug, + person_cache, raw, simple, debug, project_version, http_prefix, originDomain, systemLanguage, signingPrivateKeyPem) @@ -4139,7 +4139,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str, session = createSession(proxy_type) if not session: return domainList - personCache = {} + person_cache = {} cachedWebfingers = {} federationList = [] @@ -4160,7 +4160,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, 'outbox', 92522) @@ -4170,7 +4170,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str, postDomains = \ getPostDomains(session, personUrl, 64, max_mentions, max_emoji, maxAttachments, federationList, - personCache, debug, + person_cache, debug, project_version, http_prefix, domain, wordFrequency, domainList, systemLanguage, signingPrivateKeyPem) @@ -4235,7 +4235,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str, session = createSession(proxy_type) if not session: return {} - personCache = {} + person_cache = {} cachedWebfingers = {} federationList = [] @@ -4256,7 +4256,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, 'outbox', 13863) @@ -4267,7 +4267,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str, postDomains = \ getPostDomains(session, personUrl, maxPosts, max_mentions, max_emoji, maxAttachments, federationList, - personCache, debug, + person_cache, debug, project_version, http_prefix, domain, wordFrequency, [], systemLanguage, signingPrivateKeyPem) postDomains.sort() @@ -4281,7 +4281,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str, max_mentions, max_emoji, maxAttachments, federationList, - personCache, + person_cache, debug, project_version, http_prefix, domain, signingPrivateKeyPem) @@ -4512,7 +4512,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str, allow_local_network_access: bool, recentPostsCache: {}, debug: bool, systemLanguage: str, - domainFull: str, personCache: {}, + domainFull: str, person_cache: {}, signingPrivateKeyPem: str, blockedCache: {}) -> {}: """Download the post referenced by an announce @@ -4662,7 +4662,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str, if not understoodPostLanguage(base_dir, nickname, domain, announcedJson, systemLanguage, http_prefix, domainFull, - personCache): + person_cache): return None # Check the content of the announce contentStr = announcedJson['content'] @@ -4758,7 +4758,7 @@ def sendBlockViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, blockedUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a block via c2s @@ -4806,7 +4806,7 @@ def sendBlockViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72652) @@ -4842,7 +4842,7 @@ def sendMuteViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, mutedUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a mute via c2s @@ -4886,7 +4886,7 @@ def sendMuteViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72652) @@ -4922,7 +4922,7 @@ def sendUndoMuteViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, mutedUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undoes a mute via c2s @@ -4971,7 +4971,7 @@ def sendUndoMuteViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72652) @@ -5008,7 +5008,7 @@ def sendUndoBlockViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, blockedUrl: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a block via c2s @@ -5059,7 +5059,7 @@ def sendUndoBlockViaServer(base_dir: str, session, (inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, - base_dir, session, wfRequest, personCache, + base_dir, session, wfRequest, person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 53892) diff --git a/reaction.py b/reaction.py index 4cf510744..e292fcfe1 100644 --- a/reaction.py +++ b/reaction.py @@ -68,7 +68,7 @@ def _reaction(recentPostsCache: {}, actorReaction: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates an emoji reaction @@ -104,7 +104,7 @@ def _reaction(recentPostsCache: {}, reactionPostNickname = getNicknameFromActor(actorReaction) reactionPostDomain, reactionPostPort = \ getDomainFromActor(actorReaction) - groupAccount = hasGroupType(base_dir, actorReaction, personCache) + groupAccount = hasGroupType(base_dir, actorReaction, person_cache) else: if hasUsersPath(objectUrl): reactionPostNickname = getNicknameFromActor(objectUrl) @@ -115,7 +115,7 @@ def _reaction(recentPostsCache: {}, objectUrl.split('/' + reactionPostNickname + '/')[0] + \ '/' + reactionPostNickname groupAccount = \ - hasGroupType(base_dir, actorReaction, personCache) + hasGroupType(base_dir, actorReaction, person_cache) if reactionPostNickname: postFilename = locatePost(base_dir, nickname, domain, objectUrl) @@ -138,7 +138,7 @@ def _reaction(recentPostsCache: {}, reactionPostDomain, reactionPostPort, 'https://www.w3.org/ns/activitystreams#Public', http_prefix, True, client_to_server, federationList, - send_threads, postLog, cachedWebfingers, personCache, + send_threads, postLog, cachedWebfingers, person_cache, debug, project_version, None, groupAccount, signingPrivateKeyPem, 7165392) @@ -153,7 +153,7 @@ def reactionPost(recentPostsCache: {}, reactionStatusNumber: int, emojiContent: str, client_to_server: bool, send_threads: [], postLog: [], - personCache: {}, cachedWebfingers: {}, + person_cache: {}, cachedWebfingers: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Adds a reaction to a given status post. This is only used by unit tests @@ -169,7 +169,7 @@ def reactionPost(recentPostsCache: {}, nickname, domain, port, ccList, http_prefix, objectUrl, emojiContent, actorReaction, client_to_server, - send_threads, postLog, personCache, cachedWebfingers, + send_threads, postLog, person_cache, cachedWebfingers, debug, project_version, signingPrivateKeyPem) @@ -178,7 +178,7 @@ def sendReactionViaServer(base_dir: str, session, fromDomain: str, fromPort: int, http_prefix: str, reactionUrl: str, emojiContent: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Creates a reaction via c2s @@ -227,7 +227,7 @@ def sendReactionViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72873) @@ -268,7 +268,7 @@ def sendUndoReactionViaServer(base_dir: str, session, fromDomain: str, fromPort: int, http_prefix: str, reactionUrl: str, emojiContent: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undo a reaction via c2s @@ -318,7 +318,7 @@ def sendUndoReactionViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 72625) diff --git a/schedule.py b/schedule.py index bd8656f63..652c1fc46 100644 --- a/schedule.py +++ b/schedule.py @@ -109,7 +109,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd, httpd.send_threads, httpd.postLog, httpd.cachedWebfingers, - httpd.personCache, + httpd.person_cache, httpd.allow_deletion, httpd.proxy_type, httpd.project_version, diff --git a/shares.py b/shares.py index 62178f688..59860f3c9 100644 --- a/shares.py +++ b/shares.py @@ -558,7 +558,7 @@ def sendShareViaServer(base_dir, session, summary: str, imageFilename: str, itemQty: float, itemType: str, itemCategory: str, location: str, duration: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, itemPrice: str, itemCurrency: str, signingPrivateKeyPem: str) -> {}: @@ -630,7 +630,7 @@ def sendShareViaServer(base_dir, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 83653) @@ -680,7 +680,7 @@ def sendUndoShareViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, displayName: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undoes a share via c2s @@ -734,7 +734,7 @@ def sendUndoShareViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 12663) @@ -778,7 +778,7 @@ def sendWantedViaServer(base_dir, session, summary: str, imageFilename: str, itemQty: float, itemType: str, itemCategory: str, location: str, duration: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, itemMaxPrice: str, itemCurrency: str, signingPrivateKeyPem: str) -> {}: @@ -850,7 +850,7 @@ def sendWantedViaServer(base_dir, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 23653) @@ -900,7 +900,7 @@ def sendUndoWantedViaServer(base_dir: str, session, fromNickname: str, password: str, fromDomain: str, fromPort: int, http_prefix: str, displayName: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Undoes a wanted item via c2s @@ -954,7 +954,7 @@ def sendUndoWantedViaServer(base_dir: str, session, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, fromNickname, fromDomain, postToBox, 12693) diff --git a/skills.py b/skills.py index f8c23c872..9428cb7b7 100644 --- a/skills.py +++ b/skills.py @@ -176,7 +176,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str, domain: str, port: int, http_prefix: str, skill: str, skillLevelPercent: int, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, signingPrivateKeyPem: str) -> {}: """Sets a skill for a person via c2s @@ -229,7 +229,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, project_version, + person_cache, project_version, http_prefix, nickname, domain, postToBox, 76121) diff --git a/socnet.py b/socnet.py index bd8f7d554..2adc659a7 100644 --- a/socnet.py +++ b/socnet.py @@ -31,7 +31,7 @@ def instancesGraph(base_dir: str, handles: str, if not session: return dotGraphStr + '}\n' - personCache = {} + person_cache = {} cachedWebfingers = {} federationList = [] max_mentions = 99 @@ -68,7 +68,7 @@ def instancesGraph(base_dir: str, handles: str, displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain, base_dir, session, wfRequest, - personCache, + person_cache, project_version, http_prefix, nickname, domain, 'outbox', 27261) @@ -76,7 +76,7 @@ def instancesGraph(base_dir: str, handles: str, postDomains = \ getPostDomains(session, personUrl, 64, max_mentions, max_emoji, maxAttachments, federationList, - personCache, debug, + person_cache, debug, project_version, http_prefix, domain, wordFrequency, [], systemLanguage, signingPrivateKeyPem) diff --git a/speaker.py b/speaker.py index 7e209b616..024b5ae3c 100644 --- a/speaker.py +++ b/speaker.py @@ -404,7 +404,7 @@ def speakableText(base_dir: str, content: str, translate: {}) -> (str, []): def _postToSpeakerJson(base_dir: str, http_prefix: str, nickname: str, domain: str, domainFull: str, - post_json_object: {}, personCache: {}, + post_json_object: {}, person_cache: {}, translate: {}, announcingActor: str, themeName: str) -> {}: """Converts an ActivityPub post into some Json containing @@ -470,14 +470,14 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, summary = html.unescape(summary) speakerName = \ - getDisplayName(base_dir, post_json_object['actor'], personCache) + getDisplayName(base_dir, post_json_object['actor'], person_cache) if not speakerName: return speakerName = _removeEmojiFromText(speakerName) speakerName = speakerName.replace('_', ' ') speakerName = camelCaseSplit(speakerName) gender = getGenderFromBio(base_dir, post_json_object['actor'], - personCache, translate) + person_cache, translate) if announcingActor: announcedNickname = getNicknameFromActor(announcingActor) announcedDomain, announcedport = getDomainFromActor(announcingActor) @@ -536,7 +536,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, def updateSpeaker(base_dir: str, http_prefix: str, nickname: str, domain: str, domainFull: str, - post_json_object: {}, personCache: {}, + post_json_object: {}, person_cache: {}, translate: {}, announcingActor: str, themeName: str) -> None: """ Generates a json file which can be used for TTS announcement @@ -545,7 +545,7 @@ def updateSpeaker(base_dir: str, http_prefix: str, speakerJson = \ _postToSpeakerJson(base_dir, http_prefix, nickname, domain, domainFull, - post_json_object, personCache, + post_json_object, person_cache, translate, announcingActor, themeName) speakerFilename = acctDir(base_dir, nickname, domain) + '/speaker.json' diff --git a/tests.py b/tests.py index a148d34dd..23ceed2f2 100644 --- a/tests.py +++ b/tests.py @@ -652,9 +652,9 @@ def _testCache(): "id": 123456, "test": "This is a test" } - personCache = {} - storePersonInCache(None, personUrl, personJson, personCache, True) - result = getPersonFromCache(None, personUrl, personCache, True) + person_cache = {} + storePersonInCache(None, personUrl, personJson, person_cache, True) + result = getPersonFromCache(None, personUrl, person_cache, True) assert result['id'] == 123456 assert result['test'] == 'This is a test' @@ -2864,7 +2864,7 @@ def testClientToServer(base_dir: str): city = 'London, England' isArticle = False cachedWebfingers = {} - personCache = {} + person_cache = {} password = 'alicepass' conversationId = None @@ -2896,7 +2896,7 @@ def testClientToServer(base_dir: str): followersOnly, True, attachedImageFilename, mediaType, attachedImageDescription, city, - cachedWebfingers, personCache, isArticle, + cachedWebfingers, person_cache, isArticle, systemLanguage, low_bandwidth, content_license_url, True, None, None, @@ -2960,7 +2960,7 @@ def testClientToServer(base_dir: str): aliceDomain, alicePort, 'bob', bobDomain, bobPort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) alicePetnamesFilename = aliceDir + '/accounts/' + \ 'alice@' + aliceDomain + '/petnames.txt' @@ -3002,7 +3002,7 @@ def testClientToServer(base_dir: str): bobDomain, bobPort, 'alice', aliceDomain, alicePort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for t in range(10): if os.path.isfile(aliceDir + '/accounts/alice@' + aliceDomain + @@ -3057,7 +3057,7 @@ def testClientToServer(base_dir: str): 'bob', 'bobpass', bobDomain, bobPort, http_prefix, outboxPostId, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(20): if os.path.isdir(outboxPath) and os.path.isdir(inboxPath): @@ -3087,7 +3087,7 @@ def testClientToServer(base_dir: str): 'bob', 'bobpass', bobDomain, bobPort, http_prefix, outboxPostId, '😃', - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(20): if os.path.isdir(outboxPath) and os.path.isdir(inboxPath): @@ -3134,7 +3134,7 @@ def testClientToServer(base_dir: str): bobDomain, bobPort, http_prefix, outboxPostId, cachedWebfingers, - personCache, True, __version__, + person_cache, True, __version__, signingPrivateKeyPem) for i in range(20): if os.path.isdir(outboxPath) and os.path.isdir(inboxPath): @@ -3171,7 +3171,7 @@ def testClientToServer(base_dir: str): sendDeleteViaServer(aliceDir, sessionAlice, 'alice', password, aliceDomain, alicePort, http_prefix, outboxPostId, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for i in range(30): if os.path.isdir(inboxPath): @@ -3196,7 +3196,7 @@ def testClientToServer(base_dir: str): aliceDomain, alicePort, 'bob', bobDomain, bobPort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, __version__, signingPrivateKeyPem) for t in range(10): if 'alice@' + aliceDomain + ':' + str(alicePort) not in \ @@ -5113,7 +5113,7 @@ def testUpdateActor(base_dir: str): sessionAlice = createSession(proxy_type) cachedWebfingers = {} - personCache = {} + person_cache = {} password = 'alicepass' outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox' actorFilename = aliceDir + '/accounts/' + 'alice@' + aliceDomain + '.json' @@ -5147,7 +5147,7 @@ def testUpdateActor(base_dir: str): 'alice', password, aliceDomain, alicePort, http_prefix, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, True, pubKey, signingPrivateKeyPem) print('actor update result: ' + str(actorUpdate)) assert actorUpdate diff --git a/utils.py b/utils.py index ff973ec13..8305ba8db 100644 --- a/utils.py +++ b/utils.py @@ -900,17 +900,17 @@ def dangerousSVG(content: str, allow_local_network_access: bool) -> bool: separators, invalidStrings) -def getDisplayName(base_dir: str, actor: str, personCache: {}) -> str: +def getDisplayName(base_dir: str, actor: str, person_cache: {}) -> str: """Returns the display name for the given actor """ if '/statuses/' in actor: actor = actor.split('/statuses/')[0] - if not personCache.get(actor): + if not person_cache.get(actor): return None nameFound = None - if personCache[actor].get('actor'): - if personCache[actor]['actor'].get('name'): - nameFound = personCache[actor]['actor']['name'] + if person_cache[actor].get('actor'): + if person_cache[actor]['actor'].get('name'): + nameFound = person_cache[actor]['actor']['name'] else: # Try to obtain from the cached actors cachedActorFilename = \ @@ -950,7 +950,7 @@ def _genderFromString(translate: {}, text: str) -> str: return gender -def getGenderFromBio(base_dir: str, actor: str, personCache: {}, +def getGenderFromBio(base_dir: str, actor: str, person_cache: {}, translate: {}) -> str: """Tries to ascertain gender from bio description This is for use by text-to-speech for pitch setting @@ -958,7 +958,7 @@ def getGenderFromBio(base_dir: str, actor: str, personCache: {}, defaultGender = 'They/Them' if '/statuses/' in actor: actor = actor.split('/statuses/')[0] - if not personCache.get(actor): + if not person_cache.get(actor): return defaultGender bioFound = None if translate: @@ -966,8 +966,8 @@ def getGenderFromBio(base_dir: str, actor: str, personCache: {}, else: pronounStr = 'pronoun' actorJson = None - if personCache[actor].get('actor'): - actorJson = personCache[actor]['actor'] + if person_cache[actor].get('actor'): + actorJson = person_cache[actor]['actor'] else: # Try to obtain from the cached actors cachedActorFilename = \ @@ -2982,7 +2982,7 @@ def dateSecondsToString(dateSec: int) -> str: return thisDate.strftime("%Y-%m-%dT%H:%M:%SZ") -def hasGroupType(base_dir: str, actor: str, personCache: {}, +def hasGroupType(base_dir: str, actor: str, person_cache: {}, debug: bool = False) -> bool: """Does the given actor url have a group type? """ @@ -2995,18 +2995,18 @@ def hasGroupType(base_dir: str, actor: str, personCache: {}, print('grpPath ' + grpPath + ' in ' + actor) return True # is there a cached actor which can be examined for Group type? - return isGroupActor(base_dir, actor, personCache, debug) + return isGroupActor(base_dir, actor, person_cache, debug) -def isGroupActor(base_dir: str, actor: str, personCache: {}, +def isGroupActor(base_dir: str, actor: str, person_cache: {}, debug: bool = False) -> bool: """Is the given actor a group? """ - if personCache: - if personCache.get(actor): - if personCache[actor].get('actor'): - if personCache[actor]['actor'].get('type'): - if personCache[actor]['actor']['type'] == 'Group': + if person_cache: + if person_cache.get(actor): + if person_cache[actor].get('actor'): + if person_cache[actor]['actor'].get('type'): + if person_cache[actor]['actor']['type'] == 'Group': if debug: print('Cached actor ' + actor + ' has Group type') return True diff --git a/webapp_calendar.py b/webapp_calendar.py index dd2b25bc9..857a474da 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -96,7 +96,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str, return deletePostStr -def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {}, +def _htmlCalendarDay(person_cache: {}, cssCache: {}, translate: {}, base_dir: str, path: str, year: int, monthNumber: int, dayNumber: int, nickname: str, domain: str, dayEvents: [], @@ -160,7 +160,7 @@ def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {}, senderActor = ev['sender'] dispName = \ getDisplayName(base_dir, senderActor, - personCache) + person_cache) if dispName: senderName = \ '' + \ @@ -243,7 +243,7 @@ def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {}, return calendarStr -def htmlCalendar(personCache: {}, cssCache: {}, translate: {}, +def htmlCalendar(person_cache: {}, cssCache: {}, translate: {}, base_dir: str, path: str, http_prefix: str, domainFull: str, textModeBanner: str, accessKeys: {}) -> str: @@ -298,7 +298,7 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {}, if events: if events.get(str(dayNumber)): dayEvents = events[str(dayNumber)] - return _htmlCalendarDay(personCache, cssCache, + return _htmlCalendarDay(person_cache, cssCache, translate, base_dir, path, year, monthNumber, dayNumber, nickname, domain, dayEvents, diff --git a/webapp_confirm.py b/webapp_confirm.py index e04302ffb..05e7f51c6 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -28,7 +28,7 @@ def htmlConfirmDelete(cssCache: {}, translate, pageNumber: int, session, base_dir: str, messageId: str, http_prefix: str, project_version: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, callingDomain: str, yt_replace_domain: str, twitter_replacement_domain: str, @@ -68,7 +68,7 @@ def htmlConfirmDelete(cssCache: {}, individualPostAsHtml(signingPrivateKeyPem, True, recentPostsCache, max_recent_posts, translate, pageNumber, - base_dir, session, cachedWebfingers, personCache, + base_dir, session, cachedWebfingers, person_cache, nickname, domain, port, post_json_object, None, True, False, http_prefix, project_version, 'outbox', diff --git a/webapp_create_post.py b/webapp_create_post.py index faf744890..791daa250 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -199,7 +199,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {}, conversationId: str, recentPostsCache: {}, max_recent_posts: int, session, cachedWebfingers: {}, - personCache: {}, port: int, + person_cache: {}, port: int, post_json_object: {}, project_version: str, yt_replace_domain: str, @@ -265,7 +265,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {}, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, None, True, False, diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index c2c11c65d..dad8ccf79 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -26,7 +26,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int, translate: {}, base_dir: str, http_prefix: str, nickname: str, domain: str, port: int, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, project_version: str, yt_replace_domain: str, twitter_replacement_domain: str, @@ -70,7 +70,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, item, None, True, False, http_prefix, project_version, 'inbox', @@ -101,7 +101,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str, translate: {}, project_version: str, base_dir: str, http_prefix: str, authorized: bool, profileJson: {}, selected: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, show_published_date_only: bool, @@ -177,7 +177,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str, translate, base_dir, http_prefix, nickname, domain, port, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, project_version, yt_replace_domain, twitter_replacement_domain, diff --git a/webapp_moderation.py b/webapp_moderation.py index c4eda1c52..d62775d0e 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -33,7 +33,7 @@ from session import createSession def htmlModeration(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, - session, base_dir: str, wfRequest: {}, personCache: {}, + session, base_dir: str, wfRequest: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -63,7 +63,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - wfRequest, personCache, + wfRequest, person_cache, nickname, domain, port, inboxJson, 'moderation', allow_deletion, http_prefix, project_version, True, False, diff --git a/webapp_post.py b/webapp_post.py index 6cb58af51..6d80d8ef0 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -273,7 +273,7 @@ def _getPostFromRecentCache(session, nickname: str, domain: str, post_json_object: {}, postActor: str, - personCache: {}, + person_cache: {}, allowDownloads: bool, showPublicOnly: bool, storeToCache: bool, @@ -304,14 +304,14 @@ def _getPostFromRecentCache(session, # update avatar if needed if not avatarUrl: avatarUrl = \ - getPersonAvatarUrl(base_dir, postActor, personCache, + getPersonAvatarUrl(base_dir, postActor, person_cache, allowDownloads) _logPostTiming(enableTimingLog, postStartTime, '2.1') updateAvatarImageCache(signingPrivateKeyPem, session, base_dir, http_prefix, - postActor, avatarUrl, personCache, + postActor, avatarUrl, person_cache, allowDownloads) _logPostTiming(enableTimingLog, postStartTime, '2.2') @@ -955,7 +955,7 @@ def _getPostTitleAnnounceHtml(base_dir: str, enableTimingLog: bool, postStartTime, boxName: str, - personCache: {}, + person_cache: {}, allowDownloads: bool, avatarPosition: str, pageNumber: int, @@ -996,8 +996,8 @@ def _getPostTitleAnnounceHtml(base_dir: str, containerClassIcons, containerClass) announceDomain, announcePort = getDomainFromActor(attributedTo) - getPersonFromCache(base_dir, attributedTo, personCache, allowDownloads) - announceDisplayName = getDisplayName(base_dir, attributedTo, personCache) + getPersonFromCache(base_dir, attributedTo, person_cache, allowDownloads) + announceDisplayName = getDisplayName(base_dir, attributedTo, person_cache) if not announceDisplayName: announceDisplayName = announceNickname + '@' + announceDomain @@ -1017,7 +1017,7 @@ def _getPostTitleAnnounceHtml(base_dir: str, announceActor = attributedTo announceAvatarUrl = \ getPersonAvatarUrl(base_dir, announceActor, - personCache, allowDownloads) + person_cache, allowDownloads) _logPostTiming(enableTimingLog, postStartTime, '13.4') @@ -1122,7 +1122,7 @@ def _getPostTitleReplyHtml(base_dir: str, enableTimingLog: bool, postStartTime, boxName: str, - personCache: {}, + person_cache: {}, allowDownloads: bool, avatarPosition: str, pageNumber: int, @@ -1179,8 +1179,8 @@ def _getPostTitleReplyHtml(base_dir: str, return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass) - getPersonFromCache(base_dir, replyActor, personCache, allowDownloads) - replyDisplayName = getDisplayName(base_dir, replyActor, personCache) + getPersonFromCache(base_dir, replyActor, person_cache, allowDownloads) + replyDisplayName = getDisplayName(base_dir, replyActor, person_cache) if not replyDisplayName: replyDisplayName = replyNickname + '@' + replyDomain @@ -1200,7 +1200,7 @@ def _getPostTitleReplyHtml(base_dir: str, # show avatar of person replied to replyAvatarUrl = \ - getPersonAvatarUrl(base_dir, replyActor, personCache, allowDownloads) + getPersonAvatarUrl(base_dir, replyActor, person_cache, allowDownloads) _logPostTiming(enableTimingLog, postStartTime, '13.8') @@ -1234,7 +1234,7 @@ def _getPostTitleHtml(base_dir: str, enableTimingLog: bool, postStartTime, boxName: str, - personCache: {}, + person_cache: {}, allowDownloads: bool, avatarPosition: str, pageNumber: int, @@ -1262,7 +1262,7 @@ def _getPostTitleHtml(base_dir: str, enableTimingLog, postStartTime, boxName, - personCache, + person_cache, allowDownloads, avatarPosition, pageNumber, @@ -1281,7 +1281,7 @@ def _getPostTitleHtml(base_dir: str, enableTimingLog, postStartTime, boxName, - personCache, + person_cache, allowDownloads, avatarPosition, pageNumber, @@ -1324,7 +1324,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, base_dir: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, post_json_object: {}, avatarUrl: str, showAvatarOptions: bool, @@ -1393,7 +1393,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, http_prefix, nickname, domain, post_json_object, postActor, - personCache, + person_cache, allowDownloads, showPublicOnly, storeToCache, @@ -1415,7 +1415,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, avatarUrl = \ getAvatarImageUrl(session, base_dir, http_prefix, - postActor, personCache, + postActor, person_cache, avatarUrl, allowDownloads, signingPrivateKeyPem) @@ -1443,7 +1443,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, originDomain, base_dir, session, postActorWf, - personCache, + person_cache, project_version, http_prefix, nickname, domain, @@ -1504,7 +1504,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, allow_local_network_access, recentPostsCache, False, systemLanguage, - domainFull, personCache, + domainFull, person_cache, signingPrivateKeyPem, blockedCache) if not postJsonAnnounce: @@ -1521,7 +1521,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, http_prefix, nickname, domain, post_json_object, postActor, - personCache, + person_cache, allowDownloads, showPublicOnly, storeToCache, @@ -1549,7 +1549,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, if not os.path.isfile(announceFilename + '.tts'): updateSpeaker(base_dir, http_prefix, nickname, domain, domainFull, - post_json_object, personCache, + post_json_object, person_cache, translate, post_json_object['actor'], themeName) with open(announceFilename + '.tts', 'w+') as ttsFile: @@ -1579,7 +1579,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, actorNickname = 'dev' actorDomain, actorPort = getDomainFromActor(postActor) - displayName = getDisplayName(base_dir, postActor, personCache) + displayName = getDisplayName(base_dir, postActor, person_cache) if displayName: if ':' in displayName: displayName = \ @@ -1762,7 +1762,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, enableTimingLog, postStartTime, boxName, - personCache, + person_cache, allowDownloads, avatarPosition, pageNumber, @@ -1851,7 +1851,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str, domainFull = getFullDomain(domain, port) personUrl = localActorUrl(http_prefix, nickname, domainFull) actorJson = \ - getPersonFromCache(base_dir, personUrl, personCache, False) + getPersonFromCache(base_dir, personUrl, person_cache, False) languagesUnderstood = [] if actorJson: languagesUnderstood = getActorLanguagesList(actorJson) @@ -1994,7 +1994,7 @@ def htmlIndividualPost(cssCache: {}, recentPostsCache: {}, max_recent_posts: int, translate: {}, base_dir: str, session, cachedWebfingers: {}, - personCache: {}, + person_cache: {}, nickname: str, domain: str, port: int, authorized: bool, post_json_object: {}, http_prefix: str, project_version: str, likedBy: str, @@ -2060,7 +2060,7 @@ def htmlIndividualPost(cssCache: {}, individualPostAsHtml(signingPrivateKeyPem, True, recentPostsCache, max_recent_posts, translate, None, - base_dir, session, cachedWebfingers, personCache, + base_dir, session, cachedWebfingers, person_cache, nickname, domain, port, post_json_object, None, True, False, http_prefix, project_version, 'inbox', @@ -2090,7 +2090,7 @@ def htmlIndividualPost(cssCache: {}, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, None, True, False, @@ -2126,7 +2126,7 @@ def htmlIndividualPost(cssCache: {}, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, item, None, True, False, http_prefix, project_version, 'inbox', @@ -2155,7 +2155,7 @@ def htmlIndividualPost(cssCache: {}, def htmlPostReplies(cssCache: {}, recentPostsCache: {}, max_recent_posts: int, translate: {}, base_dir: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, repliesJson: {}, http_prefix: str, project_version: str, yt_replace_domain: str, @@ -2178,7 +2178,7 @@ def htmlPostReplies(cssCache: {}, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, item, None, True, False, http_prefix, project_version, 'inbox', @@ -2207,7 +2207,7 @@ def htmlEmojiReactionPicker(cssCache: {}, recentPostsCache: {}, max_recent_posts: int, translate: {}, base_dir: str, session, cachedWebfingers: {}, - personCache: {}, + person_cache: {}, nickname: str, domain: str, port: int, post_json_object: {}, http_prefix: str, project_version: str, @@ -2230,7 +2230,7 @@ def htmlEmojiReactionPicker(cssCache: {}, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, None, True, False, http_prefix, project_version, 'inbox', diff --git a/webapp_profile.py b/webapp_profile.py index 7124011b9..d1e06afc8 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -127,7 +127,7 @@ def htmlProfileAfterSearch(cssCache: {}, base_dir: str, path: str, http_prefix: str, nickname: str, domain: str, port: int, profileHandle: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, debug: bool, project_version: str, yt_replace_domain: str, twitter_replacement_domain: str, @@ -180,7 +180,7 @@ def htmlProfileAfterSearch(cssCache: {}, avatarUrl = profileJson['icon']['url'] if not avatarUrl: avatarUrl = getPersonAvatarUrl(base_dir, personUrl, - personCache, True) + person_cache, True) displayName = searchNickname if profileJson.get('name'): displayName = profileJson['name'] @@ -336,7 +336,7 @@ def htmlProfileAfterSearch(cssCache: {}, individualPostAsHtml(signingPrivateKeyPem, True, recentPostsCache, max_recent_posts, translate, None, base_dir, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, nickname, domain, port, post_json_object, avatarUrl, False, False, http_prefix, project_version, 'inbox', @@ -546,7 +546,7 @@ def htmlProfile(signingPrivateKeyPem: str, translate: {}, project_version: str, base_dir: str, http_prefix: str, authorized: bool, profileJson: {}, selected: str, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, show_published_date_only: bool, @@ -575,7 +575,7 @@ def htmlProfile(signingPrivateKeyPem: str, translate, project_version, base_dir, http_prefix, authorized, profileJson, selected, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, yt_replace_domain, twitter_replacement_domain, show_published_date_only, @@ -956,7 +956,7 @@ def htmlProfile(signingPrivateKeyPem: str, translate, base_dir, http_prefix, authorized, nickname, domain, port, - session, cachedWebfingers, personCache, + session, cachedWebfingers, person_cache, project_version, yt_replace_domain, twitter_replacement_domain, @@ -973,7 +973,8 @@ def htmlProfile(signingPrivateKeyPem: str, _htmlProfileFollowing(translate, base_dir, http_prefix, authorized, nickname, domain, port, session, - cachedWebfingers, personCache, extraJson, + cachedWebfingers, + person_cache, extraJson, project_version, ["unfollow"], selected, usersPath, pageNumber, maxItemsPerPage, dormant_months, debug, @@ -983,7 +984,8 @@ def htmlProfile(signingPrivateKeyPem: str, _htmlProfileFollowing(translate, base_dir, http_prefix, authorized, nickname, domain, port, session, - cachedWebfingers, personCache, extraJson, + cachedWebfingers, + person_cache, extraJson, project_version, ["block"], selected, usersPath, pageNumber, maxItemsPerPage, dormant_months, debug, @@ -1024,7 +1026,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int, base_dir: str, http_prefix: str, authorized: bool, nickname: str, domain: str, port: int, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, project_version: str, yt_replace_domain: str, twitter_replacement_domain: str, @@ -1067,7 +1069,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, item, None, True, False, http_prefix, project_version, 'inbox', @@ -1093,7 +1095,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int, def _htmlProfileFollowing(translate: {}, base_dir: str, http_prefix: str, authorized: bool, nickname: str, domain: str, port: int, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, followingJson: {}, project_version: str, buttons: [], feedName: str, actor: str, @@ -1129,7 +1131,7 @@ def _htmlProfileFollowing(translate: {}, base_dir: str, http_prefix: str, profileStr += \ _individualFollowAsHtml(signingPrivateKeyPem, translate, base_dir, session, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, domain, followingActor, authorized, nickname, http_prefix, project_version, dormant, @@ -2336,7 +2338,7 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str, translate: {}, base_dir: str, session, cachedWebfingers: {}, - personCache: {}, domain: str, + person_cache: {}, domain: str, followUrl: str, authorized: bool, actorNickname: str, @@ -2351,11 +2353,11 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str, followUrlDomain, followUrlPort = getDomainFromActor(followUrl) followUrlDomainFull = getFullDomain(followUrlDomain, followUrlPort) titleStr = '@' + followUrlNickname + '@' + followUrlDomainFull - avatarUrl = getPersonAvatarUrl(base_dir, followUrl, personCache, True) + avatarUrl = getPersonAvatarUrl(base_dir, followUrl, person_cache, True) if not avatarUrl: avatarUrl = followUrl + '/avatar.png' - displayName = getDisplayName(base_dir, followUrl, personCache) + displayName = getDisplayName(base_dir, followUrl, person_cache) isGroup = False if not displayName: # lookup the correct webfinger for the followUrl @@ -2372,7 +2374,7 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str, originDomain, base_dir, session, followUrlWf, - personCache, project_version, + person_cache, project_version, http_prefix, followUrlNickname, domain, 'outbox', 43036) if avatarUrl2: diff --git a/webapp_search.py b/webapp_search.py index 3b34e72ec..e56393da8 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -595,7 +595,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str, max_recent_posts: int, session, cachedWebfingers, - personCache: {}, + person_cache: {}, port: int, yt_replace_domain: str, twitter_replacement_domain: str, @@ -678,7 +678,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, None, True, allow_deletion, @@ -708,7 +708,7 @@ def htmlHashtagSearch(cssCache: {}, translate: {}, base_dir: str, hashtag: str, pageNumber: int, postsPerPage: int, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, http_prefix: str, project_version: str, yt_replace_domain: str, twitter_replacement_domain: str, @@ -860,7 +860,7 @@ def htmlHashtagSearch(cssCache: {}, max_recent_posts, translate, None, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, post_json_object, avatarUrl, showAvatarOptions, @@ -901,7 +901,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int, translate: {}, base_dir: str, hashtag: str, postsPerPage: int, - session, cachedWebfingers: {}, personCache: {}, + session, cachedWebfingers: {}, person_cache: {}, http_prefix: str, project_version: str, yt_replace_domain: str, twitter_replacement_domain: str, diff --git a/webapp_timeline.py b/webapp_timeline.py index 637b4c9fd..4e34641b5 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -422,7 +422,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, timelineJson: {}, boxName: str, allow_deletion: bool, http_prefix: str, project_version: str, @@ -900,7 +900,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, translate, pageNumber, base_dir, session, cachedWebfingers, - personCache, + person_cache, nickname, domain, port, item, None, True, allow_deletion, @@ -1122,7 +1122,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1154,7 +1154,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, None, 'tlshares', allow_deletion, http_prefix, project_version, @@ -1180,7 +1180,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1212,7 +1212,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, None, 'tlwanted', allow_deletion, http_prefix, project_version, @@ -1238,7 +1238,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1271,7 +1271,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'inbox', allow_deletion, http_prefix, project_version, @@ -1297,7 +1297,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, bookmarksJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1330,7 +1330,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, bookmarksJson, 'tlbookmarks', allow_deletion, http_prefix, project_version, @@ -1355,7 +1355,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1385,7 +1385,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'dm', allow_deletion, http_prefix, project_version, False, minimal, @@ -1409,7 +1409,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1439,7 +1439,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'tlreplies', allow_deletion, http_prefix, project_version, False, minimal, @@ -1462,7 +1462,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1492,7 +1492,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'tlmedia', allow_deletion, http_prefix, project_version, False, minimal, @@ -1515,7 +1515,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1545,7 +1545,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'tlblogs', allow_deletion, http_prefix, project_version, False, minimal, @@ -1568,7 +1568,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1598,7 +1598,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'tlfeatures', allow_deletion, http_prefix, project_version, False, minimal, @@ -1621,7 +1621,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, inboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1650,7 +1650,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, inboxJson, 'tlnews', allow_deletion, http_prefix, project_version, False, minimal, @@ -1673,7 +1673,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str, recentPostsCache: {}, max_recent_posts: int, translate: {}, pageNumber: int, itemsPerPage: int, session, base_dir: str, - cachedWebfingers: {}, personCache: {}, + cachedWebfingers: {}, person_cache: {}, nickname: str, domain: str, port: int, outboxJson: {}, allow_deletion: bool, http_prefix: str, project_version: str, @@ -1705,7 +1705,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str, recentPostsCache, max_recent_posts, translate, pageNumber, itemsPerPage, session, base_dir, - cachedWebfingers, personCache, + cachedWebfingers, person_cache, nickname, domain, port, outboxJson, 'outbox', allow_deletion, http_prefix, project_version, manuallyApproveFollowers, minimal, diff --git a/webapp_utils.py b/webapp_utils.py index 90d470a54..d63b420fb 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -236,7 +236,7 @@ def setBlogAddress(actorJson: {}, blogAddress: str) -> None: def updateAvatarImageCache(signingPrivateKeyPem: str, session, base_dir: str, http_prefix: str, actor: str, avatarUrl: str, - personCache: {}, allowDownloads: bool, + person_cache: {}, allowDownloads: bool, force: bool = False, debug: bool = False) -> str: """Updates the cached avatar for the given actor """ @@ -316,17 +316,17 @@ def updateAvatarImageCache(signingPrivateKeyPem: str, return None if personJson['id'] != actor: return None - if not personCache.get(actor): + if not person_cache.get(actor): return None - if personCache[actor]['actor']['publicKey']['publicKeyPem'] != \ + if person_cache[actor]['actor']['publicKey']['publicKeyPem'] != \ personJson['publicKey']['publicKeyPem']: print("ERROR: " + "public keys don't match when downloading actor for " + actor) return None - storePersonInCache(base_dir, actor, personJson, personCache, + storePersonInCache(base_dir, actor, personJson, person_cache, allowDownloads) - return getPersonAvatarUrl(base_dir, actor, personCache, + return getPersonAvatarUrl(base_dir, actor, person_cache, allowDownloads) return None return avatarImageFilename.replace(base_dir + '/cache', '') @@ -1232,7 +1232,7 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str: def getAvatarImageUrl(session, base_dir: str, http_prefix: str, - postActor: str, personCache: {}, + postActor: str, person_cache: {}, avatarUrl: str, allowDownloads: bool, signingPrivateKeyPem: str) -> str: """Returns the avatar image url @@ -1240,17 +1240,17 @@ def getAvatarImageUrl(session, # get the avatar image url for the post actor if not avatarUrl: avatarUrl = \ - getPersonAvatarUrl(base_dir, postActor, personCache, + getPersonAvatarUrl(base_dir, postActor, person_cache, allowDownloads) avatarUrl = \ updateAvatarImageCache(signingPrivateKeyPem, session, base_dir, http_prefix, - postActor, avatarUrl, personCache, + postActor, avatarUrl, person_cache, allowDownloads) else: updateAvatarImageCache(signingPrivateKeyPem, session, base_dir, http_prefix, - postActor, avatarUrl, personCache, + postActor, avatarUrl, person_cache, allowDownloads) if not avatarUrl: