mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
54d903a47c
commit
b71d662d8e
|
@ -20,7 +20,7 @@ from utils import acct_dir
|
|||
from utils import hasGroupType
|
||||
from utils import local_actor_url
|
||||
from utils import hasActor
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
|
||||
|
||||
def _create_accept_reject(base_dir: str, federation_list: [],
|
||||
|
@ -79,7 +79,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
|||
federation_list: [], debug: bool) -> None:
|
||||
"""Receiving a follow Accept activity
|
||||
"""
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Follow':
|
||||
if not message_json['object']['type'] == 'Join':
|
||||
|
|
|
@ -25,7 +25,7 @@ from utils import updateAnnounceCollection
|
|||
from utils import local_actor_url
|
||||
from utils import replaceUsersWithAt
|
||||
from utils import hasActor
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from posts import sendSignedJson
|
||||
from posts import getPersonBox
|
||||
from session import postJson
|
||||
|
@ -82,7 +82,7 @@ def outboxAnnounce(recentPostsCache: {},
|
|||
nickname, domain, debug)
|
||||
return True
|
||||
elif message_json['type'] == 'Undo':
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if message_json['object']['type'] == 'Announce':
|
||||
if not isinstance(message_json['object']['object'], str):
|
||||
|
@ -396,7 +396,7 @@ def outboxUndoAnnounce(recentPostsCache: {},
|
|||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Announce':
|
||||
if debug:
|
||||
|
|
|
@ -12,7 +12,7 @@ from webfinger import webfingerHandle
|
|||
from auth import createBasicAuthHeader
|
||||
from posts import getPersonBox
|
||||
from session import postJson
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import getDomainFromActor
|
||||
|
@ -64,7 +64,7 @@ def outboxAvailability(base_dir: str, nickname: str, message_json: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
|
||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||
|
|
16
blocking.py
16
blocking.py
|
@ -11,9 +11,9 @@ import os
|
|||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import has_object_dict
|
||||
from utils import isAccountDir
|
||||
|
@ -427,7 +427,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: not a block')
|
||||
return False
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
if debug:
|
||||
print('DEBUG: c2s block request arrived in outbox')
|
||||
|
@ -477,7 +477,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
|
|||
print('DEBUG: not an undo block')
|
||||
return
|
||||
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Block':
|
||||
if debug:
|
||||
|
@ -540,7 +540,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if has_object_dict(post_json_object):
|
||||
postJsonObj = post_json_object['object']
|
||||
else:
|
||||
if hasObjectString(post_json_object, debug):
|
||||
if has_object_string(post_json_object, debug):
|
||||
alsoUpdatePostId = removeIdEnding(post_json_object['object'])
|
||||
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -679,7 +679,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if has_object_dict(post_json_object):
|
||||
postJsonObj = post_json_object['object']
|
||||
else:
|
||||
if hasObjectString(post_json_object, debug):
|
||||
if has_object_string(post_json_object, debug):
|
||||
alsoUpdatePostId = removeIdEnding(post_json_object['object'])
|
||||
|
||||
if postJsonObj.get('conversation'):
|
||||
|
@ -783,7 +783,7 @@ def outboxMute(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not message_json['type'] == 'Ignore':
|
||||
return
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return
|
||||
if debug:
|
||||
print('DEBUG: c2s mute request arrived in outbox')
|
||||
|
@ -832,7 +832,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if message_json['object']['type'] != 'Ignore':
|
||||
return
|
||||
|
|
|
@ -27,7 +27,7 @@ from utils import has_object_dict
|
|||
from utils import acct_dir
|
||||
from utils import local_actor_url
|
||||
from utils import hasActor
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from posts import getPersonBox
|
||||
from session import postJson
|
||||
|
||||
|
@ -566,7 +566,7 @@ def outboxBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: no target in bookmark Add')
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not isinstance(message_json['target'], str):
|
||||
if debug:
|
||||
|
@ -622,7 +622,7 @@ def outboxUndoBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: no target in unbookmark Remove')
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not isinstance(message_json['target'], str):
|
||||
if debug:
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
|
|||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import removeDomainPort
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -127,7 +127,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: not a delete')
|
||||
return
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return
|
||||
if debug:
|
||||
print('DEBUG: c2s delete request arrived in outbox')
|
||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "ActivityPub"
|
|||
from pprint import pprint
|
||||
import os
|
||||
from utils import has_object_string_object
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -1385,7 +1385,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
|
|||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Follow':
|
||||
if not message_json['object']['type'] == 'Join':
|
||||
|
|
4
git.py
4
git.py
|
@ -10,7 +10,7 @@ __module_group__ = "Profile Metadata"
|
|||
import os
|
||||
import html
|
||||
from utils import acct_dir
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
|
||||
|
||||
def _gitFormatContent(content: str) -> str:
|
||||
|
@ -116,7 +116,7 @@ def convertPostToPatch(base_dir: str, nickname: str, domain: str,
|
|||
"""Detects whether the given post contains a patch
|
||||
and if so then converts it to a Patch ActivityPub type
|
||||
"""
|
||||
if not hasObjectStringType(post_json_object, False):
|
||||
if not has_object_stringType(post_json_object, False):
|
||||
return False
|
||||
if post_json_object['object']['type'] == 'Patch':
|
||||
return True
|
||||
|
|
24
inbox.py
24
inbox.py
|
@ -23,7 +23,7 @@ from utils import isSystemAccount
|
|||
from utils import invalidCiphertext
|
||||
from utils import removeHtml
|
||||
from utils import fileLastModified
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import getReplyIntervalHours
|
||||
from utils import canReplyTo
|
||||
|
@ -60,7 +60,7 @@ from utils import undoLikesCollectionEntry
|
|||
from utils import undoReactionCollectionEntry
|
||||
from utils import hasGroupType
|
||||
from utils import local_actor_url
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from categories import getHashtagCategories
|
||||
from categories import setHashtagCategory
|
||||
from httpsig import getDigestAlgorithmFromHeaders
|
||||
|
@ -811,7 +811,7 @@ def _receiveUndo(session, base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: "users" or "profile" missing from actor')
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if not has_object_string_object(message_json, debug):
|
||||
return False
|
||||
|
@ -951,7 +951,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if not has_users_path(message_json['actor']):
|
||||
if debug:
|
||||
|
@ -1015,7 +1015,7 @@ def _receiveLike(recentPostsCache: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
if not message_json.get('to'):
|
||||
if debug:
|
||||
|
@ -1137,7 +1137,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if message_json['object']['type'] != 'Like':
|
||||
return False
|
||||
|
@ -1249,7 +1249,7 @@ def _receiveReaction(recentPostsCache: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
if not message_json.get('to'):
|
||||
if debug:
|
||||
|
@ -1398,7 +1398,7 @@ def _receiveUndoReaction(recentPostsCache: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if message_json['object']['type'] != 'EmojiReact':
|
||||
return False
|
||||
|
@ -1530,7 +1530,7 @@ def _receiveBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: no target in inbox bookmark Add')
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if not isinstance(message_json['target'], str):
|
||||
if debug:
|
||||
|
@ -1642,7 +1642,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: no target in inbox undo bookmark Remove')
|
||||
return False
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return False
|
||||
if not isinstance(message_json['target'], str):
|
||||
if debug:
|
||||
|
@ -1739,7 +1739,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
return False
|
||||
if debug:
|
||||
print('DEBUG: Delete activity arrived')
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
domain_full = get_full_domain(domain, port)
|
||||
deletePrefix = http_prefix + '://' + domain_full + '/'
|
||||
|
@ -1829,7 +1829,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
return False
|
||||
if debug:
|
||||
print('DEBUG: receiving announce on ' + handle)
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
if not message_json.get('to'):
|
||||
if debug:
|
||||
|
|
8
like.py
8
like.py
|
@ -9,9 +9,9 @@ __module_group__ = "ActivityPub"
|
|||
|
||||
import os
|
||||
from pprint import pprint
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import has_object_dict
|
||||
from utils import has_users_path
|
||||
|
@ -353,7 +353,7 @@ def outboxLike(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: not a like')
|
||||
return
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return
|
||||
if debug:
|
||||
print('DEBUG: c2s like request arrived in outbox')
|
||||
|
@ -384,7 +384,7 @@ def outboxUndoLike(recentPostsCache: {},
|
|||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Like':
|
||||
if debug:
|
||||
|
|
|
@ -16,7 +16,7 @@ from posts import outboxMessageCreateWrap
|
|||
from posts import savePostToBox
|
||||
from posts import sendToFollowersThread
|
||||
from posts import sendToNamedAddressesThread
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import get_base_content_from_post
|
||||
from utils import has_object_dict
|
||||
from utils import getLocalNetworkAddresses
|
||||
|
@ -76,7 +76,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
|||
return
|
||||
if message_json['type'] != 'Update':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not isinstance(message_json['object']['type'], str):
|
||||
if debug:
|
||||
|
|
8
posts.py
8
posts.py
|
@ -34,7 +34,7 @@ from siteactive import siteIsActive
|
|||
from languages import understoodPostLanguage
|
||||
from utils import get_user_paths
|
||||
from utils import invalidCiphertext
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import removeIdEnding
|
||||
from utils import replaceUsersWithAt
|
||||
from utils import hasGroupType
|
||||
|
@ -2850,7 +2850,7 @@ def _isProfileUpdate(post_json_object: {}) -> bool:
|
|||
for actor updates there is no 'to' within the object
|
||||
"""
|
||||
if post_json_object.get('type'):
|
||||
if hasObjectStringType(post_json_object, False):
|
||||
if has_object_stringType(post_json_object, False):
|
||||
if (post_json_object['type'] == 'Update' and
|
||||
(post_json_object['object']['type'] == 'Person' or
|
||||
post_json_object['object']['type'] == 'Application' or
|
||||
|
@ -2891,7 +2891,7 @@ def _sendToNamedAddresses(session, base_dir: str,
|
|||
pprint(post_json_object)
|
||||
print('DEBUG: ' +
|
||||
'no "to" field when sending to named addresses')
|
||||
if hasObjectStringType(post_json_object, debug):
|
||||
if has_object_stringType(post_json_object, debug):
|
||||
if post_json_object['object']['type'] == 'Follow' or \
|
||||
post_json_object['object']['type'] == 'Join':
|
||||
post_json_obj2 = post_json_object['object']['object']
|
||||
|
@ -3077,7 +3077,7 @@ def _sendingProfileUpdate(post_json_object: {}) -> bool:
|
|||
"""
|
||||
if post_json_object['type'] != 'Update':
|
||||
return False
|
||||
if not hasObjectStringType(post_json_object, False):
|
||||
if not has_object_stringType(post_json_object, False):
|
||||
return False
|
||||
activityType = post_json_object['object']['type']
|
||||
if activityType == 'Person' or \
|
||||
|
|
|
@ -11,9 +11,9 @@ import os
|
|||
import re
|
||||
import urllib.parse
|
||||
from pprint import pprint
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import has_object_dict
|
||||
from utils import has_users_path
|
||||
|
@ -368,7 +368,7 @@ def outboxReaction(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: not a reaction')
|
||||
return
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return
|
||||
if not message_json.get('content'):
|
||||
return
|
||||
|
@ -408,7 +408,7 @@ def outboxUndoReaction(recentPostsCache: {},
|
|||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'EmojiReact':
|
||||
if debug:
|
||||
|
|
|
@ -22,7 +22,7 @@ from posts import getPersonBox
|
|||
from session import postJson
|
||||
from session import postImage
|
||||
from session import createSession
|
||||
from utils import hasObjectStringType
|
||||
from utils import has_object_stringType
|
||||
from utils import dateStringToSeconds
|
||||
from utils import dateSecondsToString
|
||||
from utils import get_config_param
|
||||
|
@ -1039,7 +1039,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not message_json['type'] == 'Add':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Offer':
|
||||
if debug:
|
||||
|
@ -1108,7 +1108,7 @@ def outboxUndoShareUpload(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not message_json['type'] == 'Remove':
|
||||
return
|
||||
if not hasObjectStringType(message_json, debug):
|
||||
if not has_object_stringType(message_json, debug):
|
||||
return
|
||||
if not message_json['object']['type'] == 'Offer':
|
||||
if debug:
|
||||
|
|
|
@ -12,7 +12,7 @@ from webfinger import webfingerHandle
|
|||
from auth import createBasicAuthHeader
|
||||
from posts import getPersonBox
|
||||
from session import postJson
|
||||
from utils import hasObjectString
|
||||
from utils import has_object_string
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import getDomainFromActor
|
||||
|
@ -154,7 +154,7 @@ def outboxSkills(base_dir: str, nickname: str, message_json: {},
|
|||
return False
|
||||
if not hasActor(message_json, debug):
|
||||
return False
|
||||
if not hasObjectString(message_json, debug):
|
||||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
|
||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||
|
|
10
utils.py
10
utils.py
|
@ -2084,7 +2084,7 @@ def isBlogPost(post_json_object: {}) -> bool:
|
|||
return False
|
||||
if not has_object_dict(post_json_object):
|
||||
return False
|
||||
if not hasObjectStringType(post_json_object, False):
|
||||
if not has_object_stringType(post_json_object, False):
|
||||
return False
|
||||
if not post_json_object['object'].get('content'):
|
||||
return False
|
||||
|
@ -3175,12 +3175,12 @@ def hasActor(post_json_object: {}, debug: bool) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def hasObjectStringType(post_json_object: {}, debug: bool) -> bool:
|
||||
def has_object_stringType(post_json_object: {}, debug: bool) -> bool:
|
||||
"""Does the given post have a type field within an object dict?
|
||||
"""
|
||||
if not has_object_dict(post_json_object):
|
||||
if debug:
|
||||
print('hasObjectStringType no object found')
|
||||
print('has_object_stringType no object found')
|
||||
return False
|
||||
if post_json_object['object'].get('type'):
|
||||
if isinstance(post_json_object['object']['type'], str):
|
||||
|
@ -3199,7 +3199,7 @@ def has_object_string_object(post_json_object: {}, debug: bool) -> bool:
|
|||
"""
|
||||
if not has_object_dict(post_json_object):
|
||||
if debug:
|
||||
print('hasObjectStringType no object found')
|
||||
print('has_object_stringType no object found')
|
||||
return False
|
||||
if post_json_object['object'].get('object'):
|
||||
if isinstance(post_json_object['object']['object'], str):
|
||||
|
@ -3213,7 +3213,7 @@ def has_object_string_object(post_json_object: {}, debug: bool) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def hasObjectString(post_json_object: {}, debug: bool) -> bool:
|
||||
def has_object_string(post_json_object: {}, debug: bool) -> bool:
|
||||
"""Does the given post have an object string field?
|
||||
"""
|
||||
if post_json_object.get('object'):
|
||||
|
|
Loading…
Reference in New Issue