Snake case

main
Bob Mottram 2021-12-27 20:47:05 +00:00
parent 5ce15ffbed
commit 602ab1ad58
10 changed files with 27 additions and 27 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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:

View File

@ -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 + '"')

View File

@ -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

View File

@ -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: