Snake case

main
Bob Mottram 2021-12-26 20:01:37 +00:00
parent 1684bbbbca
commit 30120348ee
24 changed files with 423 additions and 423 deletions

View File

@ -51,7 +51,7 @@ def isSelfAnnounce(post_json_object: {}) -> bool:
return post_json_object['actor'] in post_json_object['object'] 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: base_dir: str, message_json: {}, debug: bool) -> bool:
""" Adds or removes announce entries from the shares collection """ Adds or removes announce entries from the shares collection
within a given post within a given post
@ -77,7 +77,7 @@ def outboxAnnounce(recentPostsCache: {},
postFilename = locatePost(base_dir, nickname, domain, postFilename = locatePost(base_dir, nickname, domain,
message_json['object']) message_json['object'])
if postFilename: if postFilename:
updateAnnounceCollection(recentPostsCache, base_dir, postFilename, updateAnnounceCollection(recent_posts_cache, base_dir, postFilename,
message_json['actor'], message_json['actor'],
nickname, domain, debug) nickname, domain, debug)
return True return True
@ -95,7 +95,7 @@ def outboxAnnounce(recentPostsCache: {},
postFilename = locatePost(base_dir, nickname, domain, postFilename = locatePost(base_dir, nickname, domain,
message_json['object']['object']) message_json['object']['object'])
if postFilename: if postFilename:
undoAnnounceCollectionEntry(recentPostsCache, undoAnnounceCollectionEntry(recent_posts_cache,
base_dir, postFilename, base_dir, postFilename,
message_json['actor'], message_json['actor'],
domain, debug) domain, debug)
@ -386,7 +386,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
return unAnnounceJson return unAnnounceJson
def outboxUndoAnnounce(recentPostsCache: {}, def outboxUndoAnnounce(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: 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('DEBUG: c2s undo announce post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
undoAnnounceCollectionEntry(recentPostsCache, base_dir, postFilename, undoAnnounceCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
if debug: if debug:
print('DEBUG: post undo announce via c2s - ' + postFilename) print('DEBUG: post undo announce via c2s - ' + postFilename)

View File

@ -520,7 +520,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
def mutePost(base_dir: str, nickname: str, domain: str, port: int, 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: debug: bool) -> None:
""" Mutes the given post """ 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') print('MUTE: ' + postFilename + '.muted file added')
# if the post is in the recent posts cache then mark it as muted # 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 = \ post_id = \
removeIdEnding(post_json_object['id']).replace('/', '#') 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') print('MUTE: ' + post_id + ' is in recent posts cache')
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
recentPostsCache['json'][post_id] = json.dumps(post_json_object) recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
print('MUTE: ' + post_id + print('MUTE: ' + post_id +
' marked as muted in recent posts memory cache') ' marked as muted in recent posts memory cache')
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
del recentPostsCache['html'][post_id] del recent_posts_cache['html'][post_id]
print('MUTE: ' + post_id + ' removed cached html') print('MUTE: ' + post_id + ' removed cached html')
if alsoUpdatePostId: if alsoUpdatePostId:
@ -642,18 +642,18 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
cachedPostFilename) cachedPostFilename)
pass pass
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
if recentPostsCache['json'].get(alsoUpdatePostId): if recent_posts_cache['json'].get(alsoUpdatePostId):
del recentPostsCache['json'][alsoUpdatePostId] del recent_posts_cache['json'][alsoUpdatePostId]
print('MUTE: ' + alsoUpdatePostId + ' removed referenced json') print('MUTE: ' + alsoUpdatePostId + ' removed referenced json')
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(alsoUpdatePostId): if recent_posts_cache['html'].get(alsoUpdatePostId):
del recentPostsCache['html'][alsoUpdatePostId] del recent_posts_cache['html'][alsoUpdatePostId]
print('MUTE: ' + alsoUpdatePostId + ' removed referenced html') print('MUTE: ' + alsoUpdatePostId + ' removed referenced html')
def unmutePost(base_dir: str, nickname: str, domain: str, port: int, 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: debug: bool) -> None:
""" Unmutes the given post """ Unmutes the given post
""" """
@ -724,18 +724,18 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
str(cachedPostFilename)) str(cachedPostFilename))
# if the post is in the recent posts cache then mark it as unmuted # 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 = \ post_id = \
removeIdEnding(post_json_object['id']).replace('/', '#') 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') print('UNMUTE: ' + post_id + ' is in recent posts cache')
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
recentPostsCache['json'][post_id] = json.dumps(post_json_object) recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
print('UNMUTE: ' + post_id + print('UNMUTE: ' + post_id +
' marked as unmuted in recent posts cache') ' marked as unmuted in recent posts cache')
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
del recentPostsCache['html'][post_id] del recent_posts_cache['html'][post_id]
print('UNMUTE: ' + post_id + ' removed cached html') print('UNMUTE: ' + post_id + ' removed cached html')
if alsoUpdatePostId: if alsoUpdatePostId:
postFilename = locatePost(base_dir, nickname, domain, 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 ' + 'unmutePost cached ref post not removed ' +
str(cachedPostFilename)) str(cachedPostFilename))
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
if recentPostsCache['json'].get(alsoUpdatePostId): if recent_posts_cache['json'].get(alsoUpdatePostId):
del recentPostsCache['json'][alsoUpdatePostId] del recent_posts_cache['json'][alsoUpdatePostId]
print('UNMUTE: ' + print('UNMUTE: ' +
alsoUpdatePostId + ' removed referenced json') alsoUpdatePostId + ' removed referenced json')
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(alsoUpdatePostId): if recent_posts_cache['html'].get(alsoUpdatePostId):
del recentPostsCache['html'][alsoUpdatePostId] del recent_posts_cache['html'][alsoUpdatePostId]
print('UNMUTE: ' + print('UNMUTE: ' +
alsoUpdatePostId + ' removed referenced html') 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, def outboxMute(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool, message_json: {}, debug: bool,
recentPostsCache: {}) -> None: recent_posts_cache: {}) -> None:
"""When a mute is received by the outbox from c2s """When a mute is received by the outbox from c2s
""" """
if not message_json.get('type'): if not message_json.get('type'):
@ -810,7 +810,7 @@ def outboxMute(base_dir: str, http_prefix: str,
return return
mutePost(base_dir, nickname, domain, port, mutePost(base_dir, nickname, domain, port,
http_prefix, message_json['object'], recentPostsCache, http_prefix, message_json['object'], recent_posts_cache,
debug) debug)
if debug: if debug:
@ -820,7 +820,7 @@ def outboxMute(base_dir: str, http_prefix: str,
def outboxUndoMute(base_dir: str, http_prefix: str, def outboxUndoMute(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool, message_json: {}, debug: bool,
recentPostsCache: {}) -> None: recent_posts_cache: {}) -> None:
"""When an undo mute is received by the outbox from c2s """When an undo mute is received by the outbox from c2s
""" """
if not message_json.get('type'): if not message_json.get('type'):
@ -867,7 +867,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
unmutePost(base_dir, nickname, domain, port, unmutePost(base_dir, nickname, domain, port,
http_prefix, message_json['object']['object'], http_prefix, message_json['object']['object'],
recentPostsCache, debug) recent_posts_cache, debug)
if debug: if debug:
print('DEBUG: post undo mute via c2s - ' + postFilename) print('DEBUG: post undo mute via c2s - ' + postFilename)

View File

@ -32,7 +32,7 @@ from posts import getPersonBox
from session import postJson from session import postJson
def undoBookmarksCollectionEntry(recentPostsCache: {}, def undoBookmarksCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
objectUrl: str, objectUrl: str,
actor: str, domain: str, debug: bool) -> None: actor: str, domain: str, debug: bool) -> None:
@ -56,7 +56,7 @@ def undoBookmarksCollectionEntry(recentPostsCache: {},
print('EX: undoBookmarksCollectionEntry ' + print('EX: undoBookmarksCollectionEntry ' +
'unable to delete cached post file ' + 'unable to delete cached post file ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
# remove from the index # remove from the index
bookmarksIndexFilename = \ bookmarksIndexFilename = \
@ -153,7 +153,7 @@ def _noOfBookmarks(post_json_object: {}) -> int:
return len(post_json_object['object']['bookmarks']['items']) return len(post_json_object['object']['bookmarks']['items'])
def updateBookmarksCollection(recentPostsCache: {}, def updateBookmarksCollection(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
objectUrl: str, objectUrl: str,
actor: str, domain: str, debug: bool) -> None: actor: str, domain: str, debug: bool) -> None:
@ -175,7 +175,7 @@ def updateBookmarksCollection(recentPostsCache: {},
print('EX: updateBookmarksCollection ' + print('EX: updateBookmarksCollection ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('object'): if not post_json_object.get('object'):
if debug: if debug:
@ -248,7 +248,7 @@ def updateBookmarksCollection(recentPostsCache: {},
bookmarksIndexFilename) bookmarksIndexFilename)
def bookmark(recentPostsCache: {}, def bookmark(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
ccList: [], http_prefix: str, ccList: [], http_prefix: str,
@ -300,14 +300,14 @@ def bookmark(recentPostsCache: {},
print('DEBUG: bookmark objectUrl: ' + objectUrl) print('DEBUG: bookmark objectUrl: ' + objectUrl)
return None return None
updateBookmarksCollection(recentPostsCache, updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, objectUrl, base_dir, postFilename, objectUrl,
newBookmarkJson['actor'], domain, debug) newBookmarkJson['actor'], domain, debug)
return newBookmarkJson return newBookmarkJson
def undoBookmark(recentPostsCache: {}, def undoBookmark(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
ccList: [], http_prefix: str, ccList: [], http_prefix: str,
@ -360,7 +360,7 @@ def undoBookmark(recentPostsCache: {},
if not postFilename: if not postFilename:
return None return None
undoBookmarksCollectionEntry(recentPostsCache, undoBookmarksCollectionEntry(recent_posts_cache,
base_dir, postFilename, objectUrl, base_dir, postFilename, objectUrl,
newUndoBookmarkJson['actor'], newUndoBookmarkJson['actor'],
domain, debug) domain, debug)
@ -550,7 +550,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
return newBookmarkJson return newBookmarkJson
def outboxBookmark(recentPostsCache: {}, def outboxBookmark(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: message_json: {}, debug: bool) -> None:
@ -599,14 +599,14 @@ def outboxBookmark(recentPostsCache: {},
print('DEBUG: c2s like post not found in inbox or outbox') print('DEBUG: c2s like post not found in inbox or outbox')
print(messageUrl) print(messageUrl)
return True return True
updateBookmarksCollection(recentPostsCache, updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, messageUrl, base_dir, postFilename, messageUrl,
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
if debug: if debug:
print('DEBUG: post bookmarked via c2s - ' + postFilename) print('DEBUG: post bookmarked via c2s - ' + postFilename)
def outboxUndoBookmark(recentPostsCache: {}, def outboxUndoBookmark(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: message_json: {}, debug: bool) -> None:
@ -655,7 +655,7 @@ def outboxUndoBookmark(recentPostsCache: {},
print('DEBUG: c2s unbookmark post not found in inbox or outbox') print('DEBUG: c2s unbookmark post not found in inbox or outbox')
print(messageUrl) print(messageUrl)
return True return True
updateBookmarksCollection(recentPostsCache, updateBookmarksCollection(recent_posts_cache,
base_dir, postFilename, messageUrl, base_dir, postFilename, messageUrl,
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
if debug: if debug:

192
daemon.py
View File

@ -561,7 +561,7 @@ class PubServer(BaseHTTPRequestHandler):
cachedPostFilename) cachedPostFilename)
# remove from memory cache # remove from memory cache
removePostFromCache(post_json_object, removePostFromCache(post_json_object,
self.server.recentPostsCache) self.server.recent_posts_cache)
else: else:
print('ERROR: unable to post vote to outbox') print('ERROR: unable to post vote to outbox')
else: else:
@ -1283,7 +1283,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.onion_domain, self.server.onion_domain,
self.server.i2p_domain, self.server.i2p_domain,
self.server.port, self.server.port,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.followers_threads, self.server.followers_threads,
self.server.federation_list, self.server.federation_list,
self.server.send_threads, self.server.send_threads,
@ -2017,7 +2017,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname, domain, nickname, domain,
postFilename, postFilename,
debug, debug,
self.server.recentPostsCache) self.server.recent_posts_cache)
if nickname != 'news': if nickname != 'news':
# if this is a local blog post then also remove it # if this is a local blog post then also remove it
# from the news actor # from the news actor
@ -2033,7 +2033,7 @@ class PubServer(BaseHTTPRequestHandler):
'news', domain, 'news', domain,
postFilename, postFilename,
debug, debug,
self.server.recentPostsCache) self.server.recent_posts_cache)
self._redirect_headers(actorStr + '/moderation', self._redirect_headers(actorStr + '/moderation',
cookie, calling_domain) cookie, calling_domain)
@ -2716,7 +2716,7 @@ class PubServer(BaseHTTPRequestHandler):
True, accessKeys, True, accessKeys,
customSubmitText, customSubmitText,
conversationId, conversationId,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.session, self.server.session,
self.server.cached_webfingers, self.server.cached_webfingers,
@ -2850,7 +2850,7 @@ class PubServer(BaseHTTPRequestHandler):
True, accessKeys, True, accessKeys,
customSubmitText, customSubmitText,
conversationId, conversationId,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.session, self.server.session,
self.server.cached_webfingers, self.server.cached_webfingers,
@ -3297,7 +3297,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \ hashtagStr = \
htmlHashtagSearch(self.server.cssCache, htmlHashtagSearch(self.server.cssCache,
nickname, domain, port, nickname, domain, port,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
base_dir, base_dir,
@ -3397,7 +3397,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, maxPostsInFeed,
pageNumber, pageNumber,
self.server.project_version, self.server.project_version,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.session, self.server.session,
self.server.cached_webfingers, self.server.cached_webfingers,
@ -3465,7 +3465,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, maxPostsInFeed,
pageNumber, pageNumber,
self.server.project_version, self.server.project_version,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.session, self.server.session,
self.server.cached_webfingers, self.server.cached_webfingers,
@ -3555,7 +3555,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.twitter_replacement_domain self.server.twitter_replacement_domain
profileStr = \ profileStr = \
htmlProfileAfterSearch(self.server.cssCache, htmlProfileAfterSearch(self.server.cssCache,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
base_dir, base_dir,
@ -4661,7 +4661,7 @@ class PubServer(BaseHTTPRequestHandler):
# remove any previous cached news posts # remove any previous cached news posts
newsId = removeIdEnding(post_json_object['object']['id']) newsId = removeIdEnding(post_json_object['object']['id'])
newsId = newsId.replace('/', '#') newsId = newsId.replace('/', '#')
clearFromPostCaches(base_dir, self.server.recentPostsCache, clearFromPostCaches(base_dir, self.server.recent_posts_cache,
newsId) newsId)
# save the news post # save the news post
@ -7542,7 +7542,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \ hashtagStr = \
htmlHashtagSearch(self.server.cssCache, htmlHashtagSearch(self.server.cssCache,
nickname, domain, port, nickname, domain, port,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
base_dir, hashtag, pageNumber, base_dir, hashtag, pageNumber,
@ -7605,7 +7605,7 @@ class PubServer(BaseHTTPRequestHandler):
hashtagStr = \ hashtagStr = \
rssHashtagSearch(nickname, rssHashtagSearch(nickname,
domain, port, domain, port,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
base_dir, hashtag, base_dir, hashtag,
@ -7751,7 +7751,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(announceJson) showRepeats = not isDM(announceJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -7796,7 +7796,7 @@ class PubServer(BaseHTTPRequestHandler):
onion_domain: str, i2p_domain: str, onion_domain: str, i2p_domain: str,
GETstartTime, GETstartTime,
repeatPrivate: bool, debug: bool, repeatPrivate: bool, debug: bool,
recentPostsCache: {}) -> None: recent_posts_cache: {}) -> None:
"""Undo announce/repeat button was pressed """Undo announce/repeat button was pressed
""" """
pageNumber = 1 pageNumber = 1
@ -7875,7 +7875,7 @@ class PubServer(BaseHTTPRequestHandler):
if postFilename: if postFilename:
deletePost(base_dir, http_prefix, deletePost(base_dir, http_prefix,
nickname, domain, postFilename, nickname, domain, postFilename,
debug, recentPostsCache) debug, recent_posts_cache)
self._postToOutbox(newUndoAnnounce, self._postToOutbox(newUndoAnnounce,
self.server.project_version, self.postToNickname) self.server.project_version, self.postToNickname)
@ -8179,10 +8179,10 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = \ likedPostFilename = \
locatePost(base_dir, self.postToNickname, domain, likeUrl) locatePost(base_dir, self.postToNickname, domain, likeUrl)
if likedPostFilename: if likedPostFilename:
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
likedPostJson = load_json(likedPostFilename, 0, 1) likedPostJson = load_json(likedPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
updateLikesCollection(recentPostsCache, updateLikesCollection(recent_posts_cache,
base_dir, likedPostFilename, base_dir, likedPostFilename,
likeUrl, likeActor, self.postToNickname, likeUrl, likeActor, self.postToNickname,
domain, debug, likedPostJson) domain, debug, likedPostJson)
@ -8190,7 +8190,7 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = origFilename likedPostFilename = origFilename
if debug: if debug:
print('Updating likes for ' + likedPostFilename) print('Updating likes for ' + likedPostFilename)
updateLikesCollection(recentPostsCache, updateLikesCollection(recent_posts_cache,
base_dir, likedPostFilename, likeUrl, base_dir, likedPostFilename, likeUrl,
likeActor, self.postToNickname, domain, likeActor, self.postToNickname, domain,
debug, None) debug, None)
@ -8212,7 +8212,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(likedPostJson) showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -8343,10 +8343,10 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = locatePost(base_dir, self.postToNickname, likedPostFilename = locatePost(base_dir, self.postToNickname,
domain, likeUrl) domain, likeUrl)
if likedPostFilename: if likedPostFilename:
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
likedPostJson = load_json(likedPostFilename, 0, 1) likedPostJson = load_json(likedPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
undoLikesCollectionEntry(recentPostsCache, undoLikesCollectionEntry(recent_posts_cache,
base_dir, likedPostFilename, base_dir, likedPostFilename,
likeUrl, undoActor, domain, debug, likeUrl, undoActor, domain, debug,
likedPostJson) likedPostJson)
@ -8354,7 +8354,7 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = origFilename likedPostFilename = origFilename
if debug: if debug:
print('Removing likes for ' + likedPostFilename) print('Removing likes for ' + likedPostFilename)
undoLikesCollectionEntry(recentPostsCache, undoLikesCollectionEntry(recent_posts_cache,
base_dir, base_dir,
likedPostFilename, likeUrl, likedPostFilename, likeUrl,
undoActor, domain, debug, None) undoActor, domain, debug, None)
@ -8367,7 +8367,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(likedPostJson) showRepeats = not isDM(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -8512,10 +8512,10 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = \ reactionPostFilename = \
locatePost(base_dir, self.postToNickname, domain, reactionUrl) locatePost(base_dir, self.postToNickname, domain, reactionUrl)
if reactionPostFilename: if reactionPostFilename:
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
reactionPostJson = load_json(reactionPostFilename, 0, 1) reactionPostJson = load_json(reactionPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
updateReactionCollection(recentPostsCache, updateReactionCollection(recent_posts_cache,
base_dir, reactionPostFilename, base_dir, reactionPostFilename,
reactionUrl, reactionUrl,
reactionActor, self.postToNickname, reactionActor, self.postToNickname,
@ -8525,7 +8525,7 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = origFilename reactionPostFilename = origFilename
if debug: if debug:
print('Updating emoji reaction for ' + reactionPostFilename) print('Updating emoji reaction for ' + reactionPostFilename)
updateReactionCollection(recentPostsCache, updateReactionCollection(recent_posts_cache,
base_dir, reactionPostFilename, base_dir, reactionPostFilename,
reactionUrl, reactionUrl,
reactionActor, reactionActor,
@ -8550,7 +8550,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson) showRepeats = not isDM(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -8695,10 +8695,10 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = \ reactionPostFilename = \
locatePost(base_dir, self.postToNickname, domain, reactionUrl) locatePost(base_dir, self.postToNickname, domain, reactionUrl)
if reactionPostFilename: if reactionPostFilename:
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
reactionPostJson = load_json(reactionPostFilename, 0, 1) reactionPostJson = load_json(reactionPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
undoReactionCollectionEntry(recentPostsCache, undoReactionCollectionEntry(recent_posts_cache,
base_dir, reactionPostFilename, base_dir, reactionPostFilename,
reactionUrl, reactionUrl,
undoActor, domain, debug, undoActor, domain, debug,
@ -8708,7 +8708,7 @@ class PubServer(BaseHTTPRequestHandler):
reactionPostFilename = origFilename reactionPostFilename = origFilename
if debug: if debug:
print('Removing emoji reaction for ' + reactionPostFilename) print('Removing emoji reaction for ' + reactionPostFilename)
undoReactionCollectionEntry(recentPostsCache, undoReactionCollectionEntry(recent_posts_cache,
base_dir, base_dir,
reactionPostFilename, reactionUrl, reactionPostFilename, reactionUrl,
undoActor, domain, debug, undoActor, domain, debug,
@ -8723,7 +8723,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson) showRepeats = not isDM(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -8823,7 +8823,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlEmojiReactionPicker(self.server.cssCache, htmlEmojiReactionPicker(self.server.cssCache,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.base_dir, self.server.base_dir,
@ -8906,7 +8906,7 @@ class PubServer(BaseHTTPRequestHandler):
bookmarkActor = \ bookmarkActor = \
local_actor_url(http_prefix, self.postToNickname, domain_full) local_actor_url(http_prefix, self.postToNickname, domain_full)
ccList = [] ccList = []
bookmark(self.server.recentPostsCache, bookmark(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
self.server.federation_list, self.server.federation_list,
@ -8943,7 +8943,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson) showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -9032,7 +9032,7 @@ class PubServer(BaseHTTPRequestHandler):
undoActor = \ undoActor = \
local_actor_url(http_prefix, self.postToNickname, domain_full) local_actor_url(http_prefix, self.postToNickname, domain_full)
ccList = [] ccList = []
undoBookmark(self.server.recentPostsCache, undoBookmark(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
self.server.federation_list, self.server.federation_list,
@ -9071,7 +9071,7 @@ class PubServer(BaseHTTPRequestHandler):
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson) showRepeats = not isDM(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -9173,7 +9173,7 @@ class PubServer(BaseHTTPRequestHandler):
deleteStr = \ deleteStr = \
htmlConfirmDelete(self.server.cssCache, htmlConfirmDelete(self.server.cssCache,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, pageNumber, self.server.translate, pageNumber,
self.server.session, base_dir, self.server.session, base_dir,
@ -9246,7 +9246,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actor) nickname = getNicknameFromActor(actor)
mutePost(base_dir, nickname, domain, port, mutePost(base_dir, nickname, domain, port,
http_prefix, muteUrl, http_prefix, muteUrl,
self.server.recentPostsCache, debug) self.server.recent_posts_cache, debug)
muteFilename = \ muteFilename = \
locatePost(base_dir, nickname, domain, muteUrl) locatePost(base_dir, nickname, domain, muteUrl)
if muteFilename: if muteFilename:
@ -9273,7 +9273,7 @@ class PubServer(BaseHTTPRequestHandler):
avatarUrl = None avatarUrl = None
individualPostAsHtml(self.server.signing_priv_key_pem, individualPostAsHtml(self.server.signing_priv_key_pem,
allowDownloads, allowDownloads,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -9355,7 +9355,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actor) nickname = getNicknameFromActor(actor)
unmutePost(base_dir, nickname, domain, port, unmutePost(base_dir, nickname, domain, port,
http_prefix, muteUrl, http_prefix, muteUrl,
self.server.recentPostsCache, debug) self.server.recent_posts_cache, debug)
muteFilename = \ muteFilename = \
locatePost(base_dir, nickname, domain, muteUrl) locatePost(base_dir, nickname, domain, muteUrl)
if muteFilename: if muteFilename:
@ -9383,7 +9383,7 @@ class PubServer(BaseHTTPRequestHandler):
avatarUrl = None avatarUrl = None
individualPostAsHtml(self.server.signing_priv_key_pem, individualPostAsHtml(self.server.signing_priv_key_pem,
allowDownloads, allowDownloads,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, base_dir, pageNumber, base_dir,
@ -9492,7 +9492,7 @@ class PubServer(BaseHTTPRequestHandler):
if not self._establishSession("showRepliesToPost"): if not self._establishSession("showRepliesToPost"):
self._404() self._404()
return True return True
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
max_recent_posts = self.server.max_recent_posts max_recent_posts = self.server.max_recent_posts
translate = self.server.translate translate = self.server.translate
session = self.server.session session = self.server.session
@ -9505,7 +9505,7 @@ class PubServer(BaseHTTPRequestHandler):
peertube_instances = self.server.peertube_instances peertube_instances = self.server.peertube_instances
msg = \ msg = \
htmlPostReplies(self.server.cssCache, htmlPostReplies(self.server.cssCache,
recentPostsCache, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, translate,
base_dir, base_dir,
@ -9584,7 +9584,7 @@ class PubServer(BaseHTTPRequestHandler):
if not self._establishSession("showRepliesToPost2"): if not self._establishSession("showRepliesToPost2"):
self._404() self._404()
return True return True
recentPostsCache = self.server.recentPostsCache recent_posts_cache = self.server.recent_posts_cache
max_recent_posts = self.server.max_recent_posts max_recent_posts = self.server.max_recent_posts
translate = self.server.translate translate = self.server.translate
session = self.server.session session = self.server.session
@ -9597,7 +9597,7 @@ class PubServer(BaseHTTPRequestHandler):
peertube_instances = self.server.peertube_instances peertube_instances = self.server.peertube_instances
msg = \ msg = \
htmlPostReplies(self.server.cssCache, htmlPostReplies(self.server.cssCache,
recentPostsCache, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, translate,
base_dir, base_dir,
@ -9679,8 +9679,8 @@ class PubServer(BaseHTTPRequestHandler):
if getPerson: if getPerson:
defaultTimeline = \ defaultTimeline = \
self.server.defaultTimeline self.server.defaultTimeline
recentPostsCache = \ recent_posts_cache = \
self.server.recentPostsCache self.server.recent_posts_cache
cached_webfingers = \ cached_webfingers = \
self.server.cached_webfingers self.server.cached_webfingers
yt_replace_domain = \ yt_replace_domain = \
@ -9704,7 +9704,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
icons_as_buttons, icons_as_buttons,
defaultTimeline, defaultTimeline,
recentPostsCache, recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -9784,8 +9784,8 @@ class PubServer(BaseHTTPRequestHandler):
if getPerson: if getPerson:
defaultTimeline = \ defaultTimeline = \
self.server.defaultTimeline self.server.defaultTimeline
recentPostsCache = \ recent_posts_cache = \
self.server.recentPostsCache self.server.recent_posts_cache
cached_webfingers = \ cached_webfingers = \
self.server.cached_webfingers self.server.cached_webfingers
yt_replace_domain = \ yt_replace_domain = \
@ -9820,7 +9820,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
icons_as_buttons, icons_as_buttons,
defaultTimeline, defaultTimeline,
recentPostsCache, recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -9988,7 +9988,7 @@ class PubServer(BaseHTTPRequestHandler):
if self._requestHTTP(): if self._requestHTTP():
msg = \ msg = \
htmlIndividualPost(self.server.cssCache, htmlIndividualPost(self.server.cssCache,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
base_dir, base_dir,
@ -10162,7 +10162,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime, GETstartTime,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
recentPostsCache: {}, session, recent_posts_cache: {}, session,
defaultTimeline: str, defaultTimeline: str,
max_recent_posts: int, max_recent_posts: int,
translate: {}, translate: {},
@ -10177,7 +10177,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxFeed = \ inboxFeed = \
personBoxJson(recentPostsCache, personBoxJson(recent_posts_cache,
session, session,
base_dir, base_dir,
domain, domain,
@ -10209,7 +10209,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxFeed = \ inboxFeed = \
personBoxJson(recentPostsCache, personBoxJson(recent_posts_cache,
session, session,
base_dir, base_dir,
domain, domain,
@ -10239,7 +10239,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.shared_items_federated_domains self.server.shared_items_federated_domains
msg = htmlInbox(self.server.cssCache, msg = htmlInbox(self.server.cssCache,
defaultTimeline, defaultTimeline,
recentPostsCache, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -10336,7 +10336,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxDMFeed = \ inboxDMFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10362,7 +10362,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxDMFeed = \ inboxDMFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10392,7 +10392,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxDMs(self.server.cssCache, htmlInboxDMs(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -10481,7 +10481,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxRepliesFeed = \ inboxRepliesFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10508,7 +10508,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxRepliesFeed = \ inboxRepliesFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10537,7 +10537,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxReplies(self.server.cssCache, htmlInboxReplies(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -10626,7 +10626,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxMediaFeed = \ inboxMediaFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10653,7 +10653,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxMediaFeed = \ inboxMediaFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10678,7 +10678,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxMedia(self.server.cssCache, htmlInboxMedia(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInMediaFeed, pageNumber, maxPostsInMediaFeed,
@ -10768,7 +10768,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxBlogsFeed = \ inboxBlogsFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10795,7 +10795,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxBlogsFeed = \ inboxBlogsFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10820,7 +10820,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxBlogs(self.server.cssCache, htmlInboxBlogs(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInBlogsFeed, pageNumber, maxPostsInBlogsFeed,
@ -10911,7 +10911,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxNewsFeed = \ inboxNewsFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10939,7 +10939,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxNewsFeed = \ inboxNewsFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -10971,7 +10971,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxNews(self.server.cssCache, htmlInboxNews(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInNewsFeed, pageNumber, maxPostsInNewsFeed,
@ -11062,7 +11062,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
inboxFeaturesFeed = \ inboxFeaturesFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11090,7 +11090,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
inboxFeaturesFeed = \ inboxFeaturesFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11123,7 +11123,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlInboxFeatures(self.server.cssCache, htmlInboxFeatures(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInBlogsFeed, pageNumber, maxPostsInBlogsFeed,
@ -11234,7 +11234,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlShares(self.server.cssCache, htmlShares(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -11319,7 +11319,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlWanted(self.server.cssCache, htmlWanted(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -11384,7 +11384,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
bookmarksFeed = \ bookmarksFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11411,7 +11411,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
bookmarksFeed = \ bookmarksFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11441,7 +11441,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlBookmarks(self.server.cssCache, htmlBookmarks(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -11529,7 +11529,7 @@ class PubServer(BaseHTTPRequestHandler):
""" """
# get outbox feed for a person # get outbox feed for a person
outboxFeed = \ outboxFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, domain, port, path, base_dir, domain, port, path,
http_prefix, maxPostsInFeed, 'outbox', http_prefix, maxPostsInFeed, 'outbox',
@ -11555,7 +11555,7 @@ class PubServer(BaseHTTPRequestHandler):
# if a page wasn't specified then show the first one # if a page wasn't specified then show the first one
pageStr = '?page=' + str(pageNumber) pageStr = '?page=' + str(pageNumber)
outboxFeed = \ outboxFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, domain, port, base_dir, domain, port,
path + pageStr, path + pageStr,
@ -11581,7 +11581,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlOutbox(self.server.cssCache, htmlOutbox(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -11657,7 +11657,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path: if '/users/' in path:
if authorized: if authorized:
moderationFeed = \ moderationFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11683,7 +11683,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path: if 'page=' not in path:
# if no page was specified then show the first # if no page was specified then show the first
moderationFeed = \ moderationFeed = \
personBoxJson(self.server.recentPostsCache, personBoxJson(self.server.recent_posts_cache,
self.server.session, self.server.session,
base_dir, base_dir,
domain, domain,
@ -11714,7 +11714,7 @@ class PubServer(BaseHTTPRequestHandler):
msg = \ msg = \
htmlModeration(self.server.cssCache, htmlModeration(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
pageNumber, maxPostsInFeed, pageNumber, maxPostsInFeed,
@ -11845,7 +11845,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
self.server.icons_as_buttons, self.server.icons_as_buttons,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -11966,7 +11966,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
self.server.icons_as_buttons, self.server.icons_as_buttons,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -12085,7 +12085,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
self.server.icons_as_buttons, self.server.icons_as_buttons,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -12221,7 +12221,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cssCache, self.server.cssCache,
self.server.icons_as_buttons, self.server.icons_as_buttons,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.translate, self.server.translate,
self.server.project_version, self.server.project_version,
@ -12992,7 +12992,7 @@ class PubServer(BaseHTTPRequestHandler):
noDropDown, accessKeys, noDropDown, accessKeys,
customSubmitText, customSubmitText,
conversationId, conversationId,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.session, self.server.session,
self.server.cached_webfingers, self.server.cached_webfingers,
@ -15287,7 +15287,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime, GETstartTime,
repeatPrivate, repeatPrivate,
self.server.debug, self.server.debug,
self.server.recentPostsCache) self.server.recent_posts_cache)
self.server.GETbusy = False self.server.GETbusy = False
return return
@ -15921,7 +15921,7 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime, GETstartTime,
self.server.proxy_type, self.server.proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
self.server.recentPostsCache, self.server.recent_posts_cache,
self.server.session, self.server.session,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -16768,7 +16768,7 @@ class PubServer(BaseHTTPRequestHandler):
'unable to delete ' + cachedFilename) 'unable to delete ' + cachedFilename)
# remove from memory cache # remove from memory cache
removePostFromCache(post_json_object, removePostFromCache(post_json_object,
self.server.recentPostsCache) self.server.recent_posts_cache)
# change the blog post title # change the blog post title
post_json_object['object']['summary'] = \ post_json_object['object']['summary'] = \
fields['subject'] fields['subject']
@ -18910,7 +18910,7 @@ def runDaemon(content_license_url: str,
else: else:
httpd.thrSharesExpire.start() httpd.thrSharesExpire.start()
httpd.recentPostsCache = {} httpd.recent_posts_cache = {}
httpd.max_recent_posts = max_recent_posts httpd.max_recent_posts = max_recent_posts
httpd.iconsCache = {} httpd.iconsCache = {}
httpd.fontsCache = {} httpd.fontsCache = {}
@ -18933,7 +18933,7 @@ def runDaemon(content_license_url: str,
print('Creating inbox queue') print('Creating inbox queue')
httpd.thrInboxQueue = \ httpd.thrInboxQueue = \
threadWithTrace(target=runInboxQueue, threadWithTrace(target=runInboxQueue,
args=(httpd.recentPostsCache, args=(httpd.recent_posts_cache,
httpd.max_recent_posts, httpd.max_recent_posts,
project_version, project_version,
base_dir, http_prefix, httpd.send_threads, base_dir, http_prefix, httpd.send_threads,

View File

@ -116,7 +116,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
nickname: str, domain: str, nickname: str, domain: str,
message_json: {}, debug: bool, message_json: {}, debug: bool,
allow_deletion: bool, allow_deletion: bool,
recentPostsCache: {}) -> None: recent_posts_cache: {}) -> None:
""" When a delete request is received by the outbox from c2s """ When a delete request is received by the outbox from c2s
""" """
if not message_json.get('type'): if not message_json.get('type'):
@ -169,7 +169,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
print(messageId) print(messageId)
return True return True
deletePost(base_dir, http_prefix, deleteNickname, deleteDomain, deletePost(base_dir, http_prefix, deleteNickname, deleteDomain,
postFilename, debug, recentPostsCache) postFilename, debug, recent_posts_cache)
if debug: if debug:
print('DEBUG: post deleted via c2s - ' + postFilename) print('DEBUG: post deleted via c2s - ' + postFilename)

View File

@ -696,7 +696,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
if post_json_object['type'] == 'Announce': if post_json_object['type'] == 'Announce':
actor = post_json_object['actor'] actor = post_json_object['actor']
nameStr = getNicknameFromActor(actor) nameStr = getNicknameFromActor(actor)
recentPostsCache = {} recent_posts_cache = {}
allow_local_network_access = False allow_local_network_access = False
yt_replace_domain = None yt_replace_domain = None
twitter_replacement_domain = None twitter_replacement_domain = None
@ -709,7 +709,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, False, recent_posts_cache, False,
system_language, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem, signing_priv_key_pem,
@ -2402,7 +2402,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
_desktopGetBoxPostObject(boxJson, currIndex) _desktopGetBoxPostObject(boxJson, currIndex)
if post_json_object: if post_json_object:
if post_json_object['type'] == 'Announce': if post_json_object['type'] == 'Announce':
recentPostsCache = {} recent_posts_cache = {}
allow_local_network_access = False allow_local_network_access = False
yt_replace_domain = None yt_replace_domain = None
twitter_replacement_domain = None twitter_replacement_domain = None
@ -2415,7 +2415,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, False, recent_posts_cache, False,
system_language, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem, signing_priv_key_pem,

114
inbox.py
View File

@ -278,7 +278,7 @@ def storeHashTags(base_dir: str, nickname: str, domain: str,
http_prefix, domain_full, translate) http_prefix, domain_full, translate)
def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int, def _inboxStorePostToHtmlCache(recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
session, cached_webfingers: {}, session, cached_webfingers: {},
@ -306,7 +306,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain = get_config_param(base_dir, 'youtubedomain') yt_replace_domain = get_config_param(base_dir, 'youtubedomain')
twitter_replacement_domain = get_config_param(base_dir, 'twitterdomain') twitter_replacement_domain = get_config_param(base_dir, 'twitterdomain')
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts, True, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
person_cache, person_cache,
@ -899,7 +899,7 @@ def _personReceiveUpdate(base_dir: str,
return True return True
def _receiveUpdateToQuestion(recentPostsCache: {}, message_json: {}, def _receiveUpdateToQuestion(recent_posts_cache: {}, message_json: {},
base_dir: str, base_dir: str,
nickname: str, domain: str) -> None: nickname: str, domain: str) -> None:
"""Updating a question as new votes arrive """Updating a question as new votes arrive
@ -938,10 +938,10 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, message_json: {},
print('EX: _receiveUpdateToQuestion unable to delete ' + print('EX: _receiveUpdateToQuestion unable to delete ' +
cachedPostFilename) cachedPostFilename)
# remove from memory cache # 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, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {}, send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, message_json: {}, federation_list: [], person_cache: {}, message_json: {}, federation_list: [],
@ -961,7 +961,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
return False return False
if message_json['object']['type'] == 'Question': if message_json['object']['type'] == 'Question':
_receiveUpdateToQuestion(recentPostsCache, message_json, _receiveUpdateToQuestion(recent_posts_cache, message_json,
base_dir, nickname, domain) base_dir, nickname, domain)
if debug: if debug:
print('DEBUG: Question update was received') print('DEBUG: Question update was received')
@ -993,7 +993,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
return False return False
def _receiveLike(recentPostsCache: {}, def _receiveLike(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
onion_domain: str, onion_domain: str,
@ -1056,7 +1056,7 @@ def _receiveLike(recentPostsCache: {},
likeActor): likeActor):
_likeNotify(base_dir, domain, onion_domain, handle, _likeNotify(base_dir, domain, onion_domain, handle,
likeActor, postLikedId) likeActor, postLikedId)
updateLikesCollection(recentPostsCache, base_dir, postFilename, updateLikesCollection(recent_posts_cache, base_dir, postFilename,
postLikedId, likeActor, postLikedId, likeActor,
handleName, domain, debug, None) handleName, domain, debug, None)
# regenerate the html # regenerate the html
@ -1073,7 +1073,7 @@ def _receiveLike(recentPostsCache: {},
if announceLikedFilename: if announceLikedFilename:
postLikedId = announceLikeUrl postLikedId = announceLikeUrl
postFilename = announceLikedFilename postFilename = announceLikedFilename
updateLikesCollection(recentPostsCache, updateLikesCollection(recent_posts_cache,
base_dir, base_dir,
postFilename, postFilename,
postLikedId, postLikedId,
@ -1095,7 +1095,7 @@ def _receiveLike(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson) notDM = not isDM(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
handleName, domain, port, likedPostJson, handleName, domain, port, likedPostJson,
@ -1116,7 +1116,7 @@ def _receiveLike(recentPostsCache: {},
return True return True
def _receiveUndoLike(recentPostsCache: {}, def _receiveUndoLike(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {}, send_threads: [], postLog: [], cached_webfingers: {},
@ -1171,7 +1171,7 @@ def _receiveUndoLike(recentPostsCache: {},
print('DEBUG: liked post found in inbox. Now undoing.') print('DEBUG: liked post found in inbox. Now undoing.')
likeActor = message_json['actor'] likeActor = message_json['actor']
postLikedId = message_json['object'] postLikedId = message_json['object']
undoLikesCollectionEntry(recentPostsCache, base_dir, postFilename, undoLikesCollectionEntry(recent_posts_cache, base_dir, postFilename,
postLikedId, likeActor, domain, debug, None) postLikedId, likeActor, domain, debug, None)
# regenerate the html # regenerate the html
likedPostJson = load_json(postFilename, 0, 1) likedPostJson = load_json(postFilename, 0, 1)
@ -1187,7 +1187,7 @@ def _receiveUndoLike(recentPostsCache: {},
if announceLikedFilename: if announceLikedFilename:
postLikedId = announceLikeUrl postLikedId = announceLikeUrl
postFilename = announceLikedFilename postFilename = announceLikedFilename
undoLikesCollectionEntry(recentPostsCache, base_dir, undoLikesCollectionEntry(recent_posts_cache, base_dir,
postFilename, postLikedId, postFilename, postLikedId,
likeActor, domain, debug, likeActor, domain, debug,
None) None)
@ -1206,7 +1206,7 @@ def _receiveUndoLike(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson) notDM = not isDM(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
handleName, domain, port, likedPostJson, handleName, domain, port, likedPostJson,
@ -1227,7 +1227,7 @@ def _receiveUndoLike(recentPostsCache: {},
return True return True
def _receiveReaction(recentPostsCache: {}, def _receiveReaction(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
onion_domain: str, onion_domain: str,
@ -1314,7 +1314,7 @@ def _receiveReaction(recentPostsCache: {},
emojiContent): emojiContent):
_reactionNotify(base_dir, domain, onion_domain, handle, _reactionNotify(base_dir, domain, onion_domain, handle,
reactionActor, postReactionId, emojiContent) reactionActor, postReactionId, emojiContent)
updateReactionCollection(recentPostsCache, base_dir, postFilename, updateReactionCollection(recent_posts_cache, base_dir, postFilename,
postReactionId, reactionActor, postReactionId, reactionActor,
handleName, domain, debug, None, emojiContent) handleName, domain, debug, None, emojiContent)
# regenerate the html # regenerate the html
@ -1331,7 +1331,7 @@ def _receiveReaction(recentPostsCache: {},
if announceReactionFilename: if announceReactionFilename:
postReactionId = announceReactionUrl postReactionId = announceReactionUrl
postFilename = announceReactionFilename postFilename = announceReactionFilename
updateReactionCollection(recentPostsCache, updateReactionCollection(recent_posts_cache,
base_dir, base_dir,
postFilename, postFilename,
postReactionId, postReactionId,
@ -1354,7 +1354,7 @@ def _receiveReaction(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson) notDM = not isDM(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
handleName, domain, port, reactionPostJson, handleName, domain, port, reactionPostJson,
@ -1375,7 +1375,7 @@ def _receiveReaction(recentPostsCache: {},
return True return True
def _receiveUndoReaction(recentPostsCache: {}, def _receiveUndoReaction(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], send_threads: [], postLog: [],
@ -1445,7 +1445,7 @@ def _receiveUndoReaction(recentPostsCache: {},
if debug: if debug:
print('DEBUG: unreaction has no content') print('DEBUG: unreaction has no content')
return True return True
undoReactionCollectionEntry(recentPostsCache, base_dir, postFilename, undoReactionCollectionEntry(recent_posts_cache, base_dir, postFilename,
postReactionId, reactionActor, domain, postReactionId, reactionActor, domain,
debug, None, emojiContent) debug, None, emojiContent)
# regenerate the html # regenerate the html
@ -1462,7 +1462,7 @@ def _receiveUndoReaction(recentPostsCache: {},
if announceReactionFilename: if announceReactionFilename:
postReactionId = announceReactionUrl postReactionId = announceReactionUrl
postFilename = announceReactionFilename postFilename = announceReactionFilename
undoReactionCollectionEntry(recentPostsCache, base_dir, undoReactionCollectionEntry(recent_posts_cache, base_dir,
postFilename, postFilename,
postReactionId, postReactionId,
reactionActor, domain, reactionActor, domain,
@ -1483,7 +1483,7 @@ def _receiveUndoReaction(recentPostsCache: {},
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson) notDM = not isDM(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
handleName, domain, port, reactionPostJson, handleName, domain, port, reactionPostJson,
@ -1504,7 +1504,7 @@ def _receiveUndoReaction(recentPostsCache: {},
return True return True
def _receiveBookmark(recentPostsCache: {}, def _receiveBookmark(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {}, send_threads: [], postLog: [], cached_webfingers: {},
@ -1573,7 +1573,7 @@ def _receiveBookmark(recentPostsCache: {},
print(messageUrl) print(messageUrl)
return True return True
updateBookmarksCollection(recentPostsCache, base_dir, postFilename, updateBookmarksCollection(recent_posts_cache, base_dir, postFilename,
message_json['object']['url'], message_json['object']['url'],
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
# regenerate the html # regenerate the html
@ -1593,7 +1593,7 @@ def _receiveBookmark(recentPostsCache: {},
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson) notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
nickname, domain, port, bookmarkedPostJson, nickname, domain, port, bookmarkedPostJson,
@ -1614,7 +1614,7 @@ def _receiveBookmark(recentPostsCache: {},
return True return True
def _receiveUndoBookmark(recentPostsCache: {}, def _receiveUndoBookmark(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], send_threads: [], postLog: [],
@ -1686,7 +1686,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
print(messageUrl) print(messageUrl)
return True return True
undoBookmarksCollectionEntry(recentPostsCache, base_dir, postFilename, undoBookmarksCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['object']['url'], message_json['object']['url'],
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
# regenerate the html # regenerate the html
@ -1706,7 +1706,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson) notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
nickname, domain, port, bookmarkedPostJson, nickname, domain, port, bookmarkedPostJson,
@ -1731,7 +1731,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
send_threads: [], postLog: [], cached_webfingers: {}, send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, message_json: {}, federation_list: [], person_cache: {}, message_json: {}, federation_list: [],
debug: bool, allow_deletion: bool, debug: bool, allow_deletion: bool,
recentPostsCache: {}) -> bool: recent_posts_cache: {}) -> bool:
"""Receives a Delete activity within the POST section of HTTPServer """Receives a Delete activity within the POST section of HTTPServer
""" """
if message_json['type'] != 'Delete': if message_json['type'] != 'Delete':
@ -1784,7 +1784,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
return True return True
deletePost(base_dir, http_prefix, handleNickname, deletePost(base_dir, http_prefix, handleNickname,
handleDomain, postFilename, debug, handleDomain, postFilename, debug,
recentPostsCache) recent_posts_cache)
if debug: if debug:
print('DEBUG: post deleted - ' + postFilename) print('DEBUG: post deleted - ' + postFilename)
@ -1795,13 +1795,13 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
if postFilename: if postFilename:
deletePost(base_dir, http_prefix, 'news', deletePost(base_dir, http_prefix, 'news',
handleDomain, postFilename, debug, handleDomain, postFilename, debug,
recentPostsCache) recent_posts_cache)
if debug: if debug:
print('DEBUG: blog post deleted - ' + postFilename) print('DEBUG: blog post deleted - ' + postFilename)
return True return True
def _receiveAnnounce(recentPostsCache: {}, def _receiveAnnounce(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, http_prefix: str,
domain: str, onion_domain: str, port: int, 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('DEBUG: announce post not found in inbox or outbox')
print(message_json['object']) print(message_json['object'])
return True return True
updateAnnounceCollection(recentPostsCache, base_dir, postFilename, updateAnnounceCollection(recent_posts_cache, base_dir, postFilename,
message_json['actor'], nickname, domain, debug) message_json['actor'], nickname, domain, debug)
if debug: if debug:
print('DEBUG: Downloading announce post ' + message_json['actor'] + print('DEBUG: Downloading announce post ' + message_json['actor'] +
@ -1913,7 +1913,7 @@ def _receiveAnnounce(recentPostsCache: {},
print('Generating html for announce ' + message_json['id']) print('Generating html for announce ' + message_json['id'])
announceHtml = \ announceHtml = \
individualPostAsHtml(signing_priv_key_pem, True, individualPostAsHtml(signing_priv_key_pem, True,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
nickname, domain, port, message_json, nickname, domain, port, message_json,
@ -1946,7 +1946,7 @@ def _receiveAnnounce(recentPostsCache: {},
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, debug, recent_posts_cache, debug,
system_language, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem, signing_priv_key_pem,
@ -2029,7 +2029,7 @@ def _receiveAnnounce(recentPostsCache: {},
return True return True
def _receiveUndoAnnounce(recentPostsCache: {}, def _receiveUndoAnnounce(recent_posts_cache: {},
session, handle: str, isGroup: bool, base_dir: str, session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int, http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], send_threads: [], postLog: [],
@ -2077,7 +2077,7 @@ def _receiveUndoAnnounce(recentPostsCache: {},
print("DEBUG: Attempt to undo something " + print("DEBUG: Attempt to undo something " +
"which isn't an announcement") "which isn't an announcement")
return False return False
undoAnnounceCollectionEntry(recentPostsCache, base_dir, postFilename, undoAnnounceCollectionEntry(recent_posts_cache, base_dir, postFilename,
message_json['actor'], domain, debug) message_json['actor'], domain, debug)
if os.path.isfile(postFilename): if os.path.isfile(postFilename):
try: 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, def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
http_prefix: str, handle: str, debug: bool, http_prefix: str, handle: str, debug: bool,
post_json_object: {}, recentPostsCache: {}, post_json_object: {}, recent_posts_cache: {},
session, onion_domain: str, session, onion_domain: str,
i2p_domain: str, port: int, i2p_domain: str, port: int,
federation_list: [], send_threads: [], postLog: [], federation_list: [], send_threads: [], postLog: [],
@ -3008,7 +3008,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
if not questionPostFilename: if not questionPostFilename:
return return
removePostFromCache(questionJson, recentPostsCache) removePostFromCache(questionJson, recent_posts_cache)
# ensure that the cached post is removed if it exists, so # ensure that the cached post is removed if it exists, so
# that it then will be recreated # that it then will be recreated
cachedPostFilename = \ cachedPostFilename = \
@ -3028,7 +3028,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(questionJson) notDM = not isDM(questionJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
nickname, domain, port, questionJson, nickname, domain, port, questionJson,
@ -3186,7 +3186,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
return 0 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: {}, session, keyId: str, handle: str, message_json: {},
base_dir: str, http_prefix: str, send_threads: [], base_dir: str, http_prefix: str, send_threads: [],
postLog: [], cached_webfingers: {}, person_cache: {}, postLog: [], cached_webfingers: {}, person_cache: {},
@ -3221,7 +3221,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
postIsDM = False postIsDM = False
isGroup = _groupHandle(base_dir, handle) isGroup = _groupHandle(base_dir, handle)
if _receiveLike(recentPostsCache, if _receiveLike(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3244,7 +3244,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Like accepted from ' + actor) print('DEBUG: Like accepted from ' + actor)
return False return False
if _receiveUndoLike(recentPostsCache, if _receiveUndoLike(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3266,7 +3266,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Undo like accepted from ' + actor) print('DEBUG: Undo like accepted from ' + actor)
return False return False
if _receiveReaction(recentPostsCache, if _receiveReaction(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3289,7 +3289,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Reaction accepted from ' + actor) print('DEBUG: Reaction accepted from ' + actor)
return False return False
if _receiveUndoReaction(recentPostsCache, if _receiveUndoReaction(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3311,7 +3311,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Undo reaction accepted from ' + actor) print('DEBUG: Undo reaction accepted from ' + actor)
return False return False
if _receiveBookmark(recentPostsCache, if _receiveBookmark(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3333,7 +3333,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
print('DEBUG: Bookmark accepted from ' + actor) print('DEBUG: Bookmark accepted from ' + actor)
return False return False
if _receiveUndoBookmark(recentPostsCache, if _receiveUndoBookmark(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3358,7 +3358,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if isCreateInsideAnnounce(message_json): if isCreateInsideAnnounce(message_json):
message_json = message_json['object'] message_json = message_json['object']
if _receiveAnnounce(recentPostsCache, if _receiveAnnounce(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, onion_domain, port, domain, onion_domain, port,
@ -3380,7 +3380,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if debug: if debug:
print('DEBUG: Announce accepted from ' + actor) print('DEBUG: Announce accepted from ' + actor)
if _receiveUndoAnnounce(recentPostsCache, if _receiveUndoAnnounce(recent_posts_cache,
session, handle, isGroup, session, handle, isGroup,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
@ -3403,7 +3403,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
message_json, message_json,
federation_list, federation_list,
debug, allow_deletion, debug, allow_deletion,
recentPostsCache): recent_posts_cache):
if debug: if debug:
print('DEBUG: Delete accepted from ' + actor) print('DEBUG: Delete accepted from ' + actor)
return False return False
@ -3460,7 +3460,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
_receiveQuestionVote(base_dir, nickname, domain, _receiveQuestionVote(base_dir, nickname, domain,
http_prefix, handle, debug, http_prefix, handle, debug,
post_json_object, recentPostsCache, post_json_object, recent_posts_cache,
session, onion_domain, i2p_domain, port, session, onion_domain, i2p_domain, port,
federation_list, send_threads, postLog, federation_list, send_threads, postLog,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -3512,7 +3512,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, debug, system_language, recent_posts_cache, debug, system_language,
domain_full, person_cache, signing_priv_key_pem): domain_full, person_cache, signing_priv_key_pem):
# media index will be updated # media index will be updated
updateIndexList.append('tlmedia') updateIndexList.append('tlmedia')
@ -3562,7 +3562,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
htmlCacheStartTime = time.time() htmlCacheStartTime = time.time()
handleName = handle.split('@')[0] handleName = handle.split('@')[0]
_inboxStorePostToHtmlCache(recentPostsCache, _inboxStorePostToHtmlCache(recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, base_dir, translate, base_dir,
http_prefix, http_prefix,
@ -3603,7 +3603,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if editedFilename: if editedFilename:
deletePost(base_dir, http_prefix, deletePost(base_dir, http_prefix,
nickname, domain, editedFilename, nickname, domain, editedFilename,
debug, recentPostsCache) debug, recent_posts_cache)
# store the id of the last post made by this actor # store the id of the last post made by this actor
_storeLastPostId(base_dir, nickname, domain, post_json_object) _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) signing_priv_key_pem)
def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, def runInboxQueue(recent_posts_cache: {}, max_recent_posts: int,
project_version: str, project_version: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
send_threads: [], postLog: [], send_threads: [], postLog: [],
@ -4417,7 +4417,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
queue.pop(0) queue.pop(0)
continue continue
if _receiveUpdate(recentPostsCache, session, if _receiveUpdate(recent_posts_cache, session,
base_dir, http_prefix, base_dir, http_prefix,
domain, port, domain, port,
send_threads, postLog, send_threads, postLog,
@ -4497,7 +4497,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
for handle, capsId in recipientsDict.items(): for handle, capsId in recipientsDict.items():
destination = \ destination = \
queueJson['destination'].replace(inboxHandle, handle) queueJson['destination'].replace(inboxHandle, handle)
_inboxAfterInitial(recentPostsCache, _inboxAfterInitial(recent_posts_cache,
max_recent_posts, max_recent_posts,
session, keyId, handle, session, keyId, handle,
queueJson['post'], queueJson['post'],

20
like.py
View File

@ -68,7 +68,7 @@ def likedByPerson(post_json_object: {}, nickname: str, domain: str) -> bool:
return False return False
def _like(recentPostsCache: {}, def _like(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
ccList: [], http_prefix: str, ccList: [], http_prefix: str,
@ -127,7 +127,7 @@ def _like(recentPostsCache: {},
print('DEBUG: like objectUrl: ' + objectUrl) print('DEBUG: like objectUrl: ' + objectUrl)
return None return None
updateLikesCollection(recentPostsCache, updateLikesCollection(recent_posts_cache,
base_dir, postFilename, objectUrl, base_dir, postFilename, objectUrl,
newLikeJson['actor'], newLikeJson['actor'],
nickname, domain, debug, None) nickname, domain, debug, None)
@ -144,7 +144,7 @@ def _like(recentPostsCache: {},
return newLikeJson return newLikeJson
def likePost(recentPostsCache: {}, def likePost(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
likeNickname: str, likeDomain: str, likePort: int, likeNickname: str, likeDomain: str, likePort: int,
@ -161,7 +161,7 @@ def likePost(recentPostsCache: {},
actorLiked = local_actor_url(http_prefix, likeNickname, likeDomain) actorLiked = local_actor_url(http_prefix, likeNickname, likeDomain)
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber) objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
return _like(recentPostsCache, return _like(recent_posts_cache,
session, base_dir, federation_list, nickname, domain, port, session, base_dir, federation_list, nickname, domain, port,
ccList, http_prefix, objectUrl, actorLiked, client_to_server, ccList, http_prefix, objectUrl, actorLiked, client_to_server,
send_threads, postLog, person_cache, cached_webfingers, send_threads, postLog, person_cache, cached_webfingers,
@ -339,7 +339,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
return newUndoLikeJson return newUndoLikeJson
def outboxLike(recentPostsCache: {}, def outboxLike(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: message_json: {}, debug: bool) -> None:
@ -366,7 +366,7 @@ def outboxLike(recentPostsCache: {},
print('DEBUG: c2s like post not found in inbox or outbox') print('DEBUG: c2s like post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
updateLikesCollection(recentPostsCache, updateLikesCollection(recent_posts_cache,
base_dir, postFilename, messageId, base_dir, postFilename, messageId,
message_json['actor'], message_json['actor'],
nickname, domain, debug, None) nickname, domain, debug, None)
@ -374,7 +374,7 @@ def outboxLike(recentPostsCache: {},
print('DEBUG: post liked via c2s - ' + postFilename) print('DEBUG: post liked via c2s - ' + postFilename)
def outboxUndoLike(recentPostsCache: {}, def outboxUndoLike(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: 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('DEBUG: c2s undo like post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
undoLikesCollectionEntry(recentPostsCache, base_dir, postFilename, undoLikesCollectionEntry(recent_posts_cache, base_dir, postFilename,
messageId, message_json['actor'], messageId, message_json['actor'],
domain, debug, None) domain, debug, None)
if debug: if debug:
print('DEBUG: post undo liked via c2s - ' + postFilename) print('DEBUG: post undo liked via c2s - ' + postFilename)
def updateLikesCollection(recentPostsCache: {}, def updateLikesCollection(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
objectUrl: str, actor: str, objectUrl: str, actor: str,
nickname: str, domain: str, debug: bool, nickname: str, domain: str, debug: bool,
@ -424,7 +424,7 @@ def updateLikesCollection(recentPostsCache: {},
# remove any cached version of this post so that the # remove any cached version of this post so that the
# like icon is changed # like icon is changed
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
cachedPostFilename = getCachedPostFilename(base_dir, nickname, cachedPostFilename = getCachedPostFilename(base_dir, nickname,
domain, post_json_object) domain, post_json_object)
if cachedPostFilename: if cachedPostFilename:

View File

@ -538,7 +538,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
domain: str, port: int, domain: str, port: int,
newswire: {}, newswire: {},
translate: {}, translate: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
session, cached_webfingers: {}, session, cached_webfingers: {},
person_cache: {}, person_cache: {},
federation_list: [], federation_list: [],
@ -730,7 +730,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
http_prefix, domain_full, http_prefix, domain_full,
blog, translate) blog, translate)
clearFromPostCaches(base_dir, recentPostsCache, post_id) clearFromPostCaches(base_dir, recent_posts_cache, post_id)
if save_json(blog, filename): if save_json(blog, filename):
_updateFeedsOutboxIndex(base_dir, domain, post_id + '.json') _updateFeedsOutboxIndex(base_dir, domain, post_id + '.json')
@ -826,7 +826,7 @@ def runNewswireDaemon(base_dir: str, httpd,
_convertRSStoActivityPub(base_dir, _convertRSStoActivityPub(base_dir,
http_prefix, domain, port, http_prefix, domain, port,
newNewswire, translate, newNewswire, translate,
httpd.recentPostsCache, httpd.recent_posts_cache,
httpd.max_recent_posts, httpd.max_recent_posts,
httpd.session, httpd.session,
httpd.cached_webfingers, httpd.cached_webfingers,
@ -849,7 +849,7 @@ def runNewswireDaemon(base_dir: str, httpd,
archivePostsForPerson(http_prefix, 'news', archivePostsForPerson(http_prefix, 'news',
domain, base_dir, 'outbox', domain, base_dir, 'outbox',
archiveSubdir, archiveSubdir,
httpd.recentPostsCache, httpd.recent_posts_cache,
httpd.max_news_posts) httpd.max_news_posts)
# wait a while before the next feeds update # wait a while before the next feeds update

View File

@ -58,7 +58,7 @@ from shares import outboxUndoShareUpload
from webapp_post import individualPostAsHtml from webapp_post import individualPostAsHtml
def _outboxPersonReceiveUpdate(recentPostsCache: {}, def _outboxPersonReceiveUpdate(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: message_json: {}, debug: bool) -> None:
@ -182,7 +182,7 @@ def postMessageToOutbox(session, translate: {},
server, base_dir: str, http_prefix: str, server, base_dir: str, http_prefix: str,
domain: str, domain_full: str, domain: str, domain_full: str,
onion_domain: str, i2p_domain: str, port: int, onion_domain: str, i2p_domain: str, port: int,
recentPostsCache: {}, followers_threads: [], recent_posts_cache: {}, followers_threads: [],
federation_list: [], send_threads: [], federation_list: [], send_threads: [],
postLog: [], cached_webfingers: {}, postLog: [], cached_webfingers: {},
person_cache: {}, allow_deletion: bool, person_cache: {}, allow_deletion: bool,
@ -427,7 +427,7 @@ def postMessageToOutbox(session, translate: {},
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, debug, system_language, recent_posts_cache, debug, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem): signing_priv_key_pem):
inboxUpdateIndex('tlmedia', base_dir, inboxUpdateIndex('tlmedia', base_dir,
@ -454,7 +454,7 @@ def postMessageToOutbox(session, translate: {},
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
postToNickname, domain) postToNickname, domain)
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
False, recentPostsCache, False, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, pageNumber, translate, pageNumber,
base_dir, session, base_dir, session,
@ -478,7 +478,7 @@ def postMessageToOutbox(session, translate: {},
False, True, useCacheOnly, False, True, useCacheOnly,
cw_lists, lists_enabled) cw_lists, lists_enabled)
if outboxAnnounce(recentPostsCache, if outboxAnnounce(recent_posts_cache,
base_dir, message_json, debug): base_dir, message_json, debug):
if debug: if debug:
print('DEBUG: Updated announcements (shares) collection ' + print('DEBUG: Updated announcements (shares) collection ' +
@ -541,46 +541,46 @@ def postMessageToOutbox(session, translate: {},
if debug: if debug:
print('DEBUG: handle any like requests') print('DEBUG: handle any like requests')
outboxLike(recentPostsCache, outboxLike(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any undo like requests') print('DEBUG: handle any undo like requests')
outboxUndoLike(recentPostsCache, outboxUndoLike(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any emoji reaction requests') print('DEBUG: handle any emoji reaction requests')
outboxReaction(recentPostsCache, outboxReaction(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any undo emoji reaction requests') print('DEBUG: handle any undo emoji reaction requests')
outboxUndoReaction(recentPostsCache, outboxUndoReaction(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any undo announce requests') print('DEBUG: handle any undo announce requests')
outboxUndoAnnounce(recentPostsCache, outboxUndoAnnounce(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any bookmark requests') print('DEBUG: handle any bookmark requests')
outboxBookmark(recentPostsCache, outboxBookmark(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
if debug: if debug:
print('DEBUG: handle any undo bookmark requests') print('DEBUG: handle any undo bookmark requests')
outboxUndoBookmark(recentPostsCache, outboxUndoBookmark(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)
@ -591,7 +591,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain, postToNickname, domain,
message_json, debug, message_json, debug,
allow_deletion, allow_deletion,
recentPostsCache) recent_posts_cache)
if debug: if debug:
print('DEBUG: handle block requests') print('DEBUG: handle block requests')
@ -612,7 +612,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain, postToNickname, domain,
port, port,
message_json, debug, message_json, debug,
recentPostsCache) recent_posts_cache)
if debug: if debug:
print('DEBUG: handle undo mute requests') print('DEBUG: handle undo mute requests')
@ -620,7 +620,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname, domain, postToNickname, domain,
port, port,
message_json, debug, message_json, debug,
recentPostsCache) recent_posts_cache)
if debug: if debug:
print('DEBUG: handle share uploads') print('DEBUG: handle share uploads')
@ -637,7 +637,7 @@ def postMessageToOutbox(session, translate: {},
if debug: if debug:
print('DEBUG: handle actor updates from c2s') print('DEBUG: handle actor updates from c2s')
_outboxPersonReceiveUpdate(recentPostsCache, _outboxPersonReceiveUpdate(recent_posts_cache,
base_dir, http_prefix, base_dir, http_prefix,
postToNickname, domain, port, postToNickname, domain, port,
message_json, debug) message_json, debug)

View File

@ -898,7 +898,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
return personJson return personJson
def personBoxJson(recentPostsCache: {}, def personBoxJson(recent_posts_cache: {},
session, base_dir: str, domain: str, port: int, path: str, session, base_dir: str, domain: str, port: int, path: str,
http_prefix: str, noOfItems: int, boxname: str, http_prefix: str, noOfItems: int, boxname: str,
authorized: bool, authorized: bool,
@ -949,12 +949,12 @@ def personBoxJson(recentPostsCache: {},
if not validNickname(domain, nickname): if not validNickname(domain, nickname):
return None return None
if boxname == 'inbox': if boxname == 'inbox':
return createInbox(recentPostsCache, return createInbox(recent_posts_cache,
session, base_dir, nickname, domain, port, session, base_dir, nickname, domain, port,
http_prefix, http_prefix,
noOfItems, headerOnly, pageNumber) noOfItems, headerOnly, pageNumber)
elif boxname == 'dm': elif boxname == 'dm':
return createDMTimeline(recentPostsCache, return createDMTimeline(recent_posts_cache,
session, base_dir, nickname, domain, port, session, base_dir, nickname, domain, port,
http_prefix, http_prefix,
noOfItems, headerOnly, pageNumber) noOfItems, headerOnly, pageNumber)
@ -964,7 +964,7 @@ def personBoxJson(recentPostsCache: {},
noOfItems, headerOnly, noOfItems, headerOnly,
pageNumber) pageNumber)
elif boxname == 'tlreplies': elif boxname == 'tlreplies':
return createRepliesTimeline(recentPostsCache, return createRepliesTimeline(recent_posts_cache,
session, base_dir, nickname, domain, session, base_dir, nickname, domain,
port, http_prefix, port, http_prefix,
noOfItems, headerOnly, noOfItems, headerOnly,

View File

@ -3301,11 +3301,11 @@ def sendToFollowersThread(session, base_dir: str,
return sendThread return sendThread
def createInbox(recentPostsCache: {}, def createInbox(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str, port: int, session, base_dir: str, nickname: str, domain: str, port: int,
http_prefix: str, itemsPerPage: int, headerOnly: bool, http_prefix: str, itemsPerPage: int, headerOnly: bool,
pageNumber: int) -> {}: pageNumber: int) -> {}:
return _createBoxIndexed(recentPostsCache, return _createBoxIndexed(recent_posts_cache,
session, base_dir, 'inbox', session, base_dir, 'inbox',
nickname, domain, port, http_prefix, nickname, domain, port, http_prefix,
itemsPerPage, headerOnly, True, itemsPerPage, headerOnly, True,
@ -3321,21 +3321,21 @@ def createBookmarksTimeline(session, base_dir: str, nickname: str, domain: str,
True, 0, False, 0, pageNumber) True, 0, False, 0, pageNumber)
def createDMTimeline(recentPostsCache: {}, def createDMTimeline(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str, session, base_dir: str, nickname: str, domain: str,
port: int, http_prefix: str, itemsPerPage: int, port: int, http_prefix: str, itemsPerPage: int,
headerOnly: bool, pageNumber: int) -> {}: headerOnly: bool, pageNumber: int) -> {}:
return _createBoxIndexed(recentPostsCache, return _createBoxIndexed(recent_posts_cache,
session, base_dir, 'dm', nickname, session, base_dir, 'dm', nickname,
domain, port, http_prefix, itemsPerPage, domain, port, http_prefix, itemsPerPage,
headerOnly, True, 0, False, 0, pageNumber) headerOnly, True, 0, False, 0, pageNumber)
def createRepliesTimeline(recentPostsCache: {}, def createRepliesTimeline(recent_posts_cache: {},
session, base_dir: str, nickname: str, domain: str, session, base_dir: str, nickname: str, domain: str,
port: int, http_prefix: str, itemsPerPage: int, port: int, http_prefix: str, itemsPerPage: int,
headerOnly: bool, pageNumber: 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, nickname, domain, port, http_prefix,
itemsPerPage, headerOnly, True, itemsPerPage, headerOnly, True,
0, False, 0, pageNumber) 0, False, 0, pageNumber)
@ -3462,7 +3462,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
yt_replace_domain: str, yt_replace_domain: str,
twitter_replacement_domain: str, twitter_replacement_domain: str,
allow_local_network_access: bool, allow_local_network_access: bool,
recentPostsCache: {}, debug: bool, recent_posts_cache: {}, debug: bool,
system_language: str, system_language: str,
domain_full: str, person_cache: {}, domain_full: str, person_cache: {},
signing_priv_key_pem: str) -> bool: signing_priv_key_pem: str) -> bool:
@ -3477,7 +3477,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, debug, recent_posts_cache, debug,
system_language, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem, signing_priv_key_pem,
@ -3655,7 +3655,7 @@ def _passedNewswireVoting(newswire_votes_threshold: int,
return True return True
def _createBoxIndexed(recentPostsCache: {}, def _createBoxIndexed(recent_posts_cache: {},
session, base_dir: str, boxname: str, session, base_dir: str, boxname: str,
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
itemsPerPage: int, headerOnly: bool, authorized: bool, itemsPerPage: int, headerOnly: bool, authorized: bool,
@ -3765,10 +3765,10 @@ def _createBoxIndexed(recentPostsCache: {},
continue continue
# is the post cached in memory? # is the post cached in memory?
if recentPostsCache.get('index'): if recent_posts_cache.get('index'):
if postUrl in recentPostsCache['index']: if postUrl in recent_posts_cache['index']:
if recentPostsCache['json'].get(postUrl): if recent_posts_cache['json'].get(postUrl):
url = recentPostsCache['json'][postUrl] url = recent_posts_cache['json'][postUrl]
if _addPostStringToTimeline(url, if _addPostStringToTimeline(url,
boxname, postsInBox, boxname, postsInBox,
boxActor): boxActor):
@ -3879,7 +3879,7 @@ def _createBoxIndexed(recentPostsCache: {},
def expireCache(base_dir: str, person_cache: {}, def expireCache(base_dir: str, person_cache: {},
http_prefix: str, archive_dir: str, http_prefix: str, archive_dir: str,
recentPostsCache: {}, recent_posts_cache: {},
maxPostsInBox=32000): maxPostsInBox=32000):
"""Thread used to expire actors from the cache and archive old posts """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 # once per day
time.sleep(60 * 60 * 24) time.sleep(60 * 60 * 24)
expirePersonCache(person_cache) expirePersonCache(person_cache)
archivePosts(base_dir, http_prefix, archive_dir, recentPostsCache, archivePosts(base_dir, http_prefix, archive_dir, recent_posts_cache,
maxPostsInBox) maxPostsInBox)
def archivePosts(base_dir: str, http_prefix: str, archive_dir: str, def archivePosts(base_dir: str, http_prefix: str, archive_dir: str,
recentPostsCache: {}, recent_posts_cache: {},
maxPostsInBox=32000) -> None: maxPostsInBox=32000) -> None:
"""Archives posts for all accounts """Archives posts for all accounts
""" """
@ -3928,20 +3928,20 @@ def archivePosts(base_dir: str, http_prefix: str, archive_dir: str,
handle + '/inbox' handle + '/inbox'
archivePostsForPerson(http_prefix, nickname, domain, base_dir, archivePostsForPerson(http_prefix, nickname, domain, base_dir,
'inbox', archiveSubdir, 'inbox', archiveSubdir,
recentPostsCache, maxPostsInBox) recent_posts_cache, maxPostsInBox)
if archive_dir: if archive_dir:
archiveSubdir = archive_dir + '/accounts/' + \ archiveSubdir = archive_dir + '/accounts/' + \
handle + '/outbox' handle + '/outbox'
archivePostsForPerson(http_prefix, nickname, domain, base_dir, archivePostsForPerson(http_prefix, nickname, domain, base_dir,
'outbox', archiveSubdir, 'outbox', archiveSubdir,
recentPostsCache, maxPostsInBox) recent_posts_cache, maxPostsInBox)
break break
def archivePostsForPerson(http_prefix: str, nickname: str, domain: str, def archivePostsForPerson(http_prefix: str, nickname: str, domain: str,
base_dir: str, base_dir: str,
boxname: str, archive_dir: str, boxname: str, archive_dir: str,
recentPostsCache: {}, recent_posts_cache: {},
maxPostsInBox=32000) -> None: maxPostsInBox=32000) -> None:
"""Retain a maximum number of posts within the given box """Retain a maximum number of posts within the given box
Move any others to an archive directory 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)) archivePath.replace('.json', '.json.' + ext))
else: else:
deletePost(base_dir, http_prefix, nickname, domain, deletePost(base_dir, http_prefix, nickname, domain,
filePath, False, recentPostsCache) filePath, False, recent_posts_cache)
# remove cached html posts # remove cached html posts
postCacheFilename = \ postCacheFilename = \
@ -4497,10 +4497,10 @@ def populateRepliesJson(base_dir: str, nickname: str, domain: str,
def _rejectAnnounce(announceFilename: str, def _rejectAnnounce(announceFilename: str,
base_dir: str, nickname: str, domain: str, base_dir: str, nickname: str, domain: str,
announcePostId: str, recentPostsCache: {}): announcePostId: str, recent_posts_cache: {}):
"""Marks an announce as rejected """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 # reject the post referenced by the announce activity object
if not os.path.isfile(announceFilename + '.reject'): if not os.path.isfile(announceFilename + '.reject'):
@ -4515,7 +4515,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
yt_replace_domain: str, yt_replace_domain: str,
twitter_replacement_domain: str, twitter_replacement_domain: str,
allow_local_network_access: bool, allow_local_network_access: bool,
recentPostsCache: {}, debug: bool, recent_posts_cache: {}, debug: bool,
system_language: str, system_language: str,
domain_full: str, person_cache: {}, domain_full: str, person_cache: {},
signing_priv_key_pem: str, signing_priv_key_pem: str,
@ -4612,17 +4612,17 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
post_json_object['object']) post_json_object['object'])
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not announcedJson.get('id'): if not announcedJson.get('id'):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not announcedJson.get('type'): if not announcedJson.get('type'):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if announcedJson['type'] == 'Video': if announcedJson['type'] == 'Video':
convertedJson = \ convertedJson = \
@ -4634,12 +4634,12 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
if '/statuses/' not in announcedJson['id']: if '/statuses/' not in announcedJson['id']:
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not has_users_path(announcedJson['id']): if not has_users_path(announcedJson['id']):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if announcedJson['type'] != 'Note' and \ if announcedJson['type'] != 'Note' and \
announcedJson['type'] != 'Page' 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 # You can only announce Note or Article types
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not announcedJson.get('content'): if not announcedJson.get('content'):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not announcedJson.get('published'): if not announcedJson.get('published'):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not valid_post_date(announcedJson['published'], 90, debug): if not valid_post_date(announcedJson['published'], 90, debug):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if not understoodPostLanguage(base_dir, nickname, domain, if not understoodPostLanguage(base_dir, nickname, domain,
announcedJson, system_language, announcedJson, system_language,
@ -4674,19 +4674,19 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
if dangerousMarkup(contentStr, allow_local_network_access): if dangerousMarkup(contentStr, allow_local_network_access):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if isFiltered(base_dir, nickname, domain, contentStr): if isFiltered(base_dir, nickname, domain, contentStr):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
if invalid_ciphertext(contentStr): if invalid_ciphertext(contentStr):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
print('WARN: Invalid ciphertext within announce ' + print('WARN: Invalid ciphertext within announce ' +
str(announcedJson)) str(announcedJson))
return None return None
@ -4712,7 +4712,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
# Create wrap failed # Create wrap failed
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
# labelAccusatoryPost(post_json_object, translate) # labelAccusatoryPost(post_json_object, translate)
@ -4731,7 +4731,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
attributedNickname, attributedDomain): attributedNickname, attributedDomain):
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recentPostsCache) recent_posts_cache)
return None return None
post_json_object = announcedJson post_json_object = announcedJson
replaceYouTube(post_json_object, yt_replace_domain, system_language) replaceYouTube(post_json_object, yt_replace_domain, system_language)

View File

@ -60,7 +60,7 @@ def validEmojiContent(emojiContent: str) -> bool:
return True return True
def _reaction(recentPostsCache: {}, def _reaction(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
ccList: [], http_prefix: str, ccList: [], http_prefix: str,
@ -126,7 +126,7 @@ def _reaction(recentPostsCache: {},
print('DEBUG: reaction objectUrl: ' + objectUrl) print('DEBUG: reaction objectUrl: ' + objectUrl)
return None return None
updateReactionCollection(recentPostsCache, updateReactionCollection(recent_posts_cache,
base_dir, postFilename, objectUrl, base_dir, postFilename, objectUrl,
newReactionJson['actor'], newReactionJson['actor'],
nickname, domain, debug, None, nickname, domain, debug, None,
@ -145,7 +145,7 @@ def _reaction(recentPostsCache: {},
return newReactionJson return newReactionJson
def reactionPost(recentPostsCache: {}, def reactionPost(recent_posts_cache: {},
session, base_dir: str, federation_list: [], session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
reactionNickname: str, reactionDomain: str, reactionPort: int, reactionNickname: str, reactionDomain: str, reactionPort: int,
@ -164,7 +164,7 @@ def reactionPost(recentPostsCache: {},
local_actor_url(http_prefix, reactionNickname, reactionDomain) local_actor_url(http_prefix, reactionNickname, reactionDomain)
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber) objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
return _reaction(recentPostsCache, return _reaction(recent_posts_cache,
session, base_dir, federation_list, session, base_dir, federation_list,
nickname, domain, port, nickname, domain, port,
ccList, http_prefix, objectUrl, emojiContent, ccList, http_prefix, objectUrl, emojiContent,
@ -354,7 +354,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
return newUndoReactionJson return newUndoReactionJson
def outboxReaction(recentPostsCache: {}, def outboxReaction(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: message_json: {}, debug: bool) -> None:
@ -390,7 +390,7 @@ def outboxReaction(recentPostsCache: {},
print('DEBUG: c2s reaction post not found in inbox or outbox') print('DEBUG: c2s reaction post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
updateReactionCollection(recentPostsCache, updateReactionCollection(recent_posts_cache,
base_dir, postFilename, messageId, base_dir, postFilename, messageId,
message_json['actor'], message_json['actor'],
nickname, domain, debug, None, emojiContent) nickname, domain, debug, None, emojiContent)
@ -398,7 +398,7 @@ def outboxReaction(recentPostsCache: {},
print('DEBUG: post reaction via c2s - ' + postFilename) print('DEBUG: post reaction via c2s - ' + postFilename)
def outboxUndoReaction(recentPostsCache: {}, def outboxUndoReaction(recent_posts_cache: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
message_json: {}, debug: bool) -> None: 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('DEBUG: c2s undo reaction post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
undoReactionCollectionEntry(recentPostsCache, base_dir, postFilename, undoReactionCollectionEntry(recent_posts_cache, base_dir, postFilename,
messageId, message_json['actor'], messageId, message_json['actor'],
domain, debug, None, emojiContent) domain, debug, None, emojiContent)
if debug: if debug:
print('DEBUG: post undo reaction via c2s - ' + postFilename) print('DEBUG: post undo reaction via c2s - ' + postFilename)
def updateReactionCollection(recentPostsCache: {}, def updateReactionCollection(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
objectUrl: str, actor: str, objectUrl: str, actor: str,
nickname: str, domain: str, debug: bool, nickname: str, domain: str, debug: bool,
@ -454,7 +454,7 @@ def updateReactionCollection(recentPostsCache: {},
# remove any cached version of this post so that the # remove any cached version of this post so that the
# reaction icon is changed # reaction icon is changed
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
cachedPostFilename = getCachedPostFilename(base_dir, nickname, cachedPostFilename = getCachedPostFilename(base_dir, nickname,
domain, post_json_object) domain, post_json_object)
if cachedPostFilename: if cachedPostFilename:

View File

@ -103,7 +103,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.onion_domain, httpd.onion_domain,
httpd.i2p_domain, httpd.i2p_domain,
httpd.port, httpd.port,
httpd.recentPostsCache, httpd.recent_posts_cache,
httpd.followers_threads, httpd.followers_threads,
httpd.federation_list, httpd.federation_list,
httpd.send_threads, httpd.send_threads,

View File

@ -3531,18 +3531,18 @@ def _testTheme():
def _testRecentPostsCache(): def _testRecentPostsCache():
print('testRecentPostsCache') print('testRecentPostsCache')
recentPostsCache = {} recent_posts_cache = {}
max_recent_posts = 3 max_recent_posts = 3
htmlStr = '<html></html>' htmlStr = '<html></html>'
for i in range(5): for i in range(5):
post_json_object = { post_json_object = {
"id": "https://somesite.whatever/users/someuser/statuses/" + str(i) "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) post_json_object, htmlStr)
assert len(recentPostsCache['index']) == max_recent_posts assert len(recent_posts_cache['index']) == max_recent_posts
assert len(recentPostsCache['json'].items()) == max_recent_posts assert len(recent_posts_cache['json'].items()) == max_recent_posts
assert len(recentPostsCache['html'].items()) == max_recent_posts assert len(recent_posts_cache['html'].items()) == max_recent_posts
def _testRemoveTextFormatting(): def _testRemoveTextFormatting():

124
utils.py
View File

@ -1293,7 +1293,7 @@ def locateNewsArrival(base_dir: str, domain: str,
return None return None
def clearFromPostCaches(base_dir: str, recentPostsCache: {}, def clearFromPostCaches(base_dir: str, recent_posts_cache: {},
post_id: str) -> None: post_id: str) -> None:
"""Clears cached html for the given post, so that edits """Clears cached html for the given post, so that edits
to news will appear to news will appear
@ -1314,15 +1314,15 @@ def clearFromPostCaches(base_dir: str, recentPostsCache: {},
print('EX: clearFromPostCaches file not removed ' + print('EX: clearFromPostCaches file not removed ' +
str(postFilename)) str(postFilename))
# if the post is in the recent posts cache then remove it # if the post is in the recent posts cache then remove it
if recentPostsCache.get('index'): if recent_posts_cache.get('index'):
if post_id in recentPostsCache['index']: if post_id in recent_posts_cache['index']:
recentPostsCache['index'].remove(post_id) recent_posts_cache['index'].remove(post_id)
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
if recentPostsCache['json'].get(post_id): if recent_posts_cache['json'].get(post_id):
del recentPostsCache['json'][post_id] del recent_posts_cache['json'][post_id]
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
del recentPostsCache['html'][post_id] del recent_posts_cache['html'][post_id]
break 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, def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
http_prefix: str, postFilename: str, http_prefix: str, postFilename: str,
recentPostsCache: {}, debug: bool) -> None: recent_posts_cache: {}, debug: bool) -> None:
"""Removes replies when deleting a post """Removes replies when deleting a post
""" """
repliesFilename = postFilename.replace('.json', '.replies') repliesFilename = postFilename.replace('.json', '.replies')
@ -1545,7 +1545,7 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
if os.path.isfile(replyFile): if os.path.isfile(replyFile):
deletePost(base_dir, http_prefix, deletePost(base_dir, http_prefix,
nickname, domain, replyFile, debug, nickname, domain, replyFile, debug,
recentPostsCache) recent_posts_cache)
# remove the replies file # remove the replies file
try: try:
os.remove(repliesFilename) os.remove(repliesFilename)
@ -1567,36 +1567,36 @@ def _isBookmarked(base_dir: str, nickname: str, domain: str,
return False 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 the post exists in the recent posts cache then remove it
""" """
if not recentPostsCache: if not recent_posts_cache:
return return
if not post_json_object.get('id'): if not post_json_object.get('id'):
return return
if not recentPostsCache.get('index'): if not recent_posts_cache.get('index'):
return return
post_id = post_json_object['id'] post_id = post_json_object['id']
if '#' in post_id: if '#' in post_id:
post_id = post_id.split('#', 1)[0] post_id = post_id.split('#', 1)[0]
post_id = removeIdEnding(post_id).replace('/', '#') post_id = removeIdEnding(post_id).replace('/', '#')
if post_id not in recentPostsCache['index']: if post_id not in recent_posts_cache['index']:
return return
if recentPostsCache.get('index'): if recent_posts_cache.get('index'):
if post_id in recentPostsCache['index']: if post_id in recent_posts_cache['index']:
recentPostsCache['index'].remove(post_id) recent_posts_cache['index'].remove(post_id)
if recentPostsCache.get('json'): if recent_posts_cache.get('json'):
if recentPostsCache['json'].get(post_id): if recent_posts_cache['json'].get(post_id):
del recentPostsCache['json'][post_id] del recent_posts_cache['json'][post_id]
if recentPostsCache.get('html'): if recent_posts_cache.get('html'):
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
del recentPostsCache['html'][post_id] del recent_posts_cache['html'][post_id]
def _deleteCachedHtml(base_dir: str, nickname: str, domain: str, 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, def deletePost(base_dir: str, http_prefix: str,
nickname: str, domain: str, postFilename: 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 """Recursively deletes a post and its replies and attachments
""" """
post_json_object = load_json(postFilename, 1) post_json_object = load_json(postFilename, 1)
@ -1721,7 +1721,7 @@ def deletePost(base_dir: str, http_prefix: str,
# remove any replies # remove any replies
_deletePostRemoveReplies(base_dir, nickname, domain, _deletePostRemoveReplies(base_dir, nickname, domain,
http_prefix, postFilename, http_prefix, postFilename,
recentPostsCache, debug) recent_posts_cache, debug)
# finally, remove the post itself # finally, remove the post itself
try: try:
os.remove(postFilename) os.remove(postFilename)
@ -1741,7 +1741,7 @@ def deletePost(base_dir: str, http_prefix: str,
return return
# remove from recent posts cache in memory # remove from recent posts cache in memory
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
# remove from conversation index # remove from conversation index
_deleteConversationPost(base_dir, nickname, domain, post_json_object) _deleteConversationPost(base_dir, nickname, domain, post_json_object)
@ -1781,7 +1781,7 @@ def deletePost(base_dir: str, http_prefix: str,
# remove any replies # remove any replies
_deletePostRemoveReplies(base_dir, nickname, domain, _deletePostRemoveReplies(base_dir, nickname, domain,
http_prefix, postFilename, http_prefix, postFilename,
recentPostsCache, debug) recent_posts_cache, debug)
# finally, remove the post itself # finally, remove the post itself
try: try:
os.remove(postFilename) os.remove(postFilename)
@ -2007,7 +2007,7 @@ def getCachedPostFilename(base_dir: str, nickname: str, domain: str,
return cachedPostFilename + '.html' 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: post_json_object: {}, htmlStr: str) -> None:
"""Store recent posts in memory so that they can be quickly recalled """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: if '#' in post_id:
post_id = post_id.split('#', 1)[0] post_id = post_id.split('#', 1)[0]
post_id = removeIdEnding(post_id).replace('/', '#') post_id = removeIdEnding(post_id).replace('/', '#')
if recentPostsCache.get('index'): if recent_posts_cache.get('index'):
if post_id in recentPostsCache['index']: if post_id in recent_posts_cache['index']:
return return
recentPostsCache['index'].append(post_id) recent_posts_cache['index'].append(post_id)
post_json_object['muted'] = False post_json_object['muted'] = False
recentPostsCache['json'][post_id] = json.dumps(post_json_object) recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
recentPostsCache['html'][post_id] = htmlStr recent_posts_cache['html'][post_id] = htmlStr
while len(recentPostsCache['html'].items()) > max_recent_posts: while len(recent_posts_cache['html'].items()) > max_recent_posts:
post_id = recentPostsCache['index'][0] post_id = recent_posts_cache['index'][0]
recentPostsCache['index'].pop(0) recent_posts_cache['index'].pop(0)
if recentPostsCache['json'].get(post_id): if recent_posts_cache['json'].get(post_id):
del recentPostsCache['json'][post_id] del recent_posts_cache['json'][post_id]
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
del recentPostsCache['html'][post_id] del recent_posts_cache['html'][post_id]
else: else:
recentPostsCache['index'] = [post_id] recent_posts_cache['index'] = [post_id]
recentPostsCache['json'] = {} recent_posts_cache['json'] = {}
recentPostsCache['html'] = {} recent_posts_cache['html'] = {}
recentPostsCache['json'][post_id] = json.dumps(post_json_object) recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
recentPostsCache['html'][post_id] = htmlStr recent_posts_cache['html'][post_id] = htmlStr
def fileLastModified(filename: str) -> str: def fileLastModified(filename: str) -> str:
@ -2207,7 +2207,7 @@ def getFileCaseInsensitive(path: str) -> str:
return None return None
def undoLikesCollectionEntry(recentPostsCache: {}, def undoLikesCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str, objectUrl: str, base_dir: str, postFilename: str, objectUrl: str,
actor: str, domain: str, debug: bool, actor: str, domain: str, debug: bool,
post_json_object: {}) -> None: post_json_object: {}) -> None:
@ -2230,7 +2230,7 @@ def undoLikesCollectionEntry(recentPostsCache: {},
print('EX: undoLikesCollectionEntry ' + print('EX: undoLikesCollectionEntry ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'): if not post_json_object.get('type'):
return return
@ -2270,7 +2270,7 @@ def undoLikesCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename) save_json(post_json_object, postFilename)
def undoReactionCollectionEntry(recentPostsCache: {}, def undoReactionCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
objectUrl: str, objectUrl: str,
actor: str, domain: str, debug: bool, actor: str, domain: str, debug: bool,
@ -2295,7 +2295,7 @@ def undoReactionCollectionEntry(recentPostsCache: {},
print('EX: undoReactionCollectionEntry ' + print('EX: undoReactionCollectionEntry ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'): if not post_json_object.get('type'):
return return
@ -2336,7 +2336,7 @@ def undoReactionCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename) save_json(post_json_object, postFilename)
def undoAnnounceCollectionEntry(recentPostsCache: {}, def undoAnnounceCollectionEntry(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
actor: str, domain: str, debug: bool) -> None: actor: str, domain: str, debug: bool) -> None:
"""Undoes an announce for a particular actor by removing it from """Undoes an announce for a particular actor by removing it from
@ -2361,7 +2361,7 @@ def undoAnnounceCollectionEntry(recentPostsCache: {},
print('EX: undoAnnounceCollectionEntry ' + print('EX: undoAnnounceCollectionEntry ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
if not post_json_object.get('type'): if not post_json_object.get('type'):
return return
@ -2403,7 +2403,7 @@ def undoAnnounceCollectionEntry(recentPostsCache: {},
save_json(post_json_object, postFilename) save_json(post_json_object, postFilename)
def updateAnnounceCollection(recentPostsCache: {}, def updateAnnounceCollection(recent_posts_cache: {},
base_dir: str, postFilename: str, base_dir: str, postFilename: str,
actor: str, actor: str,
nickname: str, domain: str, debug: bool) -> None: nickname: str, domain: str, debug: bool) -> None:
@ -2428,7 +2428,7 @@ def updateAnnounceCollection(recentPostsCache: {},
print('EX: updateAnnounceCollection ' + print('EX: updateAnnounceCollection ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cachedPostFilename)) str(cachedPostFilename))
removePostFromCache(post_json_object, recentPostsCache) removePostFromCache(post_json_object, recent_posts_cache)
if not has_object_dict(post_json_object): if not has_object_dict(post_json_object):
if debug: if debug:
@ -2555,7 +2555,7 @@ def camelCaseSplit(text: str) -> str:
def rejectPostId(base_dir: str, nickname: str, domain: 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, """ Marks the given post as rejected,
for example an announce which is too old for example an announce which is too old
""" """
@ -2563,7 +2563,7 @@ def rejectPostId(base_dir: str, nickname: str, domain: str,
if not postFilename: if not postFilename:
return return
if recentPostsCache.get('index'): if recent_posts_cache.get('index'):
# if this is a full path then remove the directories # if this is a full path then remove the directories
indexFilename = postFilename indexFilename = postFilename
if '/' in postFilename: if '/' in postFilename:
@ -2576,11 +2576,11 @@ def rejectPostId(base_dir: str, nickname: str, domain: str,
indexFilename.replace('\n', '').replace('\r', '') indexFilename.replace('\n', '').replace('\r', '')
postUrl = postUrl.replace('.json', '').strip() postUrl = postUrl.replace('.json', '').strip()
if postUrl in recentPostsCache['index']: if postUrl in recent_posts_cache['index']:
if recentPostsCache['json'].get(postUrl): if recent_posts_cache['json'].get(postUrl):
del recentPostsCache['json'][postUrl] del recent_posts_cache['json'][postUrl]
if recentPostsCache['html'].get(postUrl): if recent_posts_cache['html'].get(postUrl):
del recentPostsCache['html'][postUrl] del recent_posts_cache['html'][postUrl]
with open(postFilename + '.reject', 'w+') as rejectFile: with open(postFilename + '.reject', 'w+') as rejectFile:
rejectFile.write('\n') rejectFile.write('\n')

View File

@ -24,7 +24,7 @@ from webapp_post import individualPostAsHtml
def htmlConfirmDelete(cssCache: {}, def htmlConfirmDelete(cssCache: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate, pageNumber: int, translate, pageNumber: int,
session, base_dir: str, messageId: str, session, base_dir: str, messageId: str,
http_prefix: str, project_version: str, http_prefix: str, project_version: str,
@ -66,7 +66,7 @@ def htmlConfirmDelete(cssCache: {},
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None) htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
deletePostStr += \ deletePostStr += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts, True, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
base_dir, session, base_dir, session,
cached_webfingers, person_cache, cached_webfingers, person_cache,

View File

@ -197,7 +197,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
theme: str, noDropDown: bool, theme: str, noDropDown: bool,
accessKeys: {}, customSubmitText: str, accessKeys: {}, customSubmitText: str,
conversationId: str, conversationId: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
session, cached_webfingers: {}, session, cached_webfingers: {},
person_cache: {}, port: int, person_cache: {}, port: int,
post_json_object: {}, post_json_object: {},
@ -260,7 +260,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
if post_json_object: if post_json_object:
newPostText += \ newPostText += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, base_dir, session,

View File

@ -22,7 +22,7 @@ from webapp_column_right import getRightColumnContent
from webapp_post import individualPostAsHtml from webapp_post import individualPostAsHtml
def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int, def _htmlFrontScreenPosts(recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
@ -65,7 +65,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
if item['type'] == 'Create': if item['type'] == 'Create':
postStr = \ postStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, base_dir, session,
@ -97,7 +97,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
rss_icon_at_top: bool, rss_icon_at_top: bool,
cssCache: {}, icons_as_buttons: bool, cssCache: {}, icons_as_buttons: bool,
defaultTimeline: str, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, project_version: str, translate: {}, project_version: str,
base_dir: str, http_prefix: str, authorized: bool, base_dir: str, http_prefix: str, authorized: bool,
profile_json: {}, selected: str, profile_json: {}, selected: str,
@ -173,7 +173,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
bannerFile, bannerFilename = \ bannerFile, bannerFilename = \
getBannerFile(base_dir, nickname, domain, theme) getBannerFile(base_dir, nickname, domain, theme)
profileStr += \ profileStr += \
_htmlFrontScreenPosts(recentPostsCache, max_recent_posts, _htmlFrontScreenPosts(recent_posts_cache, max_recent_posts,
translate, translate,
base_dir, http_prefix, base_dir, http_prefix,
nickname, domain, port, nickname, domain, port,

View File

@ -31,7 +31,7 @@ from session import createSession
def htmlModeration(cssCache: {}, defaultTimeline: str, def htmlModeration(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, wfRequest: {}, person_cache: {}, session, base_dir: str, wfRequest: {}, person_cache: {},
nickname: str, domain: str, port: int, inboxJson: {}, nickname: str, domain: str, port: int, inboxJson: {},
@ -60,7 +60,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
wfRequest, person_cache, wfRequest, person_cache,

View File

@ -282,7 +282,7 @@ def _getPostFromRecentCache(session,
enableTimingLog: bool, enableTimingLog: bool,
postStartTime, postStartTime,
pageNumber: int, pageNumber: int,
recentPostsCache: {}, recent_posts_cache: {},
max_recent_posts: int, max_recent_posts: int,
signing_priv_key_pem: str) -> str: signing_priv_key_pem: str) -> str:
"""Attempts to get the html post from the recent posts cache in memory """Attempts to get the html post from the recent posts cache in memory
@ -324,7 +324,7 @@ def _getPostFromRecentCache(session,
postHtml = \ postHtml = \
preparePostFromHtmlCache(nickname, postHtml, boxName, pageNumber) preparePostFromHtmlCache(nickname, postHtml, boxName, pageNumber)
updateRecentPostsCache(recentPostsCache, max_recent_posts, updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml) post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '3') _logPostTiming(enableTimingLog, postStartTime, '3')
return postHtml return postHtml
@ -1321,7 +1321,7 @@ def _getFooterWithIcons(showIcons: bool,
def individualPostAsHtml(signing_priv_key_pem: str, def individualPostAsHtml(signing_priv_key_pem: str,
allowDownloads: bool, allowDownloads: bool,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
pageNumber: int, base_dir: str, pageNumber: int, base_dir: str,
session, cached_webfingers: {}, person_cache: {}, session, cached_webfingers: {}, person_cache: {},
@ -1402,7 +1402,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
enableTimingLog, enableTimingLog,
postStartTime, postStartTime,
pageNumber, pageNumber,
recentPostsCache, recent_posts_cache,
max_recent_posts, max_recent_posts,
signing_priv_key_pem) signing_priv_key_pem)
if postHtml: if postHtml:
@ -1502,7 +1502,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
allow_local_network_access, allow_local_network_access,
recentPostsCache, False, recent_posts_cache, False,
system_language, system_language,
domain_full, person_cache, domain_full, person_cache,
signing_priv_key_pem, 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 # if the announce could not be downloaded then mark it as rejected
announcedPostId = removeIdEnding(post_json_object['id']) announcedPostId = removeIdEnding(post_json_object['id'])
rejectPostId(base_dir, nickname, domain, announcedPostId, rejectPostId(base_dir, nickname, domain, announcedPostId,
recentPostsCache) recent_posts_cache)
return '' return ''
post_json_object = postJsonAnnounce post_json_object = postJsonAnnounce
@ -1530,7 +1530,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
enableTimingLog, enableTimingLog,
postStartTime, postStartTime,
pageNumber, pageNumber,
recentPostsCache, recent_posts_cache,
max_recent_posts, max_recent_posts,
signing_priv_key_pem) signing_priv_key_pem)
if postHtml: if postHtml:
@ -1539,7 +1539,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
announceFilename = \ announceFilename = \
locatePost(base_dir, nickname, domain, post_json_object['id']) locatePost(base_dir, nickname, domain, post_json_object['id'])
if announceFilename: if announceFilename:
updateAnnounceCollection(recentPostsCache, updateAnnounceCollection(recent_posts_cache,
base_dir, announceFilename, base_dir, announceFilename,
postActor, nickname, domain_full, False) postActor, nickname, domain_full, False)
@ -1982,7 +1982,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
boxName != 'bookmarks': boxName != 'bookmarks':
_saveIndividualPostAsHtmlToCache(base_dir, nickname, domain, _saveIndividualPostAsHtmlToCache(base_dir, nickname, domain,
post_json_object, postHtml) post_json_object, postHtml)
updateRecentPostsCache(recentPostsCache, max_recent_posts, updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml) post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '19') _logPostTiming(enableTimingLog, postStartTime, '19')
@ -1991,7 +1991,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
def htmlIndividualPost(cssCache: {}, def htmlIndividualPost(cssCache: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, session, cached_webfingers: {}, base_dir: str, session, cached_webfingers: {},
person_cache: {}, person_cache: {},
@ -2058,7 +2058,7 @@ def htmlIndividualPost(cssCache: {},
postStr += \ postStr += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts, True, recent_posts_cache, max_recent_posts,
translate, None, translate, None,
base_dir, session, base_dir, session,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -2087,7 +2087,7 @@ def htmlIndividualPost(cssCache: {},
if post_json_object: if post_json_object:
postStr = \ postStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
@ -2123,7 +2123,7 @@ def htmlIndividualPost(cssCache: {},
for item in repliesJson['orderedItems']: for item in repliesJson['orderedItems']:
postStr += \ postStr += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
@ -2154,7 +2154,7 @@ def htmlIndividualPost(cssCache: {},
def htmlPostReplies(cssCache: {}, def htmlPostReplies(cssCache: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, base_dir: str, translate: {}, base_dir: str,
session, cached_webfingers: {}, person_cache: {}, session, cached_webfingers: {}, person_cache: {},
nickname: str, domain: str, port: int, repliesJson: {}, nickname: str, domain: str, port: int, repliesJson: {},
@ -2175,7 +2175,7 @@ def htmlPostReplies(cssCache: {},
for item in repliesJson['orderedItems']: for item in repliesJson['orderedItems']:
repliesStr += \ repliesStr += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
@ -2205,7 +2205,7 @@ def htmlPostReplies(cssCache: {},
def htmlEmojiReactionPicker(cssCache: {}, def htmlEmojiReactionPicker(cssCache: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, session, cached_webfingers: {}, base_dir: str, session, cached_webfingers: {},
person_cache: {}, person_cache: {},
@ -2227,7 +2227,7 @@ def htmlEmojiReactionPicker(cssCache: {},
'<br><center><label class="followText">' + \ '<br><center><label class="followText">' + \
translate['Select reaction'].title() + '</label></center>\n' + \ translate['Select reaction'].title() + '</label></center>\n' + \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,

View File

@ -122,7 +122,7 @@ def _validProfilePreviewPost(post_json_object: {},
def htmlProfileAfterSearch(cssCache: {}, def htmlProfileAfterSearch(cssCache: {},
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, path: str, http_prefix: str, base_dir: str, path: str, http_prefix: str,
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
@ -334,7 +334,7 @@ def htmlProfileAfterSearch(cssCache: {},
profileStr += \ profileStr += \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, base_dir, translate, None, base_dir,
session, cached_webfingers, person_cache, session, cached_webfingers, person_cache,
@ -545,7 +545,7 @@ def htmlProfile(signing_priv_key_pem: str,
rss_icon_at_top: bool, rss_icon_at_top: bool,
cssCache: {}, icons_as_buttons: bool, cssCache: {}, icons_as_buttons: bool,
defaultTimeline: str, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, project_version: str, translate: {}, project_version: str,
base_dir: str, http_prefix: str, authorized: bool, base_dir: str, http_prefix: str, authorized: bool,
profile_json: {}, selected: str, profile_json: {}, selected: str,
@ -574,7 +574,7 @@ def htmlProfile(signing_priv_key_pem: str,
rss_icon_at_top, rss_icon_at_top,
cssCache, icons_as_buttons, cssCache, icons_as_buttons,
defaultTimeline, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, project_version, translate, project_version,
base_dir, http_prefix, authorized, base_dir, http_prefix, authorized,
profile_json, selected, profile_json, selected,
@ -956,7 +956,7 @@ def htmlProfile(signing_priv_key_pem: str,
if selected == 'posts': if selected == 'posts':
profileStr += \ profileStr += \
_htmlProfilePosts(recentPostsCache, max_recent_posts, _htmlProfilePosts(recent_posts_cache, max_recent_posts,
translate, translate,
base_dir, http_prefix, authorized, base_dir, http_prefix, authorized,
nickname, domain, port, nickname, domain, port,
@ -1025,7 +1025,7 @@ def htmlProfile(signing_priv_key_pem: str,
return profileStr return profileStr
def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int, def _htmlProfilePosts(recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
authorized: bool, authorized: bool,
@ -1069,7 +1069,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int,
if item['type'] == 'Create': if item['type'] == 'Create':
postStr = \ postStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,

View File

@ -591,7 +591,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
historysearch: str, historysearch: str,
postsPerPage: int, pageNumber: int, postsPerPage: int, pageNumber: int,
project_version: str, project_version: str,
recentPostsCache: {}, recent_posts_cache: {},
max_recent_posts: int, max_recent_posts: int,
session, session,
cached_webfingers, cached_webfingers,
@ -674,7 +674,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
allow_deletion = False allow_deletion = False
postStr = \ postStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
@ -704,7 +704,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
def htmlHashtagSearch(cssCache: {}, def htmlHashtagSearch(cssCache: {},
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, hashtag: str, pageNumber: int, base_dir: str, hashtag: str, pageNumber: int,
postsPerPage: int, postsPerPage: int,
@ -856,7 +856,7 @@ def htmlHashtagSearch(cssCache: {},
showAvatarOptions = True showAvatarOptions = True
postStr = \ postStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
allowDownloads, recentPostsCache, allowDownloads, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, None, translate, None,
base_dir, session, cached_webfingers, base_dir, session, cached_webfingers,
@ -897,7 +897,7 @@ def htmlHashtagSearch(cssCache: {},
def rssHashtagSearch(nickname: str, domain: str, port: int, def rssHashtagSearch(nickname: str, domain: str, port: int,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, translate: {},
base_dir: str, hashtag: str, base_dir: str, hashtag: str,
postsPerPage: int, postsPerPage: int,

View File

@ -420,7 +420,7 @@ def _pageNumberButtons(usersPath: str, boxName: str, pageNumber: int) -> str:
def htmlTimeline(cssCache: {}, defaultTimeline: str, def htmlTimeline(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, translate: {}, pageNumber: int,
itemsPerPage: int, session, base_dir: str, itemsPerPage: int, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -875,10 +875,10 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# is the post in the memory cache of recent ones? # is the post in the memory cache of recent ones?
currTlStr = None currTlStr = None
if boxName != 'tlmedia' and recentPostsCache.get('html'): if boxName != 'tlmedia' and recent_posts_cache.get('html'):
post_id = removeIdEnding(item['id']).replace('/', '#') post_id = removeIdEnding(item['id']).replace('/', '#')
if recentPostsCache['html'].get(post_id): if recent_posts_cache['html'].get(post_id):
currTlStr = recentPostsCache['html'][post_id] currTlStr = recent_posts_cache['html'][post_id]
currTlStr = \ currTlStr = \
preparePostFromHtmlCache(nickname, preparePostFromHtmlCache(nickname,
currTlStr, currTlStr,
@ -896,7 +896,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# read the post from disk # read the post from disk
currTlStr = \ currTlStr = \
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
False, recentPostsCache, False, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, pageNumber, translate, pageNumber,
base_dir, session, base_dir, session,
@ -1120,7 +1120,7 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
def htmlShares(cssCache: {}, defaultTimeline: str, def htmlShares(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1152,7 +1152,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1178,7 +1178,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
def htmlWanted(cssCache: {}, defaultTimeline: str, def htmlWanted(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1210,7 +1210,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1236,7 +1236,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
def htmlInbox(cssCache: {}, defaultTimeline: str, def htmlInbox(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1269,7 +1269,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1295,7 +1295,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
def htmlBookmarks(cssCache: {}, defaultTimeline: str, def htmlBookmarks(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1328,7 +1328,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1353,7 +1353,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
def htmlInboxDMs(cssCache: {}, defaultTimeline: str, def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1383,7 +1383,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1407,7 +1407,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
def htmlInboxReplies(cssCache: {}, defaultTimeline: str, def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1437,7 +1437,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1460,7 +1460,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
def htmlInboxMedia(cssCache: {}, defaultTimeline: str, def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1490,7 +1490,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1513,7 +1513,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1543,7 +1543,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1566,7 +1566,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1596,7 +1596,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
"""Show the features timeline as html """Show the features timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1619,7 +1619,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
def htmlInboxNews(cssCache: {}, defaultTimeline: str, def htmlInboxNews(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1648,7 +1648,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
"""Show the news timeline as html """Show the news timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,
@ -1671,7 +1671,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
def htmlOutbox(cssCache: {}, defaultTimeline: str, def htmlOutbox(cssCache: {}, defaultTimeline: str,
recentPostsCache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, session, base_dir: str,
cached_webfingers: {}, person_cache: {}, cached_webfingers: {}, person_cache: {},
@ -1703,7 +1703,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
recentPostsCache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,
cached_webfingers, person_cache, cached_webfingers, person_cache,