Snake case

merge-requests/30/head
Bob Mottram 2022-01-02 14:51:02 +00:00
parent 0d4088705f
commit 6326203952
10 changed files with 614 additions and 607 deletions

View File

@ -2200,21 +2200,21 @@ if args.followers:
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
wfRequest = webfinger_handle(session, handle,
wf_request = webfinger_handle(session, handle,
http_prefix, cached_webfingers,
hostDomain, __version__, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
print('Unable to webfinger ' + handle)
sys.exit()
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
str(wf_request))
sys.exit()
personUrl = None
if wfRequest.get('errors'):
print('wfRequest error: ' + str(wfRequest['errors']))
if wf_request.get('errors'):
print('wf_request error: ' + str(wf_request['errors']))
if has_users_path(args.followers):
personUrl = originalActor
else:
@ -2225,7 +2225,7 @@ if args.followers:
'Accept': 'application/activity+json; profile="' + profileStr + '"'
}
if not personUrl:
personUrl = get_user_url(wfRequest, 0, args.debug)
personUrl = get_user_url(wf_request, 0, args.debug)
if nickname == domain:
personUrl = personUrl.replace('/users/', '/actor/')
personUrl = personUrl.replace('/accounts/', '/actor/')

1033
follow.py

File diff suppressed because it is too large Load Diff

24
like.py
View File

@ -198,27 +198,27 @@ def send_like_via_server(base_dir: str, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = webfinger_handle(session, handle, http_prefix,
wf_request = webfinger_handle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: like webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: like webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
(inboxUrl, _, _, fromPersonId, _, _,
_, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache,
project_version, http_prefix,
fromNickname, fromDomain,
@ -285,18 +285,18 @@ def send_undo_like_via_server(base_dir: str, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = webfinger_handle(session, handle, http_prefix,
wf_request = webfinger_handle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: unlike webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
if debug:
print('WARN: unlike webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -306,7 +306,7 @@ def send_undo_like_via_server(base_dir: str, session,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, fromNickname,
fromDomain, postToBox,

View File

@ -60,26 +60,26 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
return ctr
if handle.startswith('@'):
handle = handle[1:]
wfRequest = webfinger_handle(session, handle,
wf_request = webfinger_handle(session, handle,
http_prefix, cached_webfingers,
domain, __version__, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
print('updateMovedHandle unable to webfinger ' + handle)
return ctr
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('updateMovedHandle webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return ctr
personUrl = None
if wfRequest.get('errors'):
print('wfRequest error: ' + str(wfRequest['errors']))
if wf_request.get('errors'):
print('wf_request error: ' + str(wf_request['errors']))
return ctr
if not personUrl:
personUrl = get_user_url(wfRequest, 0, debug)
personUrl = get_user_url(wf_request, 0, debug)
if not personUrl:
return ctr

View File

@ -1523,7 +1523,7 @@ def get_actor_json(hostDomain: str, handle: str, http: bool, gnunet: bool,
nickname = domain
personUrl = None
wfRequest = None
wf_request = None
if '://' in originalActor and \
originalActor.lower().endswith('/actor'):
@ -1536,27 +1536,27 @@ def get_actor_json(hostDomain: str, handle: str, http: bool, gnunet: bool,
personUrl = originalActor
else:
handle = nickname + '@' + domain
wfRequest = webfinger_handle(session, handle,
wf_request = webfinger_handle(session, handle,
http_prefix, cached_webfingers,
hostDomain, __version__, debug,
group_account, signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if not quiet:
print('get_actor_json Unable to webfinger ' + handle)
return None, None
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
if not quiet:
print('get_actor_json Webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return None, None
if not quiet:
pprint(wfRequest)
pprint(wf_request)
if wfRequest.get('errors'):
if wf_request.get('errors'):
if not quiet or debug:
print('get_actor_json wfRequest error: ' +
str(wfRequest['errors']))
print('get_actor_json wf_request error: ' +
str(wf_request['errors']))
if has_users_path(handle):
personUrl = originalActor
else:
@ -1568,8 +1568,8 @@ def get_actor_json(hostDomain: str, handle: str, http: bool, gnunet: bool,
headersList = (
"activity+json", "ld+json", "jrd+json"
)
if not personUrl and wfRequest:
personUrl = get_user_url(wfRequest, 0, debug)
if not personUrl and wf_request:
personUrl = get_user_url(wf_request, 0, debug)
if nickname == domain:
paths = get_user_paths()
for userPath in paths:

10
pgp.py
View File

@ -556,19 +556,19 @@ def pgp_public_key_upload(base_dir: str, session,
print('actor update is ' + str(actorUpdate))
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix, cached_webfingers,
domain, __version__, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: pgp actor update webfinger failed for ' +
handle)
return None
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
if debug:
print('WARN: Webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return None
postToBox = 'outbox'
@ -577,7 +577,7 @@ def pgp_public_key_upload(base_dir: str, session,
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem, originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache,
__version__, http_prefix, nickname,
domain, postToBox, 35725)

View File

@ -609,18 +609,18 @@ def send_share_via_server(base_dir, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: share webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: share webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -630,7 +630,7 @@ def send_share_via_server(base_dir, session,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, fromNickname,
fromDomain, postToBox,
@ -714,17 +714,17 @@ def send_undo_share_via_server(base_dir: str, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: unshare webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: unshare webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -734,7 +734,7 @@ def send_undo_share_via_server(base_dir: str, session,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, fromNickname,
fromDomain, postToBox,
@ -829,18 +829,18 @@ def send_wanted_via_server(base_dir, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: share webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: wanted webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -850,7 +850,7 @@ def send_wanted_via_server(base_dir, session,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, fromNickname,
fromDomain, postToBox,
@ -934,17 +934,17 @@ def send_undo_wanted_via_server(base_dir: str, session,
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: unwant webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: unwant webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -954,7 +954,7 @@ def send_undo_wanted_via_server(base_dir: str, session,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, fromNickname,
fromDomain, postToBox,

View File

@ -207,18 +207,18 @@ def send_skill_via_server(base_dir: str, session, nickname: str, password: str,
handle = http_prefix + '://' + domain_full + '/@' + nickname
# lookup the inbox for the To handle
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
if debug:
print('DEBUG: skill webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('WARN: skill webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
' did not return a dict. ' + str(wf_request))
return 1
postToBox = 'outbox'
@ -228,7 +228,7 @@ def send_skill_via_server(base_dir: str, session, nickname: str, password: str,
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache, project_version,
http_prefix, nickname, domain,
postToBox, 76121)

View File

@ -51,23 +51,23 @@ def instances_graph(base_dir: str, handles: str,
domain_full = get_full_domain(domain, port)
handle = http_prefix + "://" + domain_full + "/@" + nickname
wfRequest = \
wf_request = \
webfinger_handle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signing_priv_key_pem)
if not wfRequest:
if not wf_request:
return dotGraphStr + '}\n'
if not isinstance(wfRequest, dict):
if not isinstance(wf_request, dict):
print('Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
str(wf_request))
return dotGraphStr + '}\n'
originDomain = None
(personUrl, pubKeyId, pubKey, personId, shaedInbox, avatarUrl,
displayName, _) = get_person_box(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
base_dir, session, wf_request,
person_cache,
project_version, http_prefix,
nickname, domain, 'outbox',

View File

@ -33,7 +33,7 @@ from session import create_session
def html_moderation(css_cache: {}, default_timeline: str,
recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, wfRequest: {}, person_cache: {},
session, base_dir: str, wf_request: {}, person_cache: {},
nickname: str, domain: str, port: int, inboxJson: {},
allow_deletion: bool,
http_prefix: str, project_version: str,
@ -63,7 +63,7 @@ def html_moderation(css_cache: {}, default_timeline: str,
recent_posts_cache, max_recent_posts,
translate, pageNumber,
itemsPerPage, session, base_dir,
wfRequest, person_cache,
wf_request, person_cache,
nickname, domain, port, inboxJson, 'moderation',
allow_deletion, http_prefix,
project_version, True, False,