From 602ab1ad58cf831380acbe18f9711d061e2238a8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Dec 2021 20:47:05 +0000 Subject: [PATCH] Snake case --- acceptreject.py | 4 ++-- announce.py | 4 ++-- bookmarks.py | 6 +++--- daemon.py | 4 ++-- inbox.py | 6 +++--- like.py | 4 ++-- posts.py | 14 +++++++------- reaction.py | 4 ++-- session.py | 6 +++--- utils.py | 2 +- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/acceptreject.py b/acceptreject.py index e3ea4ac9a..ccda818a0 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -11,7 +11,7 @@ import os from utils import has_object_string_object from utils import has_users_path from utils import get_full_domain -from utils import urlPermitted +from utils import url_permitted from utils import get_domain_from_actor from utils import getNicknameFromActor from utils import domain_permitted @@ -36,7 +36,7 @@ def _create_accept_reject(base_dir: str, federation_list: [], if not objectJson.get('actor'): return None - if not urlPermitted(objectJson['actor'], federation_list): + if not url_permitted(objectJson['actor'], federation_list): return None domain = get_full_domain(domain, port) diff --git a/announce.py b/announce.py index 1eec58b6a..1bcb1f019 100644 --- a/announce.py +++ b/announce.py @@ -15,7 +15,7 @@ from utils import has_users_path from utils import get_full_domain from utils import get_status_number from utils import create_outbox_dir -from utils import urlPermitted +from utils import url_permitted from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import locate_post @@ -131,7 +131,7 @@ def createAnnounce(session, base_dir: str, federation_list: [], followers url objectUrl is typically the url of the message, corresponding to url or atomUri in createPostBase """ - if not urlPermitted(objectUrl, federation_list): + if not url_permitted(objectUrl, federation_list): return None domain = remove_domain_port(domain) diff --git a/bookmarks.py b/bookmarks.py index 056624a4a..dd34e9504 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -16,7 +16,7 @@ from utils import has_users_path from utils import get_full_domain from utils import remove_id_ending from utils import remove_post_from_cache -from utils import urlPermitted +from utils import url_permitted from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import locate_post @@ -264,7 +264,7 @@ def bookmark(recent_posts_cache: {}, 'to' might be a specific person (actor) whose post was bookmarked object is typically the url of the message which was bookmarked """ - if not urlPermitted(objectUrl, federation_list): + if not url_permitted(objectUrl, federation_list): return None fullDomain = get_full_domain(domain, port) @@ -324,7 +324,7 @@ def undoBookmark(recent_posts_cache: {}, 'to' might be a specific person (actor) whose post was bookmarked object is typically the url of the message which was bookmarked """ - if not urlPermitted(objectUrl, federation_list): + if not url_permitted(objectUrl, federation_list): return None fullDomain = get_full_domain(domain, port) diff --git a/daemon.py b/daemon.py index 8ccad81ff..0984f7498 100644 --- a/daemon.py +++ b/daemon.py @@ -296,7 +296,7 @@ from utils import remove_post_from_cache from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import get_status_number -from utils import urlPermitted +from utils import url_permitted from utils import load_json from utils import save_json from utils import is_suspended @@ -722,7 +722,7 @@ class PubServer(BaseHTTPRequestHandler): return False # is the keyId (actor) valid? - if not urlPermitted(keyId, self.server.federation_list): + if not url_permitted(keyId, self.server.federation_list): if self.server.debug: print('AUTH: Secure mode GET request not permitted: ' + keyId) return False diff --git a/inbox.py b/inbox.py index 4d3f3748f..2ef02b52d 100644 --- a/inbox.py +++ b/inbox.py @@ -46,7 +46,7 @@ from utils import remove_avatar_from_cache from utils import isPublicPost from utils import get_cached_post_filename from utils import remove_post_from_cache -from utils import urlPermitted +from utils import url_permitted from utils import create_inbox_queue_dir from utils import get_status_number from utils import get_domain_from_actor @@ -430,7 +430,7 @@ def inboxPermittedMessage(domain: str, message_json: {}, if domain in actor: return True - if not urlPermitted(actor, federation_list): + if not url_permitted(actor, federation_list): return False alwaysAllowedTypes = ( @@ -443,7 +443,7 @@ def inboxPermittedMessage(domain: str, message_json: {}, inReplyTo = message_json['object']['inReplyTo'] if not isinstance(inReplyTo, str): return False - if not urlPermitted(inReplyTo, federation_list): + if not url_permitted(inReplyTo, federation_list): return False return True diff --git a/like.py b/like.py index f77189acf..acf9d4eca 100644 --- a/like.py +++ b/like.py @@ -17,7 +17,7 @@ from utils import has_object_dict from utils import has_users_path from utils import get_full_domain from utils import remove_id_ending -from utils import urlPermitted +from utils import url_permitted from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import locate_post @@ -83,7 +83,7 @@ def _like(recent_posts_cache: {}, 'to' might be a specific person (actor) whose post was liked object is typically the url of the message which was liked """ - if not urlPermitted(objectUrl, federation_list): + if not url_permitted(objectUrl, federation_list): return None fullDomain = get_full_domain(domain, port) diff --git a/posts.py b/posts.py index a81c309e8..96e20c7bf 100644 --- a/posts.py +++ b/posts.py @@ -53,7 +53,7 @@ from utils import get_followers_list from utils import is_evil from utils import get_status_number from utils import create_person_dir -from utils import urlPermitted +from utils import url_permitted from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import deletePost @@ -610,8 +610,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, if tagItem.get('name') and tagItem.get('icon'): if tagItem['icon'].get('url'): # No emoji from non-permitted domains - if urlPermitted(tagItem['icon']['url'], - federation_list): + if url_permitted(tagItem['icon']['url'], + federation_list): emojiName = tagItem['name'] emojiIcon = tagItem['icon']['url'] emoji[emojiName] = emojiIcon @@ -640,8 +640,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, if thisItem['inReplyTo']: if isinstance(thisItem['inReplyTo'], str): # No replies to non-permitted domains - if not urlPermitted(thisItem['inReplyTo'], - federation_list): + if not url_permitted(thisItem['inReplyTo'], + federation_list): if debug: print('url not permitted ' + thisItem['inReplyTo']) @@ -653,8 +653,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, for attach in thisItem['attachment']: if attach.get('name') and attach.get('url'): # no attachments from non-permitted domains - if urlPermitted(attach['url'], - federation_list): + if url_permitted(attach['url'], + federation_list): attachment.append([attach['name'], attach['url']]) else: diff --git a/reaction.py b/reaction.py index e8ab7cdbc..0450421db 100644 --- a/reaction.py +++ b/reaction.py @@ -19,7 +19,7 @@ from utils import has_object_dict from utils import has_users_path from utils import get_full_domain from utils import remove_id_ending -from utils import urlPermitted +from utils import url_permitted from utils import getNicknameFromActor from utils import get_domain_from_actor from utils import locate_post @@ -76,7 +76,7 @@ def _reaction(recent_posts_cache: {}, 'to' might be a specific person (actor) whose post was reaction object is typically the url of the message which was reaction """ - if not urlPermitted(objectUrl, federation_list): + if not url_permitted(objectUrl, federation_list): return None if not validEmojiContent(emojiContent): print('_reaction: Invalid emoji reaction: "' + emojiContent + '"') diff --git a/session.py b/session.py index 9ecdcc547..eb47964e7 100644 --- a/session.py +++ b/session.py @@ -9,7 +9,7 @@ __module_group__ = "Session" import os import requests -from utils import urlPermitted +from utils import url_permitted from utils import is_image_file from httpsig import createSignedHeader import json @@ -297,7 +297,7 @@ def postJson(http_prefix: str, domain_full: str, """Post a json message to the inbox of another person """ # check that we are posting to a permitted domain - if not urlPermitted(inboxUrl, federation_list): + if not url_permitted(inboxUrl, federation_list): if not quiet: print('postJson: ' + inboxUrl + ' not permitted') return None @@ -394,7 +394,7 @@ def postImage(session, attachImageFilename: str, federation_list: [], """Post an image to the inbox of another person or outbox via c2s """ # check that we are posting to a permitted domain - if not urlPermitted(inboxUrl, federation_list): + if not url_permitted(inboxUrl, federation_list): print('postJson: ' + inboxUrl + ' not permitted') return None diff --git a/utils.py b/utils.py index f9b7d0d84..93fead4cc 100644 --- a/utils.py +++ b/utils.py @@ -823,7 +823,7 @@ def domain_permitted(domain: str, federation_list: []) -> bool: return False -def urlPermitted(url: str, federation_list: []): +def url_permitted(url: str, federation_list: []): if is_evil(url): return False if not federation_list: