mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
ee5cbb2c5d
commit
a5dcac8679
|
@ -81,7 +81,7 @@ def _getMastoApiV1Account(base_dir: str, nickname: str, domain: str) -> {}:
|
|||
return mastoAccountJson
|
||||
|
||||
|
||||
def mastoApiV1Response(path: str, callingDomain: str,
|
||||
def mastoApiV1Response(path: str, calling_domain: str,
|
||||
uaStr: str,
|
||||
authorized: bool,
|
||||
http_prefix: str,
|
||||
|
@ -112,7 +112,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
'masto API account sent for ' + nickname + ' ' + uaStr
|
||||
|
||||
# information about where the request is coming from
|
||||
callingInfo = ' ' + uaStr + ', ' + callingDomain
|
||||
callingInfo = ' ' + uaStr + ', ' + calling_domain
|
||||
|
||||
# Parts of the api which don't need authorization
|
||||
mastoId = _getMastApiV1Id(path)
|
||||
|
@ -207,10 +207,10 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
get_config_param(base_dir, 'instanceDescription')
|
||||
instanceTitle = get_config_param(base_dir, 'instanceTitle')
|
||||
|
||||
if callingDomain.endswith('.onion') and onion_domain:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
domain_full = onion_domain
|
||||
http_prefix = 'http'
|
||||
elif (callingDomain.endswith('.i2p') and i2p_domain):
|
||||
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
||||
domain_full = i2p_domain
|
||||
http_prefix = 'http'
|
||||
|
||||
|
|
10
shares.py
10
shares.py
|
@ -1485,7 +1485,7 @@ def createSharedItemFederationToken(base_dir: str,
|
|||
def authorizeSharedItems(shared_items_federated_domains: [],
|
||||
base_dir: str,
|
||||
originDomainFull: str,
|
||||
callingDomainFull: str,
|
||||
calling_domainFull: str,
|
||||
authHeader: str,
|
||||
debug: bool,
|
||||
tokensJson: {} = None) -> bool:
|
||||
|
@ -1525,16 +1525,16 @@ def authorizeSharedItems(shared_items_federated_domains: [],
|
|||
tokensJson = load_json(tokensFilename, 1, 2)
|
||||
if not tokensJson:
|
||||
return False
|
||||
if not tokensJson.get(callingDomainFull):
|
||||
if not tokensJson.get(calling_domainFull):
|
||||
if debug:
|
||||
print('DEBUG: shared item federation token ' +
|
||||
'check failed for ' + callingDomainFull)
|
||||
'check failed for ' + calling_domainFull)
|
||||
return False
|
||||
if not constantTimeStringCheck(tokensJson[callingDomainFull],
|
||||
if not constantTimeStringCheck(tokensJson[calling_domainFull],
|
||||
providedToken):
|
||||
if debug:
|
||||
print('DEBUG: shared item federation token ' +
|
||||
'mismatch for ' + callingDomainFull)
|
||||
'mismatch for ' + calling_domainFull)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
18
utils.py
18
utils.py
|
@ -2859,18 +2859,18 @@ def has_object_dict(post_json_object: {}) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def getAltPath(actor: str, domain_full: str, callingDomain: str) -> str:
|
||||
def getAltPath(actor: str, domain_full: str, calling_domain: str) -> str:
|
||||
"""Returns alternate path from the actor
|
||||
eg. https://clearnetdomain/path becomes http://oniondomain/path
|
||||
"""
|
||||
postActor = actor
|
||||
if callingDomain not in actor and domain_full in actor:
|
||||
if callingDomain.endswith('.onion') or \
|
||||
callingDomain.endswith('.i2p'):
|
||||
postActor = \
|
||||
'http://' + callingDomain + actor.split(domain_full)[1]
|
||||
print('Changed POST domain from ' + actor + ' to ' + postActor)
|
||||
return postActor
|
||||
post_actor = actor
|
||||
if calling_domain not in actor and domain_full in actor:
|
||||
if calling_domain.endswith('.onion') or \
|
||||
calling_domain.endswith('.i2p'):
|
||||
post_actor = \
|
||||
'http://' + calling_domain + actor.split(domain_full)[1]
|
||||
print('Changed POST domain from ' + actor + ' to ' + post_actor)
|
||||
return post_actor
|
||||
|
||||
|
||||
def get_actor_property_url(actor_json: {}, property_name: str) -> str:
|
||||
|
|
|
@ -35,7 +35,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
|||
path: str, http_prefix: str,
|
||||
domain_full: str, postId: str, postTime: str,
|
||||
year: int, monthNumber: int,
|
||||
dayNumber: int, callingDomain: str) -> str:
|
||||
dayNumber: int, calling_domain: str) -> str:
|
||||
"""Shows a screen asking to confirm the deletion of a calendar event
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
|
@ -68,7 +68,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
|||
deletePostStr += ' <p class="followText">' + \
|
||||
translate['Delete this event'] + '</p>'
|
||||
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, calling_domain)
|
||||
deletePostStr += \
|
||||
' <form method="POST" action="' + postActor + '/rmpost">\n'
|
||||
deletePostStr += ' <input type="hidden" name="year" value="' + \
|
||||
|
|
|
@ -29,7 +29,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
session, base_dir: str, messageId: str,
|
||||
http_prefix: str, project_version: str,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
callingDomain: str,
|
||||
calling_domain: str,
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
show_published_date_only: bool,
|
||||
|
@ -85,7 +85,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
' <p class="followText">' + \
|
||||
translate['Delete this post?'] + '</p>'
|
||||
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, calling_domain)
|
||||
deletePostStr += \
|
||||
' <form method="POST" action="' + postActor + '/rmpost">\n'
|
||||
deletePostStr += \
|
||||
|
@ -108,7 +108,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
|
||||
def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
||||
actor: str, itemID: str,
|
||||
callingDomain: str,
|
||||
calling_domain: str,
|
||||
sharesFileType: str) -> str:
|
||||
"""Shows a screen asking to confirm the removal of a shared item
|
||||
"""
|
||||
|
@ -149,7 +149,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
|||
sharesStr += \
|
||||
' <p class="followText">' + translate['Remove'] + \
|
||||
' ' + sharedItemDisplayName + ' ?</p>\n'
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, calling_domain)
|
||||
if sharesFileType == 'shares':
|
||||
endpoint = 'rmshare'
|
||||
else:
|
||||
|
|
|
@ -134,12 +134,12 @@ def _matchSharedItem(searchStrLowerList: [],
|
|||
|
||||
|
||||
def _htmlSearchResultSharePage(actor: str, domain_full: str,
|
||||
callingDomain: str, pageNumber: int,
|
||||
calling_domain: str, pageNumber: int,
|
||||
searchStrLower: str, translate: {},
|
||||
previous: bool) -> str:
|
||||
"""Returns the html for the previous button on shared items search results
|
||||
"""
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, calling_domain)
|
||||
# previous page link, needs to be a POST
|
||||
if previous:
|
||||
pageNumber -= 1
|
||||
|
@ -172,7 +172,7 @@ def _htmlSearchResultSharePage(actor: str, domain_full: str,
|
|||
def _htmlSharesResult(base_dir: str,
|
||||
sharesJson: {}, pageNumber: int, resultsPerPage: int,
|
||||
searchStrLowerList: [], currPage: int, ctr: int,
|
||||
callingDomain: str, http_prefix: str, domain_full: str,
|
||||
calling_domain: str, http_prefix: str, domain_full: str,
|
||||
contactNickname: str, actor: str,
|
||||
resultsExist: bool, searchStrLower: str, translate: {},
|
||||
sharesFileType: str) -> (bool, int, int, str):
|
||||
|
@ -196,7 +196,7 @@ def _htmlSharesResult(base_dir: str,
|
|||
# show the previous page button
|
||||
sharedItemsForm += \
|
||||
_htmlSearchResultSharePage(actor, domain_full,
|
||||
callingDomain,
|
||||
calling_domain,
|
||||
pageNumber,
|
||||
searchStrLower,
|
||||
translate, True)
|
||||
|
@ -208,7 +208,7 @@ def _htmlSharesResult(base_dir: str,
|
|||
# show the next page button
|
||||
sharedItemsForm += \
|
||||
_htmlSearchResultSharePage(actor, domain_full,
|
||||
callingDomain,
|
||||
calling_domain,
|
||||
pageNumber,
|
||||
searchStrLower,
|
||||
translate, False)
|
||||
|
@ -223,7 +223,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
resultsPerPage: int,
|
||||
http_prefix: str,
|
||||
domain_full: str, actor: str,
|
||||
callingDomain: str,
|
||||
calling_domain: str,
|
||||
shared_items_federated_domains: [],
|
||||
sharesFileType: str) -> str:
|
||||
"""Search results for shared items
|
||||
|
@ -269,7 +269,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
resultsPerPage,
|
||||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, http_prefix,
|
||||
calling_domain, http_prefix,
|
||||
domain_full,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
|
@ -307,7 +307,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
resultsPerPage,
|
||||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, http_prefix,
|
||||
calling_domain, http_prefix,
|
||||
domain_full,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
|
|
Loading…
Reference in New Issue