mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Snake case
							parent
							
								
									fb9f938c2c
								
							
						
					
					
						commit
						25a4d98cc6
					
				
							
								
								
									
										12
									
								
								announce.py
								
								
								
								
							
							
						
						
									
										12
									
								
								announce.py
								
								
								
								
							| 
						 | 
				
			
			@ -18,7 +18,7 @@ from utils import createOutboxDir
 | 
			
		|||
from utils import urlPermitted
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import save_json
 | 
			
		||||
from utils import undoAnnounceCollectionEntry
 | 
			
		||||
from utils import updateAnnounceCollection
 | 
			
		||||
| 
						 | 
				
			
			@ -74,8 +74,8 @@ def outboxAnnounce(recent_posts_cache: {},
 | 
			
		|||
            print('WARN: no nickname found in ' + message_json['actor'])
 | 
			
		||||
            return False
 | 
			
		||||
        domain, _ = getDomainFromActor(message_json['actor'])
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain,
 | 
			
		||||
                                  message_json['object'])
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                   message_json['object'])
 | 
			
		||||
        if postFilename:
 | 
			
		||||
            updateAnnounceCollection(recent_posts_cache,
 | 
			
		||||
                                     base_dir, postFilename,
 | 
			
		||||
| 
						 | 
				
			
			@ -93,8 +93,8 @@ def outboxAnnounce(recent_posts_cache: {},
 | 
			
		|||
                print('WARN: no nickname found in ' + message_json['actor'])
 | 
			
		||||
                return False
 | 
			
		||||
            domain, _ = getDomainFromActor(message_json['actor'])
 | 
			
		||||
            postFilename = locatePost(base_dir, nickname, domain,
 | 
			
		||||
                                      message_json['object']['object'])
 | 
			
		||||
            postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                       message_json['object']['object'])
 | 
			
		||||
            if postFilename:
 | 
			
		||||
                undoAnnounceCollectionEntry(recent_posts_cache,
 | 
			
		||||
                                            base_dir, postFilename,
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +410,7 @@ def outboxUndoAnnounce(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageId = removeIdEnding(message_json['object']['object'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s undo announce post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								blocking.py
								
								
								
								
							
							
						
						
									
										20
									
								
								blocking.py
								
								
								
								
							| 
						 | 
				
			
			@ -26,7 +26,7 @@ from utils import has_users_path
 | 
			
		|||
from utils import get_full_domain
 | 
			
		||||
from utils import removeIdEnding
 | 
			
		||||
from utils import isEvil
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import evilIncarnate
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
| 
						 | 
				
			
			@ -442,7 +442,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
 | 
			
		|||
            print('DEBUG: c2s block object has no nickname')
 | 
			
		||||
        return False
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s block post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -498,7 +498,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
 | 
			
		|||
            print('DEBUG: c2s undo block object has no nickname')
 | 
			
		||||
        return
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s undo block post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -525,7 +525,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
 | 
			
		|||
    """ Mutes the given post
 | 
			
		||||
    """
 | 
			
		||||
    print('mutePost: post_id ' + post_id)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        print('mutePost: file not found ' + post_id)
 | 
			
		||||
        return
 | 
			
		||||
| 
						 | 
				
			
			@ -624,7 +624,8 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
 | 
			
		|||
                print('MUTE: ' + post_id + ' removed cached html')
 | 
			
		||||
 | 
			
		||||
    if alsoUpdatePostId:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, alsoUpdatePostId)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                   alsoUpdatePostId)
 | 
			
		||||
        if os.path.isfile(postFilename):
 | 
			
		||||
            postJsonObj = load_json(postFilename)
 | 
			
		||||
            cachedPostFilename = \
 | 
			
		||||
| 
						 | 
				
			
			@ -657,7 +658,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
 | 
			
		|||
               debug: bool) -> None:
 | 
			
		||||
    """ Unmutes the given post
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return
 | 
			
		||||
    post_json_object = load_json(postFilename)
 | 
			
		||||
| 
						 | 
				
			
			@ -738,7 +739,8 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
 | 
			
		|||
                del recent_posts_cache['html'][post_id]
 | 
			
		||||
                print('UNMUTE: ' + post_id + ' removed cached html')
 | 
			
		||||
    if alsoUpdatePostId:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, alsoUpdatePostId)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                   alsoUpdatePostId)
 | 
			
		||||
        if os.path.isfile(postFilename):
 | 
			
		||||
            postJsonObj = load_json(postFilename)
 | 
			
		||||
            cachedPostFilename = \
 | 
			
		||||
| 
						 | 
				
			
			@ -798,7 +800,7 @@ def outboxMute(base_dir: str, http_prefix: str,
 | 
			
		|||
            print('DEBUG: c2s mute object has no nickname')
 | 
			
		||||
        return
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s mute post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -853,7 +855,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
 | 
			
		|||
            print('DEBUG: c2s undo mute object has no nickname')
 | 
			
		||||
        return
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s undo mute post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								blog.py
								
								
								
								
							
							
						
						
									
										8
									
								
								blog.py
								
								
								
								
							| 
						 | 
				
			
			@ -28,7 +28,7 @@ from utils import get_full_domain
 | 
			
		|||
from utils import getMediaFormats
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import firstParagraphFromString
 | 
			
		||||
from utils import get_actor_property_url
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
 | 
			
		|||
    for replyPostId in lines:
 | 
			
		||||
        replyPostId = replyPostId.replace('\n', '').replace('\r', '')
 | 
			
		||||
        replyPostId = replyPostId.replace('.json', '')
 | 
			
		||||
        if locatePost(base_dir, nickname, domain, replyPostId):
 | 
			
		||||
        if locate_post(base_dir, nickname, domain, replyPostId):
 | 
			
		||||
            replyPostId = replyPostId.replace('.replies', '')
 | 
			
		||||
            replies += \
 | 
			
		||||
                1 + _noOfBlogReplies(base_dir, http_prefix, translate,
 | 
			
		||||
| 
						 | 
				
			
			@ -780,7 +780,7 @@ def htmlEditBlog(media_instance: bool, translate: {},
 | 
			
		|||
                 postUrl: str, system_language: str) -> str:
 | 
			
		||||
    """Edit a blog post after it was created
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        print('Edit blog: Filename not found for ' + postUrl)
 | 
			
		||||
        return None
 | 
			
		||||
| 
						 | 
				
			
			@ -944,7 +944,7 @@ def pathContainsBlogLink(base_dir: str,
 | 
			
		|||
        return None, None
 | 
			
		||||
    messageId = local_actor_url(http_prefix, nickname, domain_full) + \
 | 
			
		||||
        '/statuses/' + userEnding2[1]
 | 
			
		||||
    return locatePost(base_dir, nickname, domain, messageId), nickname
 | 
			
		||||
    return locate_post(base_dir, nickname, domain, messageId), nickname
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getBlogAddress(actor_json: {}) -> str:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								bookmarks.py
								
								
								
								
							
							
						
						
									
										10
									
								
								bookmarks.py
								
								
								
								
							| 
						 | 
				
			
			@ -19,7 +19,7 @@ from utils import removePostFromCache
 | 
			
		|||
from utils import urlPermitted
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import getCachedPostFilename
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import save_json
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +292,7 @@ def bookmark(recent_posts_cache: {},
 | 
			
		|||
            bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
 | 
			
		||||
 | 
			
		||||
    if bookmarkedPostNickname:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            print('DEBUG: bookmark base_dir: ' + base_dir)
 | 
			
		||||
            print('DEBUG: bookmark nickname: ' + nickname)
 | 
			
		||||
| 
						 | 
				
			
			@ -356,7 +356,7 @@ def undoBookmark(recent_posts_cache: {},
 | 
			
		|||
            bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
 | 
			
		||||
 | 
			
		||||
    if bookmarkedPostNickname:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            return None
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -593,7 +593,7 @@ def outboxBookmark(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageUrl = removeIdEnding(message_json['object']['url'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s like post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -649,7 +649,7 @@ def outboxUndoBookmark(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageUrl = removeIdEnding(message_json['object']['url'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s unbookmark post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										53
									
								
								daemon.py
								
								
								
								
							
							
						
						
									
										53
									
								
								daemon.py
								
								
								
								
							| 
						 | 
				
			
			@ -290,7 +290,7 @@ from utils import undoLikesCollectionEntry
 | 
			
		|||
from utils import deletePost
 | 
			
		||||
from utils import isBlogPost
 | 
			
		||||
from utils import removeAvatarFromCache
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import getCachedPostFilename
 | 
			
		||||
from utils import removePostFromCache
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
| 
						 | 
				
			
			@ -525,8 +525,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            if self._postToOutbox(message_json,
 | 
			
		||||
                                  self.server.project_version, nickname):
 | 
			
		||||
                postFilename = \
 | 
			
		||||
                    locatePost(self.server.base_dir, nickname,
 | 
			
		||||
                               self.server.domain, messageId)
 | 
			
		||||
                    locate_post(self.server.base_dir, nickname,
 | 
			
		||||
                                self.server.domain, messageId)
 | 
			
		||||
                if postFilename:
 | 
			
		||||
                    post_json_object = load_json(postFilename)
 | 
			
		||||
                    if post_json_object:
 | 
			
		||||
| 
						 | 
				
			
			@ -2006,8 +2006,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                    else:
 | 
			
		||||
                        # remove a post or thread
 | 
			
		||||
                        postFilename = \
 | 
			
		||||
                            locatePost(base_dir, nickname, domain,
 | 
			
		||||
                                       moderationText)
 | 
			
		||||
                            locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                        moderationText)
 | 
			
		||||
                        if postFilename:
 | 
			
		||||
                            if canRemovePost(base_dir,
 | 
			
		||||
                                             nickname, domain, port,
 | 
			
		||||
| 
						 | 
				
			
			@ -2022,8 +2022,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                            # if this is a local blog post then also remove it
 | 
			
		||||
                            # from the news actor
 | 
			
		||||
                            postFilename = \
 | 
			
		||||
                                locatePost(base_dir, 'news', domain,
 | 
			
		||||
                                           moderationText)
 | 
			
		||||
                                locate_post(base_dir, 'news', domain,
 | 
			
		||||
                                            moderationText)
 | 
			
		||||
                            if postFilename:
 | 
			
		||||
                                if canRemovePost(base_dir,
 | 
			
		||||
                                                 'news', domain, port,
 | 
			
		||||
| 
						 | 
				
			
			@ -4628,8 +4628,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            if newsPostUrl and newsPostContent and newsPostTitle:
 | 
			
		||||
                # load the post
 | 
			
		||||
                postFilename = \
 | 
			
		||||
                    locatePost(base_dir, nickname, domain,
 | 
			
		||||
                               newsPostUrl)
 | 
			
		||||
                    locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                newsPostUrl)
 | 
			
		||||
                if postFilename:
 | 
			
		||||
                    post_json_object = load_json(postFilename)
 | 
			
		||||
                    # update the content and title
 | 
			
		||||
| 
						 | 
				
			
			@ -7872,7 +7872,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            if nickname:
 | 
			
		||||
                if domain_full + '/users/' + nickname + '/' in announceUrl:
 | 
			
		||||
                    postFilename = \
 | 
			
		||||
                        locatePost(base_dir, nickname, domain, announceUrl)
 | 
			
		||||
                        locate_post(base_dir, nickname, domain, announceUrl)
 | 
			
		||||
            if postFilename:
 | 
			
		||||
                deletePost(base_dir, http_prefix,
 | 
			
		||||
                           nickname, domain, postFilename,
 | 
			
		||||
| 
						 | 
				
			
			@ -8178,7 +8178,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
        # directly like the post file
 | 
			
		||||
        if not likedPostFilename:
 | 
			
		||||
            likedPostFilename = \
 | 
			
		||||
                locatePost(base_dir, self.postToNickname, domain, likeUrl)
 | 
			
		||||
                locate_post(base_dir, self.postToNickname, domain, likeUrl)
 | 
			
		||||
        if likedPostFilename:
 | 
			
		||||
            recent_posts_cache = self.server.recent_posts_cache
 | 
			
		||||
            likedPostJson = load_json(likedPostFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -8341,8 +8341,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
 | 
			
		||||
        # directly undo the like within the post file
 | 
			
		||||
        if not likedPostFilename:
 | 
			
		||||
            likedPostFilename = locatePost(base_dir, self.postToNickname,
 | 
			
		||||
                                           domain, likeUrl)
 | 
			
		||||
            likedPostFilename = locate_post(base_dir, self.postToNickname,
 | 
			
		||||
                                            domain, likeUrl)
 | 
			
		||||
        if likedPostFilename:
 | 
			
		||||
            recent_posts_cache = self.server.recent_posts_cache
 | 
			
		||||
            likedPostJson = load_json(likedPostFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -8511,7 +8511,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
        # directly emoji reaction the post file
 | 
			
		||||
        if not reactionPostFilename:
 | 
			
		||||
            reactionPostFilename = \
 | 
			
		||||
                locatePost(base_dir, self.postToNickname, domain, reactionUrl)
 | 
			
		||||
                locate_post(base_dir, self.postToNickname, domain, reactionUrl)
 | 
			
		||||
        if reactionPostFilename:
 | 
			
		||||
            recent_posts_cache = self.server.recent_posts_cache
 | 
			
		||||
            reactionPostJson = load_json(reactionPostFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -8694,7 +8694,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
        # directly undo the emoji reaction within the post file
 | 
			
		||||
        if not reactionPostFilename:
 | 
			
		||||
            reactionPostFilename = \
 | 
			
		||||
                locatePost(base_dir, self.postToNickname, domain, reactionUrl)
 | 
			
		||||
                locate_post(base_dir, self.postToNickname, domain, reactionUrl)
 | 
			
		||||
        if reactionPostFilename:
 | 
			
		||||
            recent_posts_cache = self.server.recent_posts_cache
 | 
			
		||||
            reactionPostJson = load_json(reactionPostFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -8809,8 +8809,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
 | 
			
		||||
        post_json_object = None
 | 
			
		||||
        reactionPostFilename = \
 | 
			
		||||
            locatePost(self.server.base_dir,
 | 
			
		||||
                       self.postToNickname, domain, reactionUrl)
 | 
			
		||||
            locate_post(self.server.base_dir,
 | 
			
		||||
                        self.postToNickname, domain, reactionUrl)
 | 
			
		||||
        if reactionPostFilename:
 | 
			
		||||
            post_json_object = load_json(reactionPostFilename)
 | 
			
		||||
        if not reactionPostFilename or not post_json_object:
 | 
			
		||||
| 
						 | 
				
			
			@ -8926,7 +8926,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
        if self.server.iconsCache.get('bookmark.png'):
 | 
			
		||||
            del self.server.iconsCache['bookmark.png']
 | 
			
		||||
        bookmarkFilename = \
 | 
			
		||||
            locatePost(base_dir, self.postToNickname, domain, bookmarkUrl)
 | 
			
		||||
            locate_post(base_dir, self.postToNickname, domain, bookmarkUrl)
 | 
			
		||||
        if bookmarkFilename:
 | 
			
		||||
            print('Regenerating html post for changed bookmark')
 | 
			
		||||
            bookmarkPostJson = load_json(bookmarkFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -9054,7 +9054,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
        # self._postToOutbox(undoBookmarkJson,
 | 
			
		||||
        #                    self.server.project_version, None)
 | 
			
		||||
        bookmarkFilename = \
 | 
			
		||||
            locatePost(base_dir, self.postToNickname, domain, bookmarkUrl)
 | 
			
		||||
            locate_post(base_dir, self.postToNickname, domain, bookmarkUrl)
 | 
			
		||||
        if bookmarkFilename:
 | 
			
		||||
            print('Regenerating html post for changed unbookmark')
 | 
			
		||||
            bookmarkPostJson = load_json(bookmarkFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -9249,7 +9249,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                 http_prefix, muteUrl,
 | 
			
		||||
                 self.server.recent_posts_cache, debug)
 | 
			
		||||
        muteFilename = \
 | 
			
		||||
            locatePost(base_dir, nickname, domain, muteUrl)
 | 
			
		||||
            locate_post(base_dir, nickname, domain, muteUrl)
 | 
			
		||||
        if muteFilename:
 | 
			
		||||
            print('mutePost: Regenerating html post for changed mute status')
 | 
			
		||||
            mutePostJson = load_json(muteFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -9358,7 +9358,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                   http_prefix, muteUrl,
 | 
			
		||||
                   self.server.recent_posts_cache, debug)
 | 
			
		||||
        muteFilename = \
 | 
			
		||||
            locatePost(base_dir, nickname, domain, muteUrl)
 | 
			
		||||
            locate_post(base_dir, nickname, domain, muteUrl)
 | 
			
		||||
        if muteFilename:
 | 
			
		||||
            print('unmutePost: ' +
 | 
			
		||||
                  'Regenerating html post for changed unmute status')
 | 
			
		||||
| 
						 | 
				
			
			@ -10133,7 +10133,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            return False
 | 
			
		||||
        replies = False
 | 
			
		||||
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, post_id, replies)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                   post_id, replies)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12971,7 +12972,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            post_json_object = None
 | 
			
		||||
            if inReplyToUrl:
 | 
			
		||||
                replyPostFilename = \
 | 
			
		||||
                    locatePost(base_dir, nickname, domain, inReplyToUrl)
 | 
			
		||||
                    locate_post(base_dir, nickname, domain, inReplyToUrl)
 | 
			
		||||
                if replyPostFilename:
 | 
			
		||||
                    post_json_object = load_json(replyPostFilename)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -16749,9 +16750,9 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            elif postType == 'editblogpost':
 | 
			
		||||
                print('Edited blog post received')
 | 
			
		||||
                postFilename = \
 | 
			
		||||
                    locatePost(self.server.base_dir,
 | 
			
		||||
                               nickname, self.server.domain,
 | 
			
		||||
                               fields['postUrl'])
 | 
			
		||||
                    locate_post(self.server.base_dir,
 | 
			
		||||
                                nickname, self.server.domain,
 | 
			
		||||
                                fields['postUrl'])
 | 
			
		||||
                if os.path.isfile(postFilename):
 | 
			
		||||
                    post_json_object = load_json(postFilename)
 | 
			
		||||
                    if post_json_object:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ from utils import get_full_domain
 | 
			
		|||
from utils import removeIdEnding
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import deletePost
 | 
			
		||||
from utils import removeModerationPostFromIndex
 | 
			
		||||
from utils import local_actor_url
 | 
			
		||||
| 
						 | 
				
			
			@ -161,8 +161,8 @@ def outboxDelete(base_dir: str, http_prefix: str,
 | 
			
		|||
                  "wasn't created by you (domain does not match)")
 | 
			
		||||
        return
 | 
			
		||||
    removeModerationPostFromIndex(base_dir, messageId, debug)
 | 
			
		||||
    postFilename = locatePost(base_dir, deleteNickname, deleteDomain,
 | 
			
		||||
                              messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, deleteNickname, deleteDomain,
 | 
			
		||||
                               messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s delete post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								happening.py
								
								
								
								
							
							
						
						
									
										10
									
								
								happening.py
								
								
								
								
							| 
						 | 
				
			
			@ -15,7 +15,7 @@ from datetime import timedelta
 | 
			
		|||
from utils import isPublicPost
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import save_json
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import has_object_dict
 | 
			
		||||
from utils import acct_dir
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -205,7 +205,7 @@ def getTodaysEvents(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    with open(calendarFilename, 'r') as eventsFile:
 | 
			
		||||
        for post_id in eventsFile:
 | 
			
		||||
            post_id = post_id.replace('\n', '').replace('\r', '')
 | 
			
		||||
            postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
            postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
            if not postFilename:
 | 
			
		||||
                recreateEventsFile = True
 | 
			
		||||
                continue
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +280,7 @@ def dayEventsCheck(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    with open(calendarFilename, 'r') as eventsFile:
 | 
			
		||||
        for post_id in eventsFile:
 | 
			
		||||
            post_id = post_id.replace('\n', '').replace('\r', '')
 | 
			
		||||
            postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
            postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
            if not postFilename:
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -336,7 +336,7 @@ def getThisWeeksEvents(base_dir: str, nickname: str, domain: str) -> {}:
 | 
			
		|||
    with open(calendarFilename, 'r') as eventsFile:
 | 
			
		||||
        for post_id in eventsFile:
 | 
			
		||||
            post_id = post_id.replace('\n', '').replace('\r', '')
 | 
			
		||||
            postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
            postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
            if not postFilename:
 | 
			
		||||
                recreateEventsFile = True
 | 
			
		||||
                continue
 | 
			
		||||
| 
						 | 
				
			
			@ -401,7 +401,7 @@ def getCalendarEvents(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    with open(calendarFilename, 'r') as eventsFile:
 | 
			
		||||
        for post_id in eventsFile:
 | 
			
		||||
            post_id = post_id.replace('\n', '').replace('\r', '')
 | 
			
		||||
            postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
            postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
            if not postFilename:
 | 
			
		||||
                recreateEventsFile = True
 | 
			
		||||
                continue
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										64
									
								
								inbox.py
								
								
								
								
							
							
						
						
									
										64
									
								
								inbox.py
								
								
								
								
							| 
						 | 
				
			
			@ -51,7 +51,7 @@ from utils import createInboxQueueDir
 | 
			
		|||
from utils import getStatusNumber
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import deletePost
 | 
			
		||||
from utils import removeModerationPostFromIndex
 | 
			
		||||
from utils import load_json
 | 
			
		||||
| 
						 | 
				
			
			@ -913,7 +913,7 @@ def _receiveUpdateToQuestion(recent_posts_cache: {}, message_json: {},
 | 
			
		|||
    if '#' in messageId:
 | 
			
		||||
        messageId = messageId.split('#', 1)[0]
 | 
			
		||||
    # find the question post
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return
 | 
			
		||||
    # load the json for the question
 | 
			
		||||
| 
						 | 
				
			
			@ -1038,7 +1038,7 @@ def _receiveLike(recent_posts_cache: {},
 | 
			
		|||
    handleName = handle.split('@')[0]
 | 
			
		||||
    handleDom = handle.split('@')[1]
 | 
			
		||||
    postLikedId = message_json['object']
 | 
			
		||||
    postFilename = locatePost(base_dir, handleName, handleDom, postLikedId)
 | 
			
		||||
    postFilename = locate_post(base_dir, handleName, handleDom, postLikedId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1068,8 +1068,8 @@ def _receiveLike(recent_posts_cache: {},
 | 
			
		|||
                if isinstance(likedPostJson['object'], str):
 | 
			
		||||
                    announceLikeUrl = likedPostJson['object']
 | 
			
		||||
                    announceLikedFilename = \
 | 
			
		||||
                        locatePost(base_dir, handleName,
 | 
			
		||||
                                   domain, announceLikeUrl)
 | 
			
		||||
                        locate_post(base_dir, handleName,
 | 
			
		||||
                                    domain, announceLikeUrl)
 | 
			
		||||
                    if announceLikedFilename:
 | 
			
		||||
                        postLikedId = announceLikeUrl
 | 
			
		||||
                        postFilename = announceLikedFilename
 | 
			
		||||
| 
						 | 
				
			
			@ -1160,8 +1160,8 @@ def _receiveUndoLike(recent_posts_cache: {},
 | 
			
		|||
    handleName = handle.split('@')[0]
 | 
			
		||||
    handleDom = handle.split('@')[1]
 | 
			
		||||
    postFilename = \
 | 
			
		||||
        locatePost(base_dir, handleName, handleDom,
 | 
			
		||||
                   message_json['object']['object'])
 | 
			
		||||
        locate_post(base_dir, handleName, handleDom,
 | 
			
		||||
                    message_json['object']['object'])
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: unliked post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1182,8 +1182,8 @@ def _receiveUndoLike(recent_posts_cache: {},
 | 
			
		|||
                if isinstance(likedPostJson['object'], str):
 | 
			
		||||
                    announceLikeUrl = likedPostJson['object']
 | 
			
		||||
                    announceLikedFilename = \
 | 
			
		||||
                        locatePost(base_dir, handleName,
 | 
			
		||||
                                   domain, announceLikeUrl)
 | 
			
		||||
                        locate_post(base_dir, handleName,
 | 
			
		||||
                                    domain, announceLikeUrl)
 | 
			
		||||
                    if announceLikedFilename:
 | 
			
		||||
                        postLikedId = announceLikeUrl
 | 
			
		||||
                        postFilename = announceLikedFilename
 | 
			
		||||
| 
						 | 
				
			
			@ -1295,7 +1295,7 @@ def _receiveReaction(recent_posts_cache: {},
 | 
			
		|||
        if debug:
 | 
			
		||||
            print('DEBUG: emoji reaction has no content')
 | 
			
		||||
        return True
 | 
			
		||||
    postFilename = locatePost(base_dir, handleName, handleDom, postReactionId)
 | 
			
		||||
    postFilename = locate_post(base_dir, handleName, handleDom, postReactionId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: emoji reaction post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1326,8 +1326,8 @@ def _receiveReaction(recent_posts_cache: {},
 | 
			
		|||
                if isinstance(reactionPostJson['object'], str):
 | 
			
		||||
                    announceReactionUrl = reactionPostJson['object']
 | 
			
		||||
                    announceReactionFilename = \
 | 
			
		||||
                        locatePost(base_dir, handleName,
 | 
			
		||||
                                   domain, announceReactionUrl)
 | 
			
		||||
                        locate_post(base_dir, handleName,
 | 
			
		||||
                                    domain, announceReactionUrl)
 | 
			
		||||
                    if announceReactionFilename:
 | 
			
		||||
                        postReactionId = announceReactionUrl
 | 
			
		||||
                        postFilename = announceReactionFilename
 | 
			
		||||
| 
						 | 
				
			
			@ -1429,8 +1429,8 @@ def _receiveUndoReaction(recent_posts_cache: {},
 | 
			
		|||
    handleName = handle.split('@')[0]
 | 
			
		||||
    handleDom = handle.split('@')[1]
 | 
			
		||||
    postFilename = \
 | 
			
		||||
        locatePost(base_dir, handleName, handleDom,
 | 
			
		||||
                   message_json['object']['object'])
 | 
			
		||||
        locate_post(base_dir, handleName, handleDom,
 | 
			
		||||
                    message_json['object']['object'])
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: unreaction post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1457,8 +1457,8 @@ def _receiveUndoReaction(recent_posts_cache: {},
 | 
			
		|||
                if isinstance(reactionPostJson['object'], str):
 | 
			
		||||
                    announceReactionUrl = reactionPostJson['object']
 | 
			
		||||
                    announceReactionFilename = \
 | 
			
		||||
                        locatePost(base_dir, handleName,
 | 
			
		||||
                                   domain, announceReactionUrl)
 | 
			
		||||
                        locate_post(base_dir, handleName,
 | 
			
		||||
                                    domain, announceReactionUrl)
 | 
			
		||||
                    if announceReactionFilename:
 | 
			
		||||
                        postReactionId = announceReactionUrl
 | 
			
		||||
                        postFilename = announceReactionFilename
 | 
			
		||||
| 
						 | 
				
			
			@ -1567,7 +1567,7 @@ def _receiveBookmark(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageUrl = removeIdEnding(message_json['object']['url'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s inbox like post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1680,7 +1680,7 @@ def _receiveUndoBookmark(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageUrl = removeIdEnding(message_json['object']['url'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s inbox like post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1776,8 +1776,8 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
 | 
			
		|||
    removeModerationPostFromIndex(base_dir, messageId, debug)
 | 
			
		||||
    handleNickname = handle.split('@')[0]
 | 
			
		||||
    handleDomain = handle.split('@')[1]
 | 
			
		||||
    postFilename = locatePost(base_dir, handleNickname,
 | 
			
		||||
                              handleDomain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, handleNickname,
 | 
			
		||||
                               handleDomain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: delete post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -1791,8 +1791,8 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
 | 
			
		|||
 | 
			
		||||
    # also delete any local blogs saved to the news actor
 | 
			
		||||
    if handleNickname != 'news' and handleDomain == domain_full:
 | 
			
		||||
        postFilename = locatePost(base_dir, 'news',
 | 
			
		||||
                                  handleDomain, messageId)
 | 
			
		||||
        postFilename = locate_post(base_dir, 'news',
 | 
			
		||||
                                   handleDomain, messageId)
 | 
			
		||||
        if postFilename:
 | 
			
		||||
            deletePost(base_dir, http_prefix, 'news',
 | 
			
		||||
                       handleDomain, postFilename, debug,
 | 
			
		||||
| 
						 | 
				
			
			@ -1889,8 +1889,8 @@ def _receiveAnnounce(recent_posts_cache: {},
 | 
			
		|||
        return False
 | 
			
		||||
 | 
			
		||||
    # is this post in the outbox of the person?
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain,
 | 
			
		||||
                              message_json['object'])
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                               message_json['object'])
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: announce post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -2060,8 +2060,8 @@ def _receiveUndoAnnounce(recent_posts_cache: {},
 | 
			
		|||
    # if this post in the outbox of the person?
 | 
			
		||||
    handleName = handle.split('@')[0]
 | 
			
		||||
    handleDom = handle.split('@')[1]
 | 
			
		||||
    postFilename = locatePost(base_dir, handleName, handleDom,
 | 
			
		||||
                              message_json['object']['object'])
 | 
			
		||||
    postFilename = locate_post(base_dir, handleName, handleDom,
 | 
			
		||||
                               message_json['object']['object'])
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: undo announce post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -2150,8 +2150,8 @@ def populateReplies(base_dir: str, http_prefix: str, domain: str,
 | 
			
		|||
            print('DEBUG: no domain found for ' + replyTo)
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
    postFilename = locatePost(base_dir, replyToNickname,
 | 
			
		||||
                              replyToDomain, replyTo)
 | 
			
		||||
    postFilename = locate_post(base_dir, replyToNickname,
 | 
			
		||||
                               replyToDomain, replyTo)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: post may have expired - ' + replyTo)
 | 
			
		||||
| 
						 | 
				
			
			@ -2285,8 +2285,8 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    if message_json['object'].get('inReplyTo'):
 | 
			
		||||
        if isinstance(message_json['object']['inReplyTo'], str):
 | 
			
		||||
            originalPostId = message_json['object']['inReplyTo']
 | 
			
		||||
            postPostFilename = locatePost(base_dir, nickname, domain,
 | 
			
		||||
                                          originalPostId)
 | 
			
		||||
            postPostFilename = locate_post(base_dir, nickname, domain,
 | 
			
		||||
                                           originalPostId)
 | 
			
		||||
            if postPostFilename:
 | 
			
		||||
                if not _postAllowsComments(postPostFilename):
 | 
			
		||||
                    print('REJECT: reply to post which does not ' +
 | 
			
		||||
| 
						 | 
				
			
			@ -2366,7 +2366,7 @@ def _alreadyLiked(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    """Is the given post already liked by the given handle?
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = \
 | 
			
		||||
        locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
        locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return False
 | 
			
		||||
    post_json_object = load_json(postFilename, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -2396,7 +2396,7 @@ def _alreadyReacted(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    """Is the given post already emoji reacted by the given handle?
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = \
 | 
			
		||||
        locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
        locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return False
 | 
			
		||||
    post_json_object = load_json(postFilename, 1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								like.py
								
								
								
								
							
							
						
						
									
										8
									
								
								like.py
								
								
								
								
							| 
						 | 
				
			
			@ -20,7 +20,7 @@ from utils import removeIdEnding
 | 
			
		|||
from utils import urlPermitted
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import undoLikesCollectionEntry
 | 
			
		||||
from utils import has_group_type
 | 
			
		||||
from utils import local_actor_url
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +119,7 @@ def _like(recent_posts_cache: {},
 | 
			
		|||
                    has_group_type(base_dir, actorLiked, person_cache)
 | 
			
		||||
 | 
			
		||||
    if likedPostNickname:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            print('DEBUG: like base_dir: ' + base_dir)
 | 
			
		||||
            print('DEBUG: like nickname: ' + nickname)
 | 
			
		||||
| 
						 | 
				
			
			@ -360,7 +360,7 @@ def outboxLike(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageId = removeIdEnding(message_json['object'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s like post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -397,7 +397,7 @@ def outboxUndoLike(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
    messageId = removeIdEnding(message_json['object']['object'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s undo like post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ from utils import get_base_content_from_post
 | 
			
		|||
from utils import has_object_dict
 | 
			
		||||
from utils import firstParagraphFromString
 | 
			
		||||
from utils import isPublicPost
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import save_json
 | 
			
		||||
from utils import isSuspended
 | 
			
		||||
| 
						 | 
				
			
			@ -1042,8 +1042,8 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
 | 
			
		||||
                # read the post from file
 | 
			
		||||
                fullPostFilename = \
 | 
			
		||||
                    locatePost(base_dir, nickname,
 | 
			
		||||
                               domain, postUrl, False)
 | 
			
		||||
                    locate_post(base_dir, nickname,
 | 
			
		||||
                                domain, postUrl, False)
 | 
			
		||||
                if not fullPostFilename:
 | 
			
		||||
                    print('Unable to locate post for newswire ' + postUrl)
 | 
			
		||||
                    ctr += 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								posts.py
								
								
								
								
							
							
						
						
									
										20
									
								
								posts.py
								
								
								
								
							| 
						 | 
				
			
			@ -58,7 +58,7 @@ from utils import getNicknameFromActor
 | 
			
		|||
from utils import getDomainFromActor
 | 
			
		||||
from utils import deletePost
 | 
			
		||||
from utils import validNickname
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import save_json
 | 
			
		||||
from utils import get_config_param
 | 
			
		||||
| 
						 | 
				
			
			@ -1050,7 +1050,7 @@ def _createPostCWFromReply(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
        # it has a content warning. If it does then reproduce
 | 
			
		||||
        # the same warning
 | 
			
		||||
        replyPostFilename = \
 | 
			
		||||
            locatePost(base_dir, nickname, domain, inReplyTo)
 | 
			
		||||
            locate_post(base_dir, nickname, domain, inReplyTo)
 | 
			
		||||
        if replyPostFilename:
 | 
			
		||||
            replyToJson = load_json(replyPostFilename)
 | 
			
		||||
            if replyToJson:
 | 
			
		||||
| 
						 | 
				
			
			@ -3782,8 +3782,8 @@ def _createBoxIndexed(recent_posts_cache: {},
 | 
			
		|||
 | 
			
		||||
                # read the post from file
 | 
			
		||||
                fullPostFilename = \
 | 
			
		||||
                    locatePost(base_dir, nickname,
 | 
			
		||||
                               originalDomain, postUrl, False)
 | 
			
		||||
                    locate_post(base_dir, nickname,
 | 
			
		||||
                                originalDomain, postUrl, False)
 | 
			
		||||
                if fullPostFilename:
 | 
			
		||||
                    # has the post been rejected?
 | 
			
		||||
                    if os.path.isfile(fullPostFilename + '.reject'):
 | 
			
		||||
| 
						 | 
				
			
			@ -3802,8 +3802,8 @@ def _createBoxIndexed(recent_posts_cache: {},
 | 
			
		|||
                    if timelineNickname != nickname:
 | 
			
		||||
                        # if this is the features timeline
 | 
			
		||||
                        fullPostFilename = \
 | 
			
		||||
                            locatePost(base_dir, timelineNickname,
 | 
			
		||||
                                       originalDomain, postUrl, False)
 | 
			
		||||
                            locate_post(base_dir, timelineNickname,
 | 
			
		||||
                                        originalDomain, postUrl, False)
 | 
			
		||||
                        if fullPostFilename:
 | 
			
		||||
                            if _addPostToTimeline(fullPostFilename, boxname,
 | 
			
		||||
                                                  postsInBox, boxActor):
 | 
			
		||||
| 
						 | 
				
			
			@ -4754,7 +4754,7 @@ def isMuted(base_dir: str, nickname: str, domain: str, post_id: str,
 | 
			
		|||
            conversationId.replace('/', '#') + '.muted'
 | 
			
		||||
        if os.path.isfile(convMutedFilename):
 | 
			
		||||
            return True
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return False
 | 
			
		||||
    if os.path.isfile(postFilename + '.muted'):
 | 
			
		||||
| 
						 | 
				
			
			@ -5226,7 +5226,7 @@ def editedPostFilename(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    if lastpost_id == post_id:
 | 
			
		||||
        return ''
 | 
			
		||||
    lastpostFilename = \
 | 
			
		||||
        locatePost(base_dir, nickname, domain, lastpost_id, False)
 | 
			
		||||
        locate_post(base_dir, nickname, domain, lastpost_id, False)
 | 
			
		||||
    if not lastpostFilename:
 | 
			
		||||
        return ''
 | 
			
		||||
    lastpostJson = load_json(lastpostFilename, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -5270,7 +5270,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
 | 
			
		|||
    """From the url of an announce this returns the actor, url and
 | 
			
		||||
    filename (if available) of the original post being announced
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, announceUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, announceUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return None, None, None
 | 
			
		||||
    announcePostJson = load_json(postFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -5287,7 +5287,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
 | 
			
		|||
    actor = url = None
 | 
			
		||||
    # do we have the original post?
 | 
			
		||||
    origPostId = announcePostJson['object']
 | 
			
		||||
    origFilename = locatePost(base_dir, nickname, domain, origPostId)
 | 
			
		||||
    origFilename = locate_post(base_dir, nickname, domain, origPostId)
 | 
			
		||||
    if origFilename:
 | 
			
		||||
        # we have the original post
 | 
			
		||||
        origPostJson = load_json(origFilename, 0, 1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ __status__ = "Production"
 | 
			
		|||
__module_group__ = "ActivityPub"
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import save_json
 | 
			
		||||
from utils import has_object_dict
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ def questionUpdateVotes(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    if not replyJson['object'].get('name'):
 | 
			
		||||
        return None, None
 | 
			
		||||
    inReplyTo = replyJson['object']['inReplyTo']
 | 
			
		||||
    questionPostFilename = locatePost(base_dir, nickname, domain, inReplyTo)
 | 
			
		||||
    questionPostFilename = locate_post(base_dir, nickname, domain, inReplyTo)
 | 
			
		||||
    if not questionPostFilename:
 | 
			
		||||
        return None, None
 | 
			
		||||
    questionJson = load_json(questionPostFilename)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ from utils import removeIdEnding
 | 
			
		|||
from utils import urlPermitted
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import undoReactionCollectionEntry
 | 
			
		||||
from utils import has_group_type
 | 
			
		||||
from utils import local_actor_url
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ def _reaction(recent_posts_cache: {},
 | 
			
		|||
                    has_group_type(base_dir, actorReaction, person_cache)
 | 
			
		||||
 | 
			
		||||
    if reactionPostNickname:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, objectUrl)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            print('DEBUG: reaction base_dir: ' + base_dir)
 | 
			
		||||
            print('DEBUG: reaction nickname: ' + nickname)
 | 
			
		||||
| 
						 | 
				
			
			@ -384,7 +384,7 @@ def outboxReaction(recent_posts_cache: {},
 | 
			
		|||
    messageId = removeIdEnding(message_json['object'])
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    emojiContent = message_json['content']
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s reaction post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			@ -426,7 +426,7 @@ def outboxUndoReaction(recent_posts_cache: {},
 | 
			
		|||
    messageId = removeIdEnding(message_json['object']['object'])
 | 
			
		||||
    emojiContent = message_json['object']['content']
 | 
			
		||||
    domain = remove_domain_port(domain)
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        if debug:
 | 
			
		||||
            print('DEBUG: c2s undo reaction post not found in inbox or outbox')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								utils.py
								
								
								
								
							
							
						
						
									
										12
									
								
								utils.py
								
								
								
								
							| 
						 | 
				
			
			@ -1326,8 +1326,8 @@ def clearFromPostCaches(base_dir: str, recent_posts_cache: {},
 | 
			
		|||
        break
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def locatePost(base_dir: str, nickname: str, domain: str,
 | 
			
		||||
               postUrl: str, replies: bool = False) -> str:
 | 
			
		||||
def locate_post(base_dir: str, nickname: str, domain: str,
 | 
			
		||||
                postUrl: str, replies: bool = False) -> str:
 | 
			
		||||
    """Returns the filename for the given status post url
 | 
			
		||||
    """
 | 
			
		||||
    if not replies:
 | 
			
		||||
| 
						 | 
				
			
			@ -1427,7 +1427,7 @@ def canReplyTo(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    if '/statuses/' not in postUrl:
 | 
			
		||||
        return True
 | 
			
		||||
    if not post_json_object:
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            return False
 | 
			
		||||
        post_json_object = load_json(postFilename)
 | 
			
		||||
| 
						 | 
				
			
			@ -1539,7 +1539,7 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
        print('DEBUG: removing replies to ' + postFilename)
 | 
			
		||||
    with open(repliesFilename, 'r') as f:
 | 
			
		||||
        for replyId in f:
 | 
			
		||||
            replyFile = locatePost(base_dir, nickname, domain, replyId)
 | 
			
		||||
            replyFile = locate_post(base_dir, nickname, domain, replyId)
 | 
			
		||||
            if not replyFile:
 | 
			
		||||
                continue
 | 
			
		||||
            if os.path.isfile(replyFile):
 | 
			
		||||
| 
						 | 
				
			
			@ -1946,7 +1946,7 @@ def isPublicPostFromUrl(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
                        postUrl: str) -> bool:
 | 
			
		||||
    """Returns whether the given url is a public post
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return False
 | 
			
		||||
    post_json_object = load_json(postFilename, 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -2559,7 +2559,7 @@ def reject_post_id(base_dir: str, nickname: str, domain: str,
 | 
			
		|||
    """ Marks the given post as rejected,
 | 
			
		||||
    for example an announce which is too old
 | 
			
		||||
    """
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ from utils import getDisplayName
 | 
			
		|||
from utils import get_config_param
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import weekDayOfMonthStart
 | 
			
		||||
from utils import get_alt_path
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
 | 
			
		|||
    domain, port = getDomainFromActor(actor)
 | 
			
		||||
    messageId = actor + '/statuses/' + post_id
 | 
			
		||||
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ from content import limitRepeatedWords
 | 
			
		|||
from utils import get_fav_filename_from_url
 | 
			
		||||
from utils import get_base_content_from_post
 | 
			
		||||
from utils import removeHtml
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import votesOnNewswireItem
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
| 
						 | 
				
			
			@ -660,7 +660,7 @@ def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
 | 
			
		|||
        return ''
 | 
			
		||||
 | 
			
		||||
    postUrl = postUrl.replace('/', '#')
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, postUrl)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return ''
 | 
			
		||||
    post_json_object = load_json(postFilename)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ from shutil import copyfile
 | 
			
		|||
from utils import get_full_domain
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import get_config_param
 | 
			
		||||
from utils import get_alt_path
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ def htmlConfirmDelete(cssCache: {},
 | 
			
		|||
    domain, port = getDomainFromActor(actor)
 | 
			
		||||
    domain_full = get_full_domain(domain, port)
 | 
			
		||||
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if not postFilename:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ from utils import isRecentPost
 | 
			
		|||
from utils import get_config_param
 | 
			
		||||
from utils import get_full_domain
 | 
			
		||||
from utils import is_editor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import load_json
 | 
			
		||||
from utils import getCachedPostDirectory
 | 
			
		||||
from utils import getCachedPostFilename
 | 
			
		||||
| 
						 | 
				
			
			@ -1537,7 +1537,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
 | 
			
		|||
            return postHtml
 | 
			
		||||
 | 
			
		||||
        announceFilename = \
 | 
			
		||||
            locatePost(base_dir, nickname, domain, post_json_object['id'])
 | 
			
		||||
            locate_post(base_dir, nickname, domain, post_json_object['id'])
 | 
			
		||||
        if announceFilename:
 | 
			
		||||
            updateAnnounceCollection(recent_posts_cache,
 | 
			
		||||
                                     base_dir, announceFilename,
 | 
			
		||||
| 
						 | 
				
			
			@ -2079,8 +2079,8 @@ def htmlIndividualPost(cssCache: {},
 | 
			
		|||
    if has_object_dict(post_json_object):
 | 
			
		||||
        while post_json_object['object'].get('inReplyTo'):
 | 
			
		||||
            postFilename = \
 | 
			
		||||
                locatePost(base_dir, nickname, domain,
 | 
			
		||||
                           post_json_object['object']['inReplyTo'])
 | 
			
		||||
                locate_post(base_dir, nickname, domain,
 | 
			
		||||
                            post_json_object['object']['inReplyTo'])
 | 
			
		||||
            if not postFilename:
 | 
			
		||||
                break
 | 
			
		||||
            post_json_object = load_json(postFilename)
 | 
			
		||||
| 
						 | 
				
			
			@ -2108,7 +2108,7 @@ def htmlIndividualPost(cssCache: {},
 | 
			
		|||
                                         cw_lists, lists_enabled) + postStr
 | 
			
		||||
 | 
			
		||||
    # show the following posts
 | 
			
		||||
    postFilename = locatePost(base_dir, nickname, domain, messageId)
 | 
			
		||||
    postFilename = locate_post(base_dir, nickname, domain, messageId)
 | 
			
		||||
    if postFilename:
 | 
			
		||||
        # is there a replies file for this post?
 | 
			
		||||
        repliesFilename = postFilename.replace('.json', '.replies')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ from utils import is_editor
 | 
			
		|||
from utils import load_json
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
from utils import getNicknameFromActor
 | 
			
		||||
from utils import locatePost
 | 
			
		||||
from utils import locate_post
 | 
			
		||||
from utils import isPublicPost
 | 
			
		||||
from utils import firstParagraphFromString
 | 
			
		||||
from utils import searchBoxPosts
 | 
			
		||||
| 
						 | 
				
			
			@ -831,7 +831,7 @@ def htmlHashtagSearch(cssCache: {},
 | 
			
		|||
                continue
 | 
			
		||||
            nickname = postFields[1]
 | 
			
		||||
            post_id = postFields[2]
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            index += 1
 | 
			
		||||
            continue
 | 
			
		||||
| 
						 | 
				
			
			@ -956,7 +956,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
 | 
			
		|||
                continue
 | 
			
		||||
            nickname = postFields[1]
 | 
			
		||||
            post_id = postFields[2]
 | 
			
		||||
        postFilename = locatePost(base_dir, nickname, domain, post_id)
 | 
			
		||||
        postFilename = locate_post(base_dir, nickname, domain, post_id)
 | 
			
		||||
        if not postFilename:
 | 
			
		||||
            index += 1
 | 
			
		||||
            if index >= maxFeedLength:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue