diff --git a/announce.py b/announce.py
index 86d944376..4dcfb379a 100644
--- a/announce.py
+++ b/announce.py
@@ -51,7 +51,7 @@ def isSelfAnnounce(post_json_object: {}) -> bool:
return post_json_object['actor'] in post_json_object['object']
-def outboxAnnounce(recentPostsCache: {},
+def outboxAnnounce(recent_posts_cache: {},
base_dir: str, message_json: {}, debug: bool) -> bool:
""" Adds or removes announce entries from the shares collection
within a given post
@@ -77,7 +77,7 @@ def outboxAnnounce(recentPostsCache: {},
postFilename = locatePost(base_dir, nickname, domain,
message_json['object'])
if postFilename:
- updateAnnounceCollection(recentPostsCache, base_dir, postFilename,
+ updateAnnounceCollection(recent_posts_cache, base_dir, postFilename,
message_json['actor'],
nickname, domain, debug)
return True
@@ -95,7 +95,7 @@ def outboxAnnounce(recentPostsCache: {},
postFilename = locatePost(base_dir, nickname, domain,
message_json['object']['object'])
if postFilename:
- undoAnnounceCollectionEntry(recentPostsCache,
+ undoAnnounceCollectionEntry(recent_posts_cache,
base_dir, postFilename,
message_json['actor'],
domain, debug)
@@ -386,7 +386,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
return unAnnounceJson
-def outboxUndoAnnounce(recentPostsCache: {},
+def outboxUndoAnnounce(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -415,7 +415,7 @@ def outboxUndoAnnounce(recentPostsCache: {},
print('DEBUG: c2s undo announce post not found in inbox or outbox')
print(messageId)
return True
- undoAnnounceCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoAnnounceCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['actor'], domain, debug)
if debug:
print('DEBUG: post undo announce via c2s - ' + postFilename)
diff --git a/blocking.py b/blocking.py
index 8d86dfaad..e3b28fbcc 100644
--- a/blocking.py
+++ b/blocking.py
@@ -520,7 +520,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
def mutePost(base_dir: str, nickname: str, domain: str, port: int,
- http_prefix: str, post_id: str, recentPostsCache: {},
+ http_prefix: str, post_id: str, recent_posts_cache: {},
debug: bool) -> None:
""" Mutes the given post
"""
@@ -609,18 +609,18 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
print('MUTE: ' + postFilename + '.muted file added')
# if the post is in the recent posts cache then mark it as muted
- if recentPostsCache.get('index'):
+ if recent_posts_cache.get('index'):
post_id = \
removeIdEnding(post_json_object['id']).replace('/', '#')
- if post_id in recentPostsCache['index']:
+ if post_id in recent_posts_cache['index']:
print('MUTE: ' + post_id + ' is in recent posts cache')
- if recentPostsCache.get('json'):
- recentPostsCache['json'][post_id] = json.dumps(post_json_object)
+ if recent_posts_cache.get('json'):
+ recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
print('MUTE: ' + post_id +
' marked as muted in recent posts memory cache')
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(post_id):
- del recentPostsCache['html'][post_id]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(post_id):
+ del recent_posts_cache['html'][post_id]
print('MUTE: ' + post_id + ' removed cached html')
if alsoUpdatePostId:
@@ -642,18 +642,18 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
cachedPostFilename)
pass
- if recentPostsCache.get('json'):
- if recentPostsCache['json'].get(alsoUpdatePostId):
- del recentPostsCache['json'][alsoUpdatePostId]
+ if recent_posts_cache.get('json'):
+ if recent_posts_cache['json'].get(alsoUpdatePostId):
+ del recent_posts_cache['json'][alsoUpdatePostId]
print('MUTE: ' + alsoUpdatePostId + ' removed referenced json')
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(alsoUpdatePostId):
- del recentPostsCache['html'][alsoUpdatePostId]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(alsoUpdatePostId):
+ del recent_posts_cache['html'][alsoUpdatePostId]
print('MUTE: ' + alsoUpdatePostId + ' removed referenced html')
def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
- http_prefix: str, post_id: str, recentPostsCache: {},
+ http_prefix: str, post_id: str, recent_posts_cache: {},
debug: bool) -> None:
""" Unmutes the given post
"""
@@ -724,18 +724,18 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
str(cachedPostFilename))
# if the post is in the recent posts cache then mark it as unmuted
- if recentPostsCache.get('index'):
+ if recent_posts_cache.get('index'):
post_id = \
removeIdEnding(post_json_object['id']).replace('/', '#')
- if post_id in recentPostsCache['index']:
+ if post_id in recent_posts_cache['index']:
print('UNMUTE: ' + post_id + ' is in recent posts cache')
- if recentPostsCache.get('json'):
- recentPostsCache['json'][post_id] = json.dumps(post_json_object)
+ if recent_posts_cache.get('json'):
+ recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
print('UNMUTE: ' + post_id +
' marked as unmuted in recent posts cache')
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(post_id):
- del recentPostsCache['html'][post_id]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(post_id):
+ del recent_posts_cache['html'][post_id]
print('UNMUTE: ' + post_id + ' removed cached html')
if alsoUpdatePostId:
postFilename = locatePost(base_dir, nickname, domain, alsoUpdatePostId)
@@ -756,14 +756,14 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
'unmutePost cached ref post not removed ' +
str(cachedPostFilename))
- if recentPostsCache.get('json'):
- if recentPostsCache['json'].get(alsoUpdatePostId):
- del recentPostsCache['json'][alsoUpdatePostId]
+ if recent_posts_cache.get('json'):
+ if recent_posts_cache['json'].get(alsoUpdatePostId):
+ del recent_posts_cache['json'][alsoUpdatePostId]
print('UNMUTE: ' +
alsoUpdatePostId + ' removed referenced json')
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(alsoUpdatePostId):
- del recentPostsCache['html'][alsoUpdatePostId]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(alsoUpdatePostId):
+ del recent_posts_cache['html'][alsoUpdatePostId]
print('UNMUTE: ' +
alsoUpdatePostId + ' removed referenced html')
@@ -771,7 +771,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
def outboxMute(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool,
- recentPostsCache: {}) -> None:
+ recent_posts_cache: {}) -> None:
"""When a mute is received by the outbox from c2s
"""
if not message_json.get('type'):
@@ -810,7 +810,7 @@ def outboxMute(base_dir: str, http_prefix: str,
return
mutePost(base_dir, nickname, domain, port,
- http_prefix, message_json['object'], recentPostsCache,
+ http_prefix, message_json['object'], recent_posts_cache,
debug)
if debug:
@@ -820,7 +820,7 @@ def outboxMute(base_dir: str, http_prefix: str,
def outboxUndoMute(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool,
- recentPostsCache: {}) -> None:
+ recent_posts_cache: {}) -> None:
"""When an undo mute is received by the outbox from c2s
"""
if not message_json.get('type'):
@@ -867,7 +867,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
unmutePost(base_dir, nickname, domain, port,
http_prefix, message_json['object']['object'],
- recentPostsCache, debug)
+ recent_posts_cache, debug)
if debug:
print('DEBUG: post undo mute via c2s - ' + postFilename)
diff --git a/bookmarks.py b/bookmarks.py
index 84aa97692..07fef0801 100644
--- a/bookmarks.py
+++ b/bookmarks.py
@@ -32,7 +32,7 @@ from posts import getPersonBox
from session import postJson
-def undoBookmarksCollectionEntry(recentPostsCache: {},
+def undoBookmarksCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str,
objectUrl: str,
actor: str, domain: str, debug: bool) -> None:
@@ -56,7 +56,7 @@ def undoBookmarksCollectionEntry(recentPostsCache: {},
print('EX: undoBookmarksCollectionEntry ' +
'unable to delete cached post file ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
# remove from the index
bookmarksIndexFilename = \
@@ -153,7 +153,7 @@ def _noOfBookmarks(post_json_object: {}) -> int:
return len(post_json_object['object']['bookmarks']['items'])
-def updateBookmarksCollection(recentPostsCache: {},
+def updateBookmarksCollection(recent_posts_cache: {},
base_dir: str, postFilename: str,
objectUrl: str,
actor: str, domain: str, debug: bool) -> None:
@@ -175,7 +175,7 @@ def updateBookmarksCollection(recentPostsCache: {},
print('EX: updateBookmarksCollection ' +
'unable to delete cached post ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('object'):
if debug:
@@ -248,7 +248,7 @@ def updateBookmarksCollection(recentPostsCache: {},
bookmarksIndexFilename)
-def bookmark(recentPostsCache: {},
+def bookmark(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
@@ -300,14 +300,14 @@ def bookmark(recentPostsCache: {},
print('DEBUG: bookmark objectUrl: ' + objectUrl)
return None
- updateBookmarksCollection(recentPostsCache,
+ updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, objectUrl,
newBookmarkJson['actor'], domain, debug)
return newBookmarkJson
-def undoBookmark(recentPostsCache: {},
+def undoBookmark(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
@@ -360,7 +360,7 @@ def undoBookmark(recentPostsCache: {},
if not postFilename:
return None
- undoBookmarksCollectionEntry(recentPostsCache,
+ undoBookmarksCollectionEntry(recent_posts_cache,
base_dir, postFilename, objectUrl,
newUndoBookmarkJson['actor'],
domain, debug)
@@ -550,7 +550,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
return newBookmarkJson
-def outboxBookmark(recentPostsCache: {},
+def outboxBookmark(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -599,14 +599,14 @@ def outboxBookmark(recentPostsCache: {},
print('DEBUG: c2s like post not found in inbox or outbox')
print(messageUrl)
return True
- updateBookmarksCollection(recentPostsCache,
+ updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, messageUrl,
message_json['actor'], domain, debug)
if debug:
print('DEBUG: post bookmarked via c2s - ' + postFilename)
-def outboxUndoBookmark(recentPostsCache: {},
+def outboxUndoBookmark(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -655,7 +655,7 @@ def outboxUndoBookmark(recentPostsCache: {},
print('DEBUG: c2s unbookmark post not found in inbox or outbox')
print(messageUrl)
return True
- updateBookmarksCollection(recentPostsCache,
+ updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, messageUrl,
message_json['actor'], domain, debug)
if debug:
diff --git a/daemon.py b/daemon.py
index ad5359b65..cac2e009c 100644
--- a/daemon.py
+++ b/daemon.py
@@ -561,7 +561,7 @@ class PubServer(BaseHTTPRequestHandler):
cachedPostFilename)
# remove from memory cache
removePostFromCache(post_json_object,
- self.server.recentPostsCache)
+ self.server.recent_posts_cache)
else:
print('ERROR: unable to post vote to outbox')
else:
@@ -1283,7 +1283,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.onion_domain,
self.server.i2p_domain,
self.server.port,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.followers_threads,
self.server.federation_list,
self.server.send_threads,
@@ -2017,7 +2017,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname, domain,
postFilename,
debug,
- self.server.recentPostsCache)
+ self.server.recent_posts_cache)
if nickname != 'news':
# if this is a local blog post then also remove it
# from the news actor
@@ -2033,7 +2033,7 @@ class PubServer(BaseHTTPRequestHandler):
'news', domain,
postFilename,
debug,
- self.server.recentPostsCache)
+ self.server.recent_posts_cache)
self._redirect_headers(actorStr + '/moderation',
cookie, calling_domain)
@@ -2716,7 +2716,7 @@ class PubServer(BaseHTTPRequestHandler):
True, accessKeys,
customSubmitText,
conversationId,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.session,
self.server.cached_webfingers,
@@ -2850,7 +2850,7 @@ class PubServer(BaseHTTPRequestHandler):
True, accessKeys,
customSubmitText,
conversationId,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.session,
self.server.cached_webfingers,
@@ -3297,7 +3297,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \
htmlHashtagSearch(self.server.cssCache,
nickname, domain, port,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
base_dir,
@@ -3397,7 +3397,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed,
pageNumber,
self.server.project_version,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.session,
self.server.cached_webfingers,
@@ -3465,7 +3465,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed,
pageNumber,
self.server.project_version,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.session,
self.server.cached_webfingers,
@@ -3555,7 +3555,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.twitter_replacement_domain
profileStr = \
htmlProfileAfterSearch(self.server.cssCache,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
base_dir,
@@ -4661,7 +4661,7 @@ class PubServer(BaseHTTPRequestHandler):
# remove any previous cached news posts
newsId = removeIdEnding(post_json_object['object']['id'])
newsId = newsId.replace('/', '#')
- clearFromPostCaches(base_dir, self.server.recentPostsCache,
+ clearFromPostCaches(base_dir, self.server.recent_posts_cache,
newsId)
# save the news post
@@ -7542,7 +7542,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \
htmlHashtagSearch(self.server.cssCache,
nickname, domain, port,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
base_dir, hashtag, pageNumber,
@@ -7605,7 +7605,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \
rssHashtagSearch(nickname,
domain, port,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
base_dir, hashtag,
@@ -7751,7 +7751,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(announceJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -7796,7 +7796,7 @@ class PubServer(BaseHTTPRequestHandler):
onion_domain: str, i2p_domain: str,
GETstartTime,
repeatPrivate: bool, debug: bool,
- recentPostsCache: {}) -> None:
+ recent_posts_cache: {}) -> None:
"""Undo announce/repeat button was pressed
"""
pageNumber = 1
@@ -7875,7 +7875,7 @@ class PubServer(BaseHTTPRequestHandler):
if postFilename:
deletePost(base_dir, http_prefix,
nickname, domain, postFilename,
- debug, recentPostsCache)
+ debug, recent_posts_cache)
self._postToOutbox(newUndoAnnounce,
self.server.project_version, self.postToNickname)
@@ -8179,10 +8179,10 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = \
locatePost(base_dir, self.postToNickname, domain, likeUrl)
if likedPostFilename:
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
likedPostJson = load_json(likedPostFilename, 0, 1)
if origFilename and origPostUrl:
- updateLikesCollection(recentPostsCache,
+ updateLikesCollection(recent_posts_cache,
base_dir, likedPostFilename,
likeUrl, likeActor, self.postToNickname,
domain, debug, likedPostJson)
@@ -8190,7 +8190,7 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = origFilename
if debug:
print('Updating likes for ' + likedPostFilename)
- updateLikesCollection(recentPostsCache,
+ updateLikesCollection(recent_posts_cache,
base_dir, likedPostFilename, likeUrl,
likeActor, self.postToNickname, domain,
debug, None)
@@ -8212,7 +8212,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -8343,10 +8343,10 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = locatePost(base_dir, self.postToNickname,
domain, likeUrl)
if likedPostFilename:
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
likedPostJson = load_json(likedPostFilename, 0, 1)
if origFilename and origPostUrl:
- undoLikesCollectionEntry(recentPostsCache,
+ undoLikesCollectionEntry(recent_posts_cache,
base_dir, likedPostFilename,
likeUrl, undoActor, domain, debug,
likedPostJson)
@@ -8354,7 +8354,7 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = origFilename
if debug:
print('Removing likes for ' + likedPostFilename)
- undoLikesCollectionEntry(recentPostsCache,
+ undoLikesCollectionEntry(recent_posts_cache,
base_dir,
likedPostFilename, likeUrl,
undoActor, domain, debug, None)
@@ -8367,7 +8367,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -8512,10 +8512,10 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = \
locatePost(base_dir, self.postToNickname, domain, reactionUrl)
if reactionPostFilename:
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
reactionPostJson = load_json(reactionPostFilename, 0, 1)
if origFilename and origPostUrl:
- updateReactionCollection(recentPostsCache,
+ updateReactionCollection(recent_posts_cache,
base_dir, reactionPostFilename,
reactionUrl,
reactionActor, self.postToNickname,
@@ -8525,7 +8525,7 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = origFilename
if debug:
print('Updating emoji reaction for ' + reactionPostFilename)
- updateReactionCollection(recentPostsCache,
+ updateReactionCollection(recent_posts_cache,
base_dir, reactionPostFilename,
reactionUrl,
reactionActor,
@@ -8550,7 +8550,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -8695,10 +8695,10 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = \
locatePost(base_dir, self.postToNickname, domain, reactionUrl)
if reactionPostFilename:
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
reactionPostJson = load_json(reactionPostFilename, 0, 1)
if origFilename and origPostUrl:
- undoReactionCollectionEntry(recentPostsCache,
+ undoReactionCollectionEntry(recent_posts_cache,
base_dir, reactionPostFilename,
reactionUrl,
undoActor, domain, debug,
@@ -8708,7 +8708,7 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = origFilename
if debug:
print('Removing emoji reaction for ' + reactionPostFilename)
- undoReactionCollectionEntry(recentPostsCache,
+ undoReactionCollectionEntry(recent_posts_cache,
base_dir,
reactionPostFilename, reactionUrl,
undoActor, domain, debug,
@@ -8723,7 +8723,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -8823,7 +8823,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlEmojiReactionPicker(self.server.cssCache,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.base_dir,
@@ -8906,7 +8906,7 @@ class PubServer(BaseHTTPRequestHandler):
bookmarkActor = \
local_actor_url(http_prefix, self.postToNickname, domain_full)
ccList = []
- bookmark(self.server.recentPostsCache,
+ bookmark(self.server.recent_posts_cache,
self.server.session,
base_dir,
self.server.federation_list,
@@ -8943,7 +8943,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -9032,7 +9032,7 @@ class PubServer(BaseHTTPRequestHandler):
undoActor = \
local_actor_url(http_prefix, self.postToNickname, domain_full)
ccList = []
- undoBookmark(self.server.recentPostsCache,
+ undoBookmark(self.server.recent_posts_cache,
self.server.session,
base_dir,
self.server.federation_list,
@@ -9071,7 +9071,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -9173,7 +9173,7 @@ class PubServer(BaseHTTPRequestHandler):
deleteStr = \
htmlConfirmDelete(self.server.cssCache,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate, pageNumber,
self.server.session, base_dir,
@@ -9246,7 +9246,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actor)
mutePost(base_dir, nickname, domain, port,
http_prefix, muteUrl,
- self.server.recentPostsCache, debug)
+ self.server.recent_posts_cache, debug)
muteFilename = \
locatePost(base_dir, nickname, domain, muteUrl)
if muteFilename:
@@ -9273,7 +9273,7 @@ class PubServer(BaseHTTPRequestHandler):
avatarUrl = None
individualPostAsHtml(self.server.signing_priv_key_pem,
allowDownloads,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -9355,7 +9355,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actor)
unmutePost(base_dir, nickname, domain, port,
http_prefix, muteUrl,
- self.server.recentPostsCache, debug)
+ self.server.recent_posts_cache, debug)
muteFilename = \
locatePost(base_dir, nickname, domain, muteUrl)
if muteFilename:
@@ -9383,7 +9383,7 @@ class PubServer(BaseHTTPRequestHandler):
avatarUrl = None
individualPostAsHtml(self.server.signing_priv_key_pem,
allowDownloads,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, base_dir,
@@ -9492,7 +9492,7 @@ class PubServer(BaseHTTPRequestHandler):
if not self._establishSession("showRepliesToPost"):
self._404()
return True
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
max_recent_posts = self.server.max_recent_posts
translate = self.server.translate
session = self.server.session
@@ -9505,7 +9505,7 @@ class PubServer(BaseHTTPRequestHandler):
peertube_instances = self.server.peertube_instances
msg = \
htmlPostReplies(self.server.cssCache,
- recentPostsCache,
+ recent_posts_cache,
max_recent_posts,
translate,
base_dir,
@@ -9584,7 +9584,7 @@ class PubServer(BaseHTTPRequestHandler):
if not self._establishSession("showRepliesToPost2"):
self._404()
return True
- recentPostsCache = self.server.recentPostsCache
+ recent_posts_cache = self.server.recent_posts_cache
max_recent_posts = self.server.max_recent_posts
translate = self.server.translate
session = self.server.session
@@ -9597,7 +9597,7 @@ class PubServer(BaseHTTPRequestHandler):
peertube_instances = self.server.peertube_instances
msg = \
htmlPostReplies(self.server.cssCache,
- recentPostsCache,
+ recent_posts_cache,
max_recent_posts,
translate,
base_dir,
@@ -9679,8 +9679,8 @@ class PubServer(BaseHTTPRequestHandler):
if getPerson:
defaultTimeline = \
self.server.defaultTimeline
- recentPostsCache = \
- self.server.recentPostsCache
+ recent_posts_cache = \
+ self.server.recent_posts_cache
cached_webfingers = \
self.server.cached_webfingers
yt_replace_domain = \
@@ -9704,7 +9704,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
icons_as_buttons,
defaultTimeline,
- recentPostsCache,
+ recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -9784,8 +9784,8 @@ class PubServer(BaseHTTPRequestHandler):
if getPerson:
defaultTimeline = \
self.server.defaultTimeline
- recentPostsCache = \
- self.server.recentPostsCache
+ recent_posts_cache = \
+ self.server.recent_posts_cache
cached_webfingers = \
self.server.cached_webfingers
yt_replace_domain = \
@@ -9820,7 +9820,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
icons_as_buttons,
defaultTimeline,
- recentPostsCache,
+ recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -9988,7 +9988,7 @@ class PubServer(BaseHTTPRequestHandler):
if self._requestHTTP():
msg = \
htmlIndividualPost(self.server.cssCache,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
base_dir,
@@ -10162,7 +10162,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime,
proxy_type: str, cookie: str,
debug: str,
- recentPostsCache: {}, session,
+ recent_posts_cache: {}, session,
defaultTimeline: str,
max_recent_posts: int,
translate: {},
@@ -10177,7 +10177,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxFeed = \
- personBoxJson(recentPostsCache,
+ personBoxJson(recent_posts_cache,
session,
base_dir,
domain,
@@ -10209,7 +10209,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxFeed = \
- personBoxJson(recentPostsCache,
+ personBoxJson(recent_posts_cache,
session,
base_dir,
domain,
@@ -10239,7 +10239,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.shared_items_federated_domains
msg = htmlInbox(self.server.cssCache,
defaultTimeline,
- recentPostsCache,
+ recent_posts_cache,
max_recent_posts,
translate,
pageNumber, maxPostsInFeed,
@@ -10336,7 +10336,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxDMFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10362,7 +10362,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxDMFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10392,7 +10392,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxDMs(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -10481,7 +10481,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxRepliesFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10508,7 +10508,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxRepliesFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10537,7 +10537,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxReplies(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -10626,7 +10626,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxMediaFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10653,7 +10653,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxMediaFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10678,7 +10678,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxMedia(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInMediaFeed,
@@ -10768,7 +10768,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxBlogsFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10795,7 +10795,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxBlogsFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10820,7 +10820,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxBlogs(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInBlogsFeed,
@@ -10911,7 +10911,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxNewsFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10939,7 +10939,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxNewsFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -10971,7 +10971,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxNews(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInNewsFeed,
@@ -11062,7 +11062,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxFeaturesFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11090,7 +11090,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxFeaturesFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11123,7 +11123,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlInboxFeatures(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInBlogsFeed,
@@ -11234,7 +11234,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlShares(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -11319,7 +11319,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlWanted(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -11384,7 +11384,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
bookmarksFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11411,7 +11411,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
bookmarksFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11441,7 +11441,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlBookmarks(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -11529,7 +11529,7 @@ class PubServer(BaseHTTPRequestHandler):
"""
# get outbox feed for a person
outboxFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir, domain, port, path,
http_prefix, maxPostsInFeed, 'outbox',
@@ -11555,7 +11555,7 @@ class PubServer(BaseHTTPRequestHandler):
# if a page wasn't specified then show the first one
pageStr = '?page=' + str(pageNumber)
outboxFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir, domain, port,
path + pageStr,
@@ -11581,7 +11581,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlOutbox(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -11657,7 +11657,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
moderationFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11683,7 +11683,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
moderationFeed = \
- personBoxJson(self.server.recentPostsCache,
+ personBoxJson(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@@ -11714,7 +11714,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlModeration(self.server.cssCache,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
pageNumber, maxPostsInFeed,
@@ -11845,7 +11845,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
self.server.icons_as_buttons,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -11966,7 +11966,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
self.server.icons_as_buttons,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -12085,7 +12085,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
self.server.icons_as_buttons,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -12221,7 +12221,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache,
self.server.icons_as_buttons,
self.server.defaultTimeline,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
@@ -12992,7 +12992,7 @@ class PubServer(BaseHTTPRequestHandler):
noDropDown, accessKeys,
customSubmitText,
conversationId,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.session,
self.server.cached_webfingers,
@@ -15287,7 +15287,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime,
repeatPrivate,
self.server.debug,
- self.server.recentPostsCache)
+ self.server.recent_posts_cache)
self.server.GETbusy = False
return
@@ -15921,7 +15921,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime,
self.server.proxy_type,
cookie, self.server.debug,
- self.server.recentPostsCache,
+ self.server.recent_posts_cache,
self.server.session,
self.server.defaultTimeline,
self.server.max_recent_posts,
@@ -16768,7 +16768,7 @@ class PubServer(BaseHTTPRequestHandler):
'unable to delete ' + cachedFilename)
# remove from memory cache
removePostFromCache(post_json_object,
- self.server.recentPostsCache)
+ self.server.recent_posts_cache)
# change the blog post title
post_json_object['object']['summary'] = \
fields['subject']
@@ -18910,7 +18910,7 @@ def runDaemon(content_license_url: str,
else:
httpd.thrSharesExpire.start()
- httpd.recentPostsCache = {}
+ httpd.recent_posts_cache = {}
httpd.max_recent_posts = max_recent_posts
httpd.iconsCache = {}
httpd.fontsCache = {}
@@ -18933,7 +18933,7 @@ def runDaemon(content_license_url: str,
print('Creating inbox queue')
httpd.thrInboxQueue = \
threadWithTrace(target=runInboxQueue,
- args=(httpd.recentPostsCache,
+ args=(httpd.recent_posts_cache,
httpd.max_recent_posts,
project_version,
base_dir, http_prefix, httpd.send_threads,
diff --git a/delete.py b/delete.py
index c0e8ba065..39f73c8db 100644
--- a/delete.py
+++ b/delete.py
@@ -116,7 +116,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
nickname: str, domain: str,
message_json: {}, debug: bool,
allow_deletion: bool,
- recentPostsCache: {}) -> None:
+ recent_posts_cache: {}) -> None:
""" When a delete request is received by the outbox from c2s
"""
if not message_json.get('type'):
@@ -169,7 +169,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
print(messageId)
return True
deletePost(base_dir, http_prefix, deleteNickname, deleteDomain,
- postFilename, debug, recentPostsCache)
+ postFilename, debug, recent_posts_cache)
if debug:
print('DEBUG: post deleted via c2s - ' + postFilename)
diff --git a/desktop_client.py b/desktop_client.py
index fa046662a..6b7c8a21d 100644
--- a/desktop_client.py
+++ b/desktop_client.py
@@ -696,7 +696,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
if post_json_object['type'] == 'Announce':
actor = post_json_object['actor']
nameStr = getNicknameFromActor(actor)
- recentPostsCache = {}
+ recent_posts_cache = {}
allow_local_network_access = False
yt_replace_domain = None
twitter_replacement_domain = None
@@ -709,7 +709,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, False,
+ recent_posts_cache, False,
system_language,
domain_full, person_cache,
signing_priv_key_pem,
@@ -2402,7 +2402,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
_desktopGetBoxPostObject(boxJson, currIndex)
if post_json_object:
if post_json_object['type'] == 'Announce':
- recentPostsCache = {}
+ recent_posts_cache = {}
allow_local_network_access = False
yt_replace_domain = None
twitter_replacement_domain = None
@@ -2415,7 +2415,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, False,
+ recent_posts_cache, False,
system_language,
domain_full, person_cache,
signing_priv_key_pem,
diff --git a/inbox.py b/inbox.py
index eee088483..3a9d3f0c7 100644
--- a/inbox.py
+++ b/inbox.py
@@ -278,7 +278,7 @@ def storeHashTags(base_dir: str, nickname: str, domain: str,
http_prefix, domain_full, translate)
-def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
+def _inboxStorePostToHtmlCache(recent_posts_cache: {}, max_recent_posts: int,
translate: {},
base_dir: str, http_prefix: str,
session, cached_webfingers: {},
@@ -306,7 +306,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain = get_config_param(base_dir, 'youtubedomain')
twitter_replacement_domain = get_config_param(base_dir, 'twitterdomain')
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache, max_recent_posts,
+ True, recent_posts_cache, max_recent_posts,
translate, pageNumber,
base_dir, session, cached_webfingers,
person_cache,
@@ -899,7 +899,7 @@ def _personReceiveUpdate(base_dir: str,
return True
-def _receiveUpdateToQuestion(recentPostsCache: {}, message_json: {},
+def _receiveUpdateToQuestion(recent_posts_cache: {}, message_json: {},
base_dir: str,
nickname: str, domain: str) -> None:
"""Updating a question as new votes arrive
@@ -938,10 +938,10 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, message_json: {},
print('EX: _receiveUpdateToQuestion unable to delete ' +
cachedPostFilename)
# remove from memory cache
- removePostFromCache(message_json, recentPostsCache)
+ removePostFromCache(message_json, recent_posts_cache)
-def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
+def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, message_json: {}, federation_list: [],
@@ -961,7 +961,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
return False
if message_json['object']['type'] == 'Question':
- _receiveUpdateToQuestion(recentPostsCache, message_json,
+ _receiveUpdateToQuestion(recent_posts_cache, message_json,
base_dir, nickname, domain)
if debug:
print('DEBUG: Question update was received')
@@ -993,7 +993,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
return False
-def _receiveLike(recentPostsCache: {},
+def _receiveLike(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
onion_domain: str,
@@ -1056,7 +1056,7 @@ def _receiveLike(recentPostsCache: {},
likeActor):
_likeNotify(base_dir, domain, onion_domain, handle,
likeActor, postLikedId)
- updateLikesCollection(recentPostsCache, base_dir, postFilename,
+ updateLikesCollection(recent_posts_cache, base_dir, postFilename,
postLikedId, likeActor,
handleName, domain, debug, None)
# regenerate the html
@@ -1073,7 +1073,7 @@ def _receiveLike(recentPostsCache: {},
if announceLikedFilename:
postLikedId = announceLikeUrl
postFilename = announceLikedFilename
- updateLikesCollection(recentPostsCache,
+ updateLikesCollection(recent_posts_cache,
base_dir,
postFilename,
postLikedId,
@@ -1095,7 +1095,7 @@ def _receiveLike(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
handleName, domain, port, likedPostJson,
@@ -1116,7 +1116,7 @@ def _receiveLike(recentPostsCache: {},
return True
-def _receiveUndoLike(recentPostsCache: {},
+def _receiveUndoLike(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
@@ -1171,7 +1171,7 @@ def _receiveUndoLike(recentPostsCache: {},
print('DEBUG: liked post found in inbox. Now undoing.')
likeActor = message_json['actor']
postLikedId = message_json['object']
- undoLikesCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoLikesCollectionEntry(recent_posts_cache, base_dir, postFilename,
postLikedId, likeActor, domain, debug, None)
# regenerate the html
likedPostJson = load_json(postFilename, 0, 1)
@@ -1187,7 +1187,7 @@ def _receiveUndoLike(recentPostsCache: {},
if announceLikedFilename:
postLikedId = announceLikeUrl
postFilename = announceLikedFilename
- undoLikesCollectionEntry(recentPostsCache, base_dir,
+ undoLikesCollectionEntry(recent_posts_cache, base_dir,
postFilename, postLikedId,
likeActor, domain, debug,
None)
@@ -1206,7 +1206,7 @@ def _receiveUndoLike(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
handleName, domain, port, likedPostJson,
@@ -1227,7 +1227,7 @@ def _receiveUndoLike(recentPostsCache: {},
return True
-def _receiveReaction(recentPostsCache: {},
+def _receiveReaction(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
onion_domain: str,
@@ -1314,7 +1314,7 @@ def _receiveReaction(recentPostsCache: {},
emojiContent):
_reactionNotify(base_dir, domain, onion_domain, handle,
reactionActor, postReactionId, emojiContent)
- updateReactionCollection(recentPostsCache, base_dir, postFilename,
+ updateReactionCollection(recent_posts_cache, base_dir, postFilename,
postReactionId, reactionActor,
handleName, domain, debug, None, emojiContent)
# regenerate the html
@@ -1331,7 +1331,7 @@ def _receiveReaction(recentPostsCache: {},
if announceReactionFilename:
postReactionId = announceReactionUrl
postFilename = announceReactionFilename
- updateReactionCollection(recentPostsCache,
+ updateReactionCollection(recent_posts_cache,
base_dir,
postFilename,
postReactionId,
@@ -1354,7 +1354,7 @@ def _receiveReaction(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
handleName, domain, port, reactionPostJson,
@@ -1375,7 +1375,7 @@ def _receiveReaction(recentPostsCache: {},
return True
-def _receiveUndoReaction(recentPostsCache: {},
+def _receiveUndoReaction(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [],
@@ -1445,7 +1445,7 @@ def _receiveUndoReaction(recentPostsCache: {},
if debug:
print('DEBUG: unreaction has no content')
return True
- undoReactionCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoReactionCollectionEntry(recent_posts_cache, base_dir, postFilename,
postReactionId, reactionActor, domain,
debug, None, emojiContent)
# regenerate the html
@@ -1462,7 +1462,7 @@ def _receiveUndoReaction(recentPostsCache: {},
if announceReactionFilename:
postReactionId = announceReactionUrl
postFilename = announceReactionFilename
- undoReactionCollectionEntry(recentPostsCache, base_dir,
+ undoReactionCollectionEntry(recent_posts_cache, base_dir,
postFilename,
postReactionId,
reactionActor, domain,
@@ -1483,7 +1483,7 @@ def _receiveUndoReaction(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
handleName, domain, port, reactionPostJson,
@@ -1504,7 +1504,7 @@ def _receiveUndoReaction(recentPostsCache: {},
return True
-def _receiveBookmark(recentPostsCache: {},
+def _receiveBookmark(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
@@ -1573,7 +1573,7 @@ def _receiveBookmark(recentPostsCache: {},
print(messageUrl)
return True
- updateBookmarksCollection(recentPostsCache, base_dir, postFilename,
+ updateBookmarksCollection(recent_posts_cache, base_dir, postFilename,
message_json['object']['url'],
message_json['actor'], domain, debug)
# regenerate the html
@@ -1593,7 +1593,7 @@ def _receiveBookmark(recentPostsCache: {},
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
nickname, domain, port, bookmarkedPostJson,
@@ -1614,7 +1614,7 @@ def _receiveBookmark(recentPostsCache: {},
return True
-def _receiveUndoBookmark(recentPostsCache: {},
+def _receiveUndoBookmark(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [],
@@ -1686,7 +1686,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
print(messageUrl)
return True
- undoBookmarksCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoBookmarksCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['object']['url'],
message_json['actor'], domain, debug)
# regenerate the html
@@ -1706,7 +1706,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
nickname, domain, port, bookmarkedPostJson,
@@ -1731,7 +1731,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, message_json: {}, federation_list: [],
debug: bool, allow_deletion: bool,
- recentPostsCache: {}) -> bool:
+ recent_posts_cache: {}) -> bool:
"""Receives a Delete activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Delete':
@@ -1784,7 +1784,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
return True
deletePost(base_dir, http_prefix, handleNickname,
handleDomain, postFilename, debug,
- recentPostsCache)
+ recent_posts_cache)
if debug:
print('DEBUG: post deleted - ' + postFilename)
@@ -1795,13 +1795,13 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
if postFilename:
deletePost(base_dir, http_prefix, 'news',
handleDomain, postFilename, debug,
- recentPostsCache)
+ recent_posts_cache)
if debug:
print('DEBUG: blog post deleted - ' + postFilename)
return True
-def _receiveAnnounce(recentPostsCache: {},
+def _receiveAnnounce(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str,
domain: str, onion_domain: str, port: int,
@@ -1895,7 +1895,7 @@ def _receiveAnnounce(recentPostsCache: {},
print('DEBUG: announce post not found in inbox or outbox')
print(message_json['object'])
return True
- updateAnnounceCollection(recentPostsCache, base_dir, postFilename,
+ updateAnnounceCollection(recent_posts_cache, base_dir, postFilename,
message_json['actor'], nickname, domain, debug)
if debug:
print('DEBUG: Downloading announce post ' + message_json['actor'] +
@@ -1913,7 +1913,7 @@ def _receiveAnnounce(recentPostsCache: {},
print('Generating html for announce ' + message_json['id'])
announceHtml = \
individualPostAsHtml(signing_priv_key_pem, True,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
nickname, domain, port, message_json,
@@ -1946,7 +1946,7 @@ def _receiveAnnounce(recentPostsCache: {},
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, debug,
+ recent_posts_cache, debug,
system_language,
domain_full, person_cache,
signing_priv_key_pem,
@@ -2029,7 +2029,7 @@ def _receiveAnnounce(recentPostsCache: {},
return True
-def _receiveUndoAnnounce(recentPostsCache: {},
+def _receiveUndoAnnounce(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [],
@@ -2077,7 +2077,7 @@ def _receiveUndoAnnounce(recentPostsCache: {},
print("DEBUG: Attempt to undo something " +
"which isn't an announcement")
return False
- undoAnnounceCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoAnnounceCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['actor'], domain, debug)
if os.path.isfile(postFilename):
try:
@@ -2983,7 +2983,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
http_prefix: str, handle: str, debug: bool,
- post_json_object: {}, recentPostsCache: {},
+ post_json_object: {}, recent_posts_cache: {},
session, onion_domain: str,
i2p_domain: str, port: int,
federation_list: [], send_threads: [], postLog: [],
@@ -3008,7 +3008,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
if not questionPostFilename:
return
- removePostFromCache(questionJson, recentPostsCache)
+ removePostFromCache(questionJson, recent_posts_cache)
# ensure that the cached post is removed if it exists, so
# that it then will be recreated
cachedPostFilename = \
@@ -3028,7 +3028,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(questionJson)
individualPostAsHtml(signing_priv_key_pem, False,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
nickname, domain, port, questionJson,
@@ -3186,7 +3186,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
return 0
-def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
+def _inboxAfterInitial(recent_posts_cache: {}, max_recent_posts: int,
session, keyId: str, handle: str, message_json: {},
base_dir: str, http_prefix: str, send_threads: [],
postLog: [], cached_webfingers: {}, person_cache: {},
@@ -3221,7 +3221,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
postIsDM = False
isGroup = _groupHandle(base_dir, handle)
- if _receiveLike(recentPostsCache,
+ if _receiveLike(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3244,7 +3244,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Like accepted from ' + actor)
return False
- if _receiveUndoLike(recentPostsCache,
+ if _receiveUndoLike(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3266,7 +3266,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Undo like accepted from ' + actor)
return False
- if _receiveReaction(recentPostsCache,
+ if _receiveReaction(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3289,7 +3289,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Reaction accepted from ' + actor)
return False
- if _receiveUndoReaction(recentPostsCache,
+ if _receiveUndoReaction(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3311,7 +3311,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Undo reaction accepted from ' + actor)
return False
- if _receiveBookmark(recentPostsCache,
+ if _receiveBookmark(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3333,7 +3333,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Bookmark accepted from ' + actor)
return False
- if _receiveUndoBookmark(recentPostsCache,
+ if _receiveUndoBookmark(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3358,7 +3358,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if isCreateInsideAnnounce(message_json):
message_json = message_json['object']
- if _receiveAnnounce(recentPostsCache,
+ if _receiveAnnounce(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, onion_domain, port,
@@ -3380,7 +3380,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if debug:
print('DEBUG: Announce accepted from ' + actor)
- if _receiveUndoAnnounce(recentPostsCache,
+ if _receiveUndoAnnounce(recent_posts_cache,
session, handle, isGroup,
base_dir, http_prefix,
domain, port,
@@ -3403,7 +3403,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
message_json,
federation_list,
debug, allow_deletion,
- recentPostsCache):
+ recent_posts_cache):
if debug:
print('DEBUG: Delete accepted from ' + actor)
return False
@@ -3460,7 +3460,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
_receiveQuestionVote(base_dir, nickname, domain,
http_prefix, handle, debug,
- post_json_object, recentPostsCache,
+ post_json_object, recent_posts_cache,
session, onion_domain, i2p_domain, port,
federation_list, send_threads, postLog,
cached_webfingers, person_cache,
@@ -3512,7 +3512,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, debug, system_language,
+ recent_posts_cache, debug, system_language,
domain_full, person_cache, signing_priv_key_pem):
# media index will be updated
updateIndexList.append('tlmedia')
@@ -3562,7 +3562,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
htmlCacheStartTime = time.time()
handleName = handle.split('@')[0]
- _inboxStorePostToHtmlCache(recentPostsCache,
+ _inboxStorePostToHtmlCache(recent_posts_cache,
max_recent_posts,
translate, base_dir,
http_prefix,
@@ -3603,7 +3603,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if editedFilename:
deletePost(base_dir, http_prefix,
nickname, domain, editedFilename,
- debug, recentPostsCache)
+ debug, recent_posts_cache)
# store the id of the last post made by this actor
_storeLastPostId(base_dir, nickname, domain, post_json_object)
@@ -4070,7 +4070,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
signing_priv_key_pem)
-def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
+def runInboxQueue(recent_posts_cache: {}, max_recent_posts: int,
project_version: str,
base_dir: str, http_prefix: str,
send_threads: [], postLog: [],
@@ -4417,7 +4417,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
queue.pop(0)
continue
- if _receiveUpdate(recentPostsCache, session,
+ if _receiveUpdate(recent_posts_cache, session,
base_dir, http_prefix,
domain, port,
send_threads, postLog,
@@ -4497,7 +4497,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
for handle, capsId in recipientsDict.items():
destination = \
queueJson['destination'].replace(inboxHandle, handle)
- _inboxAfterInitial(recentPostsCache,
+ _inboxAfterInitial(recent_posts_cache,
max_recent_posts,
session, keyId, handle,
queueJson['post'],
diff --git a/like.py b/like.py
index 6188442e0..b09b49e99 100644
--- a/like.py
+++ b/like.py
@@ -68,7 +68,7 @@ def likedByPerson(post_json_object: {}, nickname: str, domain: str) -> bool:
return False
-def _like(recentPostsCache: {},
+def _like(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
@@ -127,7 +127,7 @@ def _like(recentPostsCache: {},
print('DEBUG: like objectUrl: ' + objectUrl)
return None
- updateLikesCollection(recentPostsCache,
+ updateLikesCollection(recent_posts_cache,
base_dir, postFilename, objectUrl,
newLikeJson['actor'],
nickname, domain, debug, None)
@@ -144,7 +144,7 @@ def _like(recentPostsCache: {},
return newLikeJson
-def likePost(recentPostsCache: {},
+def likePost(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str,
likeNickname: str, likeDomain: str, likePort: int,
@@ -161,7 +161,7 @@ def likePost(recentPostsCache: {},
actorLiked = local_actor_url(http_prefix, likeNickname, likeDomain)
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
- return _like(recentPostsCache,
+ return _like(recent_posts_cache,
session, base_dir, federation_list, nickname, domain, port,
ccList, http_prefix, objectUrl, actorLiked, client_to_server,
send_threads, postLog, person_cache, cached_webfingers,
@@ -339,7 +339,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
return newUndoLikeJson
-def outboxLike(recentPostsCache: {},
+def outboxLike(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -366,7 +366,7 @@ def outboxLike(recentPostsCache: {},
print('DEBUG: c2s like post not found in inbox or outbox')
print(messageId)
return True
- updateLikesCollection(recentPostsCache,
+ updateLikesCollection(recent_posts_cache,
base_dir, postFilename, messageId,
message_json['actor'],
nickname, domain, debug, None)
@@ -374,7 +374,7 @@ def outboxLike(recentPostsCache: {},
print('DEBUG: post liked via c2s - ' + postFilename)
-def outboxUndoLike(recentPostsCache: {},
+def outboxUndoLike(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -403,14 +403,14 @@ def outboxUndoLike(recentPostsCache: {},
print('DEBUG: c2s undo like post not found in inbox or outbox')
print(messageId)
return True
- undoLikesCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoLikesCollectionEntry(recent_posts_cache, base_dir, postFilename,
messageId, message_json['actor'],
domain, debug, None)
if debug:
print('DEBUG: post undo liked via c2s - ' + postFilename)
-def updateLikesCollection(recentPostsCache: {},
+def updateLikesCollection(recent_posts_cache: {},
base_dir: str, postFilename: str,
objectUrl: str, actor: str,
nickname: str, domain: str, debug: bool,
@@ -424,7 +424,7 @@ def updateLikesCollection(recentPostsCache: {},
# remove any cached version of this post so that the
# like icon is changed
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
cachedPostFilename = getCachedPostFilename(base_dir, nickname,
domain, post_json_object)
if cachedPostFilename:
diff --git a/newsdaemon.py b/newsdaemon.py
index a4bb76601..6bb0c6452 100644
--- a/newsdaemon.py
+++ b/newsdaemon.py
@@ -538,7 +538,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
domain: str, port: int,
newswire: {},
translate: {},
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
session, cached_webfingers: {},
person_cache: {},
federation_list: [],
@@ -730,7 +730,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
http_prefix, domain_full,
blog, translate)
- clearFromPostCaches(base_dir, recentPostsCache, post_id)
+ clearFromPostCaches(base_dir, recent_posts_cache, post_id)
if save_json(blog, filename):
_updateFeedsOutboxIndex(base_dir, domain, post_id + '.json')
@@ -826,7 +826,7 @@ def runNewswireDaemon(base_dir: str, httpd,
_convertRSStoActivityPub(base_dir,
http_prefix, domain, port,
newNewswire, translate,
- httpd.recentPostsCache,
+ httpd.recent_posts_cache,
httpd.max_recent_posts,
httpd.session,
httpd.cached_webfingers,
@@ -849,7 +849,7 @@ def runNewswireDaemon(base_dir: str, httpd,
archivePostsForPerson(http_prefix, 'news',
domain, base_dir, 'outbox',
archiveSubdir,
- httpd.recentPostsCache,
+ httpd.recent_posts_cache,
httpd.max_news_posts)
# wait a while before the next feeds update
diff --git a/outbox.py b/outbox.py
index ed084f970..7d9ce4c73 100644
--- a/outbox.py
+++ b/outbox.py
@@ -58,7 +58,7 @@ from shares import outboxUndoShareUpload
from webapp_post import individualPostAsHtml
-def _outboxPersonReceiveUpdate(recentPostsCache: {},
+def _outboxPersonReceiveUpdate(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -182,7 +182,7 @@ def postMessageToOutbox(session, translate: {},
server, base_dir: str, http_prefix: str,
domain: str, domain_full: str,
onion_domain: str, i2p_domain: str, port: int,
- recentPostsCache: {}, followers_threads: [],
+ recent_posts_cache: {}, followers_threads: [],
federation_list: [], send_threads: [],
postLog: [], cached_webfingers: {},
person_cache: {}, allow_deletion: bool,
@@ -427,7 +427,7 @@ def postMessageToOutbox(session, translate: {},
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, debug, system_language,
+ recent_posts_cache, debug, system_language,
domain_full, person_cache,
signing_priv_key_pem):
inboxUpdateIndex('tlmedia', base_dir,
@@ -454,7 +454,7 @@ def postMessageToOutbox(session, translate: {},
followerApprovalActive(base_dir,
postToNickname, domain)
individualPostAsHtml(signing_priv_key_pem,
- False, recentPostsCache,
+ False, recent_posts_cache,
max_recent_posts,
translate, pageNumber,
base_dir, session,
@@ -478,7 +478,7 @@ def postMessageToOutbox(session, translate: {},
False, True, useCacheOnly,
cw_lists, lists_enabled)
- if outboxAnnounce(recentPostsCache,
+ if outboxAnnounce(recent_posts_cache,
base_dir, message_json, debug):
if debug:
print('DEBUG: Updated announcements (shares) collection ' +
@@ -541,46 +541,46 @@ def postMessageToOutbox(session, translate: {},
if debug:
print('DEBUG: handle any like requests')
- outboxLike(recentPostsCache,
+ outboxLike(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any undo like requests')
- outboxUndoLike(recentPostsCache,
+ outboxUndoLike(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any emoji reaction requests')
- outboxReaction(recentPostsCache,
+ outboxReaction(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any undo emoji reaction requests')
- outboxUndoReaction(recentPostsCache,
+ outboxUndoReaction(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any undo announce requests')
- outboxUndoAnnounce(recentPostsCache,
+ outboxUndoAnnounce(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any bookmark requests')
- outboxBookmark(recentPostsCache,
+ outboxBookmark(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
if debug:
print('DEBUG: handle any undo bookmark requests')
- outboxUndoBookmark(recentPostsCache,
+ outboxUndoBookmark(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
@@ -591,7 +591,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain,
message_json, debug,
allow_deletion,
- recentPostsCache)
+ recent_posts_cache)
if debug:
print('DEBUG: handle block requests')
@@ -612,7 +612,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain,
port,
message_json, debug,
- recentPostsCache)
+ recent_posts_cache)
if debug:
print('DEBUG: handle undo mute requests')
@@ -620,7 +620,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain,
port,
message_json, debug,
- recentPostsCache)
+ recent_posts_cache)
if debug:
print('DEBUG: handle share uploads')
@@ -637,7 +637,7 @@ def postMessageToOutbox(session, translate: {},
if debug:
print('DEBUG: handle actor updates from c2s')
- _outboxPersonReceiveUpdate(recentPostsCache,
+ _outboxPersonReceiveUpdate(recent_posts_cache,
base_dir, http_prefix,
postToNickname, domain, port,
message_json, debug)
diff --git a/person.py b/person.py
index e4ea3a9de..479f51c56 100644
--- a/person.py
+++ b/person.py
@@ -898,7 +898,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
return personJson
-def personBoxJson(recentPostsCache: {},
+def personBoxJson(recent_posts_cache: {},
session, base_dir: str, domain: str, port: int, path: str,
http_prefix: str, noOfItems: int, boxname: str,
authorized: bool,
@@ -949,12 +949,12 @@ def personBoxJson(recentPostsCache: {},
if not validNickname(domain, nickname):
return None
if boxname == 'inbox':
- return createInbox(recentPostsCache,
+ return createInbox(recent_posts_cache,
session, base_dir, nickname, domain, port,
http_prefix,
noOfItems, headerOnly, pageNumber)
elif boxname == 'dm':
- return createDMTimeline(recentPostsCache,
+ return createDMTimeline(recent_posts_cache,
session, base_dir, nickname, domain, port,
http_prefix,
noOfItems, headerOnly, pageNumber)
@@ -964,7 +964,7 @@ def personBoxJson(recentPostsCache: {},
noOfItems, headerOnly,
pageNumber)
elif boxname == 'tlreplies':
- return createRepliesTimeline(recentPostsCache,
+ return createRepliesTimeline(recent_posts_cache,
session, base_dir, nickname, domain,
port, http_prefix,
noOfItems, headerOnly,
diff --git a/posts.py b/posts.py
index f56700cb0..393ff9519 100644
--- a/posts.py
+++ b/posts.py
@@ -3301,11 +3301,11 @@ def sendToFollowersThread(session, base_dir: str,
return sendThread
-def createInbox(recentPostsCache: {},
+def createInbox(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str, port: int,
http_prefix: str, itemsPerPage: int, headerOnly: bool,
pageNumber: int) -> {}:
- return _createBoxIndexed(recentPostsCache,
+ return _createBoxIndexed(recent_posts_cache,
session, base_dir, 'inbox',
nickname, domain, port, http_prefix,
itemsPerPage, headerOnly, True,
@@ -3321,21 +3321,21 @@ def createBookmarksTimeline(session, base_dir: str, nickname: str, domain: str,
True, 0, False, 0, pageNumber)
-def createDMTimeline(recentPostsCache: {},
+def createDMTimeline(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str,
port: int, http_prefix: str, itemsPerPage: int,
headerOnly: bool, pageNumber: int) -> {}:
- return _createBoxIndexed(recentPostsCache,
+ return _createBoxIndexed(recent_posts_cache,
session, base_dir, 'dm', nickname,
domain, port, http_prefix, itemsPerPage,
headerOnly, True, 0, False, 0, pageNumber)
-def createRepliesTimeline(recentPostsCache: {},
+def createRepliesTimeline(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str,
port: int, http_prefix: str, itemsPerPage: int,
headerOnly: bool, pageNumber: int) -> {}:
- return _createBoxIndexed(recentPostsCache, session, base_dir, 'tlreplies',
+ return _createBoxIndexed(recent_posts_cache, session, base_dir, 'tlreplies',
nickname, domain, port, http_prefix,
itemsPerPage, headerOnly, True,
0, False, 0, pageNumber)
@@ -3462,7 +3462,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
allow_local_network_access: bool,
- recentPostsCache: {}, debug: bool,
+ recent_posts_cache: {}, debug: bool,
system_language: str,
domain_full: str, person_cache: {},
signing_priv_key_pem: str) -> bool:
@@ -3477,7 +3477,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, debug,
+ recent_posts_cache, debug,
system_language,
domain_full, person_cache,
signing_priv_key_pem,
@@ -3655,7 +3655,7 @@ def _passedNewswireVoting(newswire_votes_threshold: int,
return True
-def _createBoxIndexed(recentPostsCache: {},
+def _createBoxIndexed(recent_posts_cache: {},
session, base_dir: str, boxname: str,
nickname: str, domain: str, port: int, http_prefix: str,
itemsPerPage: int, headerOnly: bool, authorized: bool,
@@ -3765,10 +3765,10 @@ def _createBoxIndexed(recentPostsCache: {},
continue
# is the post cached in memory?
- if recentPostsCache.get('index'):
- if postUrl in recentPostsCache['index']:
- if recentPostsCache['json'].get(postUrl):
- url = recentPostsCache['json'][postUrl]
+ if recent_posts_cache.get('index'):
+ if postUrl in recent_posts_cache['index']:
+ if recent_posts_cache['json'].get(postUrl):
+ url = recent_posts_cache['json'][postUrl]
if _addPostStringToTimeline(url,
boxname, postsInBox,
boxActor):
@@ -3879,7 +3879,7 @@ def _createBoxIndexed(recentPostsCache: {},
def expireCache(base_dir: str, person_cache: {},
http_prefix: str, archive_dir: str,
- recentPostsCache: {},
+ recent_posts_cache: {},
maxPostsInBox=32000):
"""Thread used to expire actors from the cache and archive old posts
"""
@@ -3887,12 +3887,12 @@ def expireCache(base_dir: str, person_cache: {},
# once per day
time.sleep(60 * 60 * 24)
expirePersonCache(person_cache)
- archivePosts(base_dir, http_prefix, archive_dir, recentPostsCache,
+ archivePosts(base_dir, http_prefix, archive_dir, recent_posts_cache,
maxPostsInBox)
def archivePosts(base_dir: str, http_prefix: str, archive_dir: str,
- recentPostsCache: {},
+ recent_posts_cache: {},
maxPostsInBox=32000) -> None:
"""Archives posts for all accounts
"""
@@ -3928,20 +3928,20 @@ def archivePosts(base_dir: str, http_prefix: str, archive_dir: str,
handle + '/inbox'
archivePostsForPerson(http_prefix, nickname, domain, base_dir,
'inbox', archiveSubdir,
- recentPostsCache, maxPostsInBox)
+ recent_posts_cache, maxPostsInBox)
if archive_dir:
archiveSubdir = archive_dir + '/accounts/' + \
handle + '/outbox'
archivePostsForPerson(http_prefix, nickname, domain, base_dir,
'outbox', archiveSubdir,
- recentPostsCache, maxPostsInBox)
+ recent_posts_cache, maxPostsInBox)
break
def archivePostsForPerson(http_prefix: str, nickname: str, domain: str,
base_dir: str,
boxname: str, archive_dir: str,
- recentPostsCache: {},
+ recent_posts_cache: {},
maxPostsInBox=32000) -> None:
"""Retain a maximum number of posts within the given box
Move any others to an archive directory
@@ -4034,7 +4034,7 @@ def archivePostsForPerson(http_prefix: str, nickname: str, domain: str,
archivePath.replace('.json', '.json.' + ext))
else:
deletePost(base_dir, http_prefix, nickname, domain,
- filePath, False, recentPostsCache)
+ filePath, False, recent_posts_cache)
# remove cached html posts
postCacheFilename = \
@@ -4497,10 +4497,10 @@ def populateRepliesJson(base_dir: str, nickname: str, domain: str,
def _rejectAnnounce(announceFilename: str,
base_dir: str, nickname: str, domain: str,
- announcePostId: str, recentPostsCache: {}):
+ announcePostId: str, recent_posts_cache: {}):
"""Marks an announce as rejected
"""
- rejectPostId(base_dir, nickname, domain, announcePostId, recentPostsCache)
+ rejectPostId(base_dir, nickname, domain, announcePostId, recent_posts_cache)
# reject the post referenced by the announce activity object
if not os.path.isfile(announceFilename + '.reject'):
@@ -4515,7 +4515,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
allow_local_network_access: bool,
- recentPostsCache: {}, debug: bool,
+ recent_posts_cache: {}, debug: bool,
system_language: str,
domain_full: str, person_cache: {},
signing_priv_key_pem: str,
@@ -4612,17 +4612,17 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
post_json_object['object'])
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not announcedJson.get('id'):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not announcedJson.get('type'):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if announcedJson['type'] == 'Video':
convertedJson = \
@@ -4634,12 +4634,12 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
if '/statuses/' not in announcedJson['id']:
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not has_users_path(announcedJson['id']):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if announcedJson['type'] != 'Note' and \
announcedJson['type'] != 'Page' and \
@@ -4647,22 +4647,22 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
# You can only announce Note or Article types
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not announcedJson.get('content'):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not announcedJson.get('published'):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not valid_post_date(announcedJson['published'], 90, debug):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if not understoodPostLanguage(base_dir, nickname, domain,
announcedJson, system_language,
@@ -4674,19 +4674,19 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
if dangerousMarkup(contentStr, allow_local_network_access):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if isFiltered(base_dir, nickname, domain, contentStr):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
if invalid_ciphertext(contentStr):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
print('WARN: Invalid ciphertext within announce ' +
str(announcedJson))
return None
@@ -4712,7 +4712,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
# Create wrap failed
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
# labelAccusatoryPost(post_json_object, translate)
@@ -4731,7 +4731,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
attributedNickname, attributedDomain):
_rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id,
- recentPostsCache)
+ recent_posts_cache)
return None
post_json_object = announcedJson
replaceYouTube(post_json_object, yt_replace_domain, system_language)
diff --git a/reaction.py b/reaction.py
index 5685264ab..b003853b8 100644
--- a/reaction.py
+++ b/reaction.py
@@ -60,7 +60,7 @@ def validEmojiContent(emojiContent: str) -> bool:
return True
-def _reaction(recentPostsCache: {},
+def _reaction(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
@@ -126,7 +126,7 @@ def _reaction(recentPostsCache: {},
print('DEBUG: reaction objectUrl: ' + objectUrl)
return None
- updateReactionCollection(recentPostsCache,
+ updateReactionCollection(recent_posts_cache,
base_dir, postFilename, objectUrl,
newReactionJson['actor'],
nickname, domain, debug, None,
@@ -145,7 +145,7 @@ def _reaction(recentPostsCache: {},
return newReactionJson
-def reactionPost(recentPostsCache: {},
+def reactionPost(recent_posts_cache: {},
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str,
reactionNickname: str, reactionDomain: str, reactionPort: int,
@@ -164,7 +164,7 @@ def reactionPost(recentPostsCache: {},
local_actor_url(http_prefix, reactionNickname, reactionDomain)
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
- return _reaction(recentPostsCache,
+ return _reaction(recent_posts_cache,
session, base_dir, federation_list,
nickname, domain, port,
ccList, http_prefix, objectUrl, emojiContent,
@@ -354,7 +354,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
return newUndoReactionJson
-def outboxReaction(recentPostsCache: {},
+def outboxReaction(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -390,7 +390,7 @@ def outboxReaction(recentPostsCache: {},
print('DEBUG: c2s reaction post not found in inbox or outbox')
print(messageId)
return True
- updateReactionCollection(recentPostsCache,
+ updateReactionCollection(recent_posts_cache,
base_dir, postFilename, messageId,
message_json['actor'],
nickname, domain, debug, None, emojiContent)
@@ -398,7 +398,7 @@ def outboxReaction(recentPostsCache: {},
print('DEBUG: post reaction via c2s - ' + postFilename)
-def outboxUndoReaction(recentPostsCache: {},
+def outboxUndoReaction(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None:
@@ -432,14 +432,14 @@ def outboxUndoReaction(recentPostsCache: {},
print('DEBUG: c2s undo reaction post not found in inbox or outbox')
print(messageId)
return True
- undoReactionCollectionEntry(recentPostsCache, base_dir, postFilename,
+ undoReactionCollectionEntry(recent_posts_cache, base_dir, postFilename,
messageId, message_json['actor'],
domain, debug, None, emojiContent)
if debug:
print('DEBUG: post undo reaction via c2s - ' + postFilename)
-def updateReactionCollection(recentPostsCache: {},
+def updateReactionCollection(recent_posts_cache: {},
base_dir: str, postFilename: str,
objectUrl: str, actor: str,
nickname: str, domain: str, debug: bool,
@@ -454,7 +454,7 @@ def updateReactionCollection(recentPostsCache: {},
# remove any cached version of this post so that the
# reaction icon is changed
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
cachedPostFilename = getCachedPostFilename(base_dir, nickname,
domain, post_json_object)
if cachedPostFilename:
diff --git a/schedule.py b/schedule.py
index 5a725fc56..51a0c1e5d 100644
--- a/schedule.py
+++ b/schedule.py
@@ -103,7 +103,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.onion_domain,
httpd.i2p_domain,
httpd.port,
- httpd.recentPostsCache,
+ httpd.recent_posts_cache,
httpd.followers_threads,
httpd.federation_list,
httpd.send_threads,
diff --git a/tests.py b/tests.py
index a0933415f..51c6ffcc8 100644
--- a/tests.py
+++ b/tests.py
@@ -3531,18 +3531,18 @@ def _testTheme():
def _testRecentPostsCache():
print('testRecentPostsCache')
- recentPostsCache = {}
+ recent_posts_cache = {}
max_recent_posts = 3
htmlStr = ''
for i in range(5):
post_json_object = {
"id": "https://somesite.whatever/users/someuser/statuses/" + str(i)
}
- updateRecentPostsCache(recentPostsCache, max_recent_posts,
+ updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, htmlStr)
- assert len(recentPostsCache['index']) == max_recent_posts
- assert len(recentPostsCache['json'].items()) == max_recent_posts
- assert len(recentPostsCache['html'].items()) == max_recent_posts
+ assert len(recent_posts_cache['index']) == max_recent_posts
+ assert len(recent_posts_cache['json'].items()) == max_recent_posts
+ assert len(recent_posts_cache['html'].items()) == max_recent_posts
def _testRemoveTextFormatting():
diff --git a/utils.py b/utils.py
index c8e8a4183..ff6656d8e 100644
--- a/utils.py
+++ b/utils.py
@@ -1293,7 +1293,7 @@ def locateNewsArrival(base_dir: str, domain: str,
return None
-def clearFromPostCaches(base_dir: str, recentPostsCache: {},
+def clearFromPostCaches(base_dir: str, recent_posts_cache: {},
post_id: str) -> None:
"""Clears cached html for the given post, so that edits
to news will appear
@@ -1314,15 +1314,15 @@ def clearFromPostCaches(base_dir: str, recentPostsCache: {},
print('EX: clearFromPostCaches file not removed ' +
str(postFilename))
# if the post is in the recent posts cache then remove it
- if recentPostsCache.get('index'):
- if post_id in recentPostsCache['index']:
- recentPostsCache['index'].remove(post_id)
- if recentPostsCache.get('json'):
- if recentPostsCache['json'].get(post_id):
- del recentPostsCache['json'][post_id]
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(post_id):
- del recentPostsCache['html'][post_id]
+ if recent_posts_cache.get('index'):
+ if post_id in recent_posts_cache['index']:
+ recent_posts_cache['index'].remove(post_id)
+ if recent_posts_cache.get('json'):
+ if recent_posts_cache['json'].get(post_id):
+ del recent_posts_cache['json'][post_id]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(post_id):
+ del recent_posts_cache['html'][post_id]
break
@@ -1529,7 +1529,7 @@ def _is_reply_to_blog_post(base_dir: str, nickname: str, domain: str,
def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
http_prefix: str, postFilename: str,
- recentPostsCache: {}, debug: bool) -> None:
+ recent_posts_cache: {}, debug: bool) -> None:
"""Removes replies when deleting a post
"""
repliesFilename = postFilename.replace('.json', '.replies')
@@ -1545,7 +1545,7 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
if os.path.isfile(replyFile):
deletePost(base_dir, http_prefix,
nickname, domain, replyFile, debug,
- recentPostsCache)
+ recent_posts_cache)
# remove the replies file
try:
os.remove(repliesFilename)
@@ -1567,36 +1567,36 @@ def _isBookmarked(base_dir: str, nickname: str, domain: str,
return False
-def removePostFromCache(post_json_object: {}, recentPostsCache: {}) -> None:
+def removePostFromCache(post_json_object: {}, recent_posts_cache: {}) -> None:
""" if the post exists in the recent posts cache then remove it
"""
- if not recentPostsCache:
+ if not recent_posts_cache:
return
if not post_json_object.get('id'):
return
- if not recentPostsCache.get('index'):
+ if not recent_posts_cache.get('index'):
return
post_id = post_json_object['id']
if '#' in post_id:
post_id = post_id.split('#', 1)[0]
post_id = removeIdEnding(post_id).replace('/', '#')
- if post_id not in recentPostsCache['index']:
+ if post_id not in recent_posts_cache['index']:
return
- if recentPostsCache.get('index'):
- if post_id in recentPostsCache['index']:
- recentPostsCache['index'].remove(post_id)
+ if recent_posts_cache.get('index'):
+ if post_id in recent_posts_cache['index']:
+ recent_posts_cache['index'].remove(post_id)
- if recentPostsCache.get('json'):
- if recentPostsCache['json'].get(post_id):
- del recentPostsCache['json'][post_id]
+ if recent_posts_cache.get('json'):
+ if recent_posts_cache['json'].get(post_id):
+ del recent_posts_cache['json'][post_id]
- if recentPostsCache.get('html'):
- if recentPostsCache['html'].get(post_id):
- del recentPostsCache['html'][post_id]
+ if recent_posts_cache.get('html'):
+ if recent_posts_cache['html'].get(post_id):
+ del recent_posts_cache['html'][post_id]
def _deleteCachedHtml(base_dir: str, nickname: str, domain: str,
@@ -1713,7 +1713,7 @@ def _deleteConversationPost(base_dir: str, nickname: str, domain: str,
def deletePost(base_dir: str, http_prefix: str,
nickname: str, domain: str, postFilename: str,
- debug: bool, recentPostsCache: {}) -> None:
+ debug: bool, recent_posts_cache: {}) -> None:
"""Recursively deletes a post and its replies and attachments
"""
post_json_object = load_json(postFilename, 1)
@@ -1721,7 +1721,7 @@ def deletePost(base_dir: str, http_prefix: str,
# remove any replies
_deletePostRemoveReplies(base_dir, nickname, domain,
http_prefix, postFilename,
- recentPostsCache, debug)
+ recent_posts_cache, debug)
# finally, remove the post itself
try:
os.remove(postFilename)
@@ -1741,7 +1741,7 @@ def deletePost(base_dir: str, http_prefix: str,
return
# remove from recent posts cache in memory
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
# remove from conversation index
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
@@ -1781,7 +1781,7 @@ def deletePost(base_dir: str, http_prefix: str,
# remove any replies
_deletePostRemoveReplies(base_dir, nickname, domain,
http_prefix, postFilename,
- recentPostsCache, debug)
+ recent_posts_cache, debug)
# finally, remove the post itself
try:
os.remove(postFilename)
@@ -2007,7 +2007,7 @@ def getCachedPostFilename(base_dir: str, nickname: str, domain: str,
return cachedPostFilename + '.html'
-def updateRecentPostsCache(recentPostsCache: {}, max_recent_posts: int,
+def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
post_json_object: {}, htmlStr: str) -> None:
"""Store recent posts in memory so that they can be quickly recalled
"""
@@ -2017,27 +2017,27 @@ def updateRecentPostsCache(recentPostsCache: {}, max_recent_posts: int,
if '#' in post_id:
post_id = post_id.split('#', 1)[0]
post_id = removeIdEnding(post_id).replace('/', '#')
- if recentPostsCache.get('index'):
- if post_id in recentPostsCache['index']:
+ if recent_posts_cache.get('index'):
+ if post_id in recent_posts_cache['index']:
return
- recentPostsCache['index'].append(post_id)
+ recent_posts_cache['index'].append(post_id)
post_json_object['muted'] = False
- recentPostsCache['json'][post_id] = json.dumps(post_json_object)
- recentPostsCache['html'][post_id] = htmlStr
+ recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
+ recent_posts_cache['html'][post_id] = htmlStr
- while len(recentPostsCache['html'].items()) > max_recent_posts:
- post_id = recentPostsCache['index'][0]
- recentPostsCache['index'].pop(0)
- if recentPostsCache['json'].get(post_id):
- del recentPostsCache['json'][post_id]
- if recentPostsCache['html'].get(post_id):
- del recentPostsCache['html'][post_id]
+ while len(recent_posts_cache['html'].items()) > max_recent_posts:
+ post_id = recent_posts_cache['index'][0]
+ recent_posts_cache['index'].pop(0)
+ if recent_posts_cache['json'].get(post_id):
+ del recent_posts_cache['json'][post_id]
+ if recent_posts_cache['html'].get(post_id):
+ del recent_posts_cache['html'][post_id]
else:
- recentPostsCache['index'] = [post_id]
- recentPostsCache['json'] = {}
- recentPostsCache['html'] = {}
- recentPostsCache['json'][post_id] = json.dumps(post_json_object)
- recentPostsCache['html'][post_id] = htmlStr
+ recent_posts_cache['index'] = [post_id]
+ recent_posts_cache['json'] = {}
+ recent_posts_cache['html'] = {}
+ recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
+ recent_posts_cache['html'][post_id] = htmlStr
def fileLastModified(filename: str) -> str:
@@ -2207,7 +2207,7 @@ def getFileCaseInsensitive(path: str) -> str:
return None
-def undoLikesCollectionEntry(recentPostsCache: {},
+def undoLikesCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str, objectUrl: str,
actor: str, domain: str, debug: bool,
post_json_object: {}) -> None:
@@ -2230,7 +2230,7 @@ def undoLikesCollectionEntry(recentPostsCache: {},
print('EX: undoLikesCollectionEntry ' +
'unable to delete cached post ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'):
return
@@ -2270,7 +2270,7 @@ def undoLikesCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename)
-def undoReactionCollectionEntry(recentPostsCache: {},
+def undoReactionCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str,
objectUrl: str,
actor: str, domain: str, debug: bool,
@@ -2295,7 +2295,7 @@ def undoReactionCollectionEntry(recentPostsCache: {},
print('EX: undoReactionCollectionEntry ' +
'unable to delete cached post ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'):
return
@@ -2336,7 +2336,7 @@ def undoReactionCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename)
-def undoAnnounceCollectionEntry(recentPostsCache: {},
+def undoAnnounceCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str,
actor: str, domain: str, debug: bool) -> None:
"""Undoes an announce for a particular actor by removing it from
@@ -2361,7 +2361,7 @@ def undoAnnounceCollectionEntry(recentPostsCache: {},
print('EX: undoAnnounceCollectionEntry ' +
'unable to delete cached post ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'):
return
@@ -2403,7 +2403,7 @@ def undoAnnounceCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename)
-def updateAnnounceCollection(recentPostsCache: {},
+def updateAnnounceCollection(recent_posts_cache: {},
base_dir: str, postFilename: str,
actor: str,
nickname: str, domain: str, debug: bool) -> None:
@@ -2428,7 +2428,7 @@ def updateAnnounceCollection(recentPostsCache: {},
print('EX: updateAnnounceCollection ' +
'unable to delete cached post ' +
str(cachedPostFilename))
- removePostFromCache(post_json_object, recentPostsCache)
+ removePostFromCache(post_json_object, recent_posts_cache)
if not has_object_dict(post_json_object):
if debug:
@@ -2555,7 +2555,7 @@ def camelCaseSplit(text: str) -> str:
def rejectPostId(base_dir: str, nickname: str, domain: str,
- post_id: str, recentPostsCache: {}) -> None:
+ post_id: str, recent_posts_cache: {}) -> None:
""" Marks the given post as rejected,
for example an announce which is too old
"""
@@ -2563,7 +2563,7 @@ def rejectPostId(base_dir: str, nickname: str, domain: str,
if not postFilename:
return
- if recentPostsCache.get('index'):
+ if recent_posts_cache.get('index'):
# if this is a full path then remove the directories
indexFilename = postFilename
if '/' in postFilename:
@@ -2576,11 +2576,11 @@ def rejectPostId(base_dir: str, nickname: str, domain: str,
indexFilename.replace('\n', '').replace('\r', '')
postUrl = postUrl.replace('.json', '').strip()
- if postUrl in recentPostsCache['index']:
- if recentPostsCache['json'].get(postUrl):
- del recentPostsCache['json'][postUrl]
- if recentPostsCache['html'].get(postUrl):
- del recentPostsCache['html'][postUrl]
+ if postUrl in recent_posts_cache['index']:
+ if recent_posts_cache['json'].get(postUrl):
+ del recent_posts_cache['json'][postUrl]
+ if recent_posts_cache['html'].get(postUrl):
+ del recent_posts_cache['html'][postUrl]
with open(postFilename + '.reject', 'w+') as rejectFile:
rejectFile.write('\n')
diff --git a/webapp_confirm.py b/webapp_confirm.py
index e2d31c953..515c8a87a 100644
--- a/webapp_confirm.py
+++ b/webapp_confirm.py
@@ -24,7 +24,7 @@ from webapp_post import individualPostAsHtml
def htmlConfirmDelete(cssCache: {},
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate, pageNumber: int,
session, base_dir: str, messageId: str,
http_prefix: str, project_version: str,
@@ -66,7 +66,7 @@ def htmlConfirmDelete(cssCache: {},
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
deletePostStr += \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache, max_recent_posts,
+ True, recent_posts_cache, max_recent_posts,
translate, pageNumber,
base_dir, session,
cached_webfingers, person_cache,
diff --git a/webapp_create_post.py b/webapp_create_post.py
index d2ba9f05d..ed6a86f13 100644
--- a/webapp_create_post.py
+++ b/webapp_create_post.py
@@ -197,7 +197,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
theme: str, noDropDown: bool,
accessKeys: {}, customSubmitText: str,
conversationId: str,
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
session, cached_webfingers: {},
person_cache: {}, port: int,
post_json_object: {},
@@ -260,7 +260,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
if post_json_object:
newPostText += \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache,
+ True, recent_posts_cache,
max_recent_posts,
translate, None,
base_dir, session,
diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py
index 520c26818..49b8a2509 100644
--- a/webapp_frontscreen.py
+++ b/webapp_frontscreen.py
@@ -22,7 +22,7 @@ from webapp_column_right import getRightColumnContent
from webapp_post import individualPostAsHtml
-def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
+def _htmlFrontScreenPosts(recent_posts_cache: {}, max_recent_posts: int,
translate: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
@@ -65,7 +65,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
if item['type'] == 'Create':
postStr = \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache,
+ True, recent_posts_cache,
max_recent_posts,
translate, None,
base_dir, session,
@@ -97,7 +97,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
rss_icon_at_top: bool,
cssCache: {}, icons_as_buttons: bool,
defaultTimeline: str,
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {}, project_version: str,
base_dir: str, http_prefix: str, authorized: bool,
profile_json: {}, selected: str,
@@ -173,7 +173,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
bannerFile, bannerFilename = \
getBannerFile(base_dir, nickname, domain, theme)
profileStr += \
- _htmlFrontScreenPosts(recentPostsCache, max_recent_posts,
+ _htmlFrontScreenPosts(recent_posts_cache, max_recent_posts,
translate,
base_dir, http_prefix,
nickname, domain, port,
diff --git a/webapp_moderation.py b/webapp_moderation.py
index 5915c86a3..9ae8c3da8 100644
--- a/webapp_moderation.py
+++ b/webapp_moderation.py
@@ -31,7 +31,7 @@ from session import createSession
def htmlModeration(cssCache: {}, defaultTimeline: str,
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, wfRequest: {}, person_cache: {},
nickname: str, domain: str, port: int, inboxJson: {},
@@ -60,7 +60,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
"""
artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline,
- recentPostsCache, max_recent_posts,
+ recent_posts_cache, max_recent_posts,
translate, pageNumber,
itemsPerPage, session, base_dir,
wfRequest, person_cache,
diff --git a/webapp_post.py b/webapp_post.py
index 15f0d0da4..afbeaf3bf 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -282,7 +282,7 @@ def _getPostFromRecentCache(session,
enableTimingLog: bool,
postStartTime,
pageNumber: int,
- recentPostsCache: {},
+ recent_posts_cache: {},
max_recent_posts: int,
signing_priv_key_pem: str) -> str:
"""Attempts to get the html post from the recent posts cache in memory
@@ -324,7 +324,7 @@ def _getPostFromRecentCache(session,
postHtml = \
preparePostFromHtmlCache(nickname, postHtml, boxName, pageNumber)
- updateRecentPostsCache(recentPostsCache, max_recent_posts,
+ updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '3')
return postHtml
@@ -1321,7 +1321,7 @@ def _getFooterWithIcons(showIcons: bool,
def individualPostAsHtml(signing_priv_key_pem: str,
allowDownloads: bool,
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {},
pageNumber: int, base_dir: str,
session, cached_webfingers: {}, person_cache: {},
@@ -1402,7 +1402,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
enableTimingLog,
postStartTime,
pageNumber,
- recentPostsCache,
+ recent_posts_cache,
max_recent_posts,
signing_priv_key_pem)
if postHtml:
@@ -1502,7 +1502,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
- recentPostsCache, False,
+ recent_posts_cache, False,
system_language,
domain_full, person_cache,
signing_priv_key_pem,
@@ -1511,7 +1511,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
# if the announce could not be downloaded then mark it as rejected
announcedPostId = removeIdEnding(post_json_object['id'])
rejectPostId(base_dir, nickname, domain, announcedPostId,
- recentPostsCache)
+ recent_posts_cache)
return ''
post_json_object = postJsonAnnounce
@@ -1530,7 +1530,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
enableTimingLog,
postStartTime,
pageNumber,
- recentPostsCache,
+ recent_posts_cache,
max_recent_posts,
signing_priv_key_pem)
if postHtml:
@@ -1539,7 +1539,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
announceFilename = \
locatePost(base_dir, nickname, domain, post_json_object['id'])
if announceFilename:
- updateAnnounceCollection(recentPostsCache,
+ updateAnnounceCollection(recent_posts_cache,
base_dir, announceFilename,
postActor, nickname, domain_full, False)
@@ -1982,7 +1982,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
boxName != 'bookmarks':
_saveIndividualPostAsHtmlToCache(base_dir, nickname, domain,
post_json_object, postHtml)
- updateRecentPostsCache(recentPostsCache, max_recent_posts,
+ updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '19')
@@ -1991,7 +1991,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
def htmlIndividualPost(cssCache: {},
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {},
base_dir: str, session, cached_webfingers: {},
person_cache: {},
@@ -2058,7 +2058,7 @@ def htmlIndividualPost(cssCache: {},
postStr += \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache, max_recent_posts,
+ True, recent_posts_cache, max_recent_posts,
translate, None,
base_dir, session,
cached_webfingers, person_cache,
@@ -2087,7 +2087,7 @@ def htmlIndividualPost(cssCache: {},
if post_json_object:
postStr = \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache,
+ True, recent_posts_cache,
max_recent_posts,
translate, None,
base_dir, session, cached_webfingers,
@@ -2123,7 +2123,7 @@ def htmlIndividualPost(cssCache: {},
for item in repliesJson['orderedItems']:
postStr += \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache,
+ True, recent_posts_cache,
max_recent_posts,
translate, None,
base_dir, session, cached_webfingers,
@@ -2154,7 +2154,7 @@ def htmlIndividualPost(cssCache: {},
def htmlPostReplies(cssCache: {},
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {}, base_dir: str,
session, cached_webfingers: {}, person_cache: {},
nickname: str, domain: str, port: int, repliesJson: {},
@@ -2175,7 +2175,7 @@ def htmlPostReplies(cssCache: {},
for item in repliesJson['orderedItems']:
repliesStr += \
individualPostAsHtml(signing_priv_key_pem,
- True, recentPostsCache,
+ True, recent_posts_cache,
max_recent_posts,
translate, None,
base_dir, session, cached_webfingers,
@@ -2205,7 +2205,7 @@ def htmlPostReplies(cssCache: {},
def htmlEmojiReactionPicker(cssCache: {},
- recentPostsCache: {}, max_recent_posts: int,
+ recent_posts_cache: {}, max_recent_posts: int,
translate: {},
base_dir: str, session, cached_webfingers: {},
person_cache: {},
@@ -2227,7 +2227,7 @@ def htmlEmojiReactionPicker(cssCache: {},
'