mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
b8a3176154
commit
909d13a7fc
6
utils.py
6
utils.py
|
@ -2873,16 +2873,16 @@ def getAltPath(actor: str, domain_full: str, callingDomain: str) -> str:
|
||||||
return postActor
|
return postActor
|
||||||
|
|
||||||
|
|
||||||
def getActorPropertyUrl(actor_json: {}, propertyName: str) -> str:
|
def getActorPropertyUrl(actor_json: {}, property_name: str) -> str:
|
||||||
"""Returns a url property from an actor
|
"""Returns a url property from an actor
|
||||||
"""
|
"""
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
return ''
|
return ''
|
||||||
propertyName = propertyName.lower()
|
property_name = property_name.lower()
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
if not property_value.get('name'):
|
if not property_value.get('name'):
|
||||||
continue
|
continue
|
||||||
if not property_value['name'].lower().startswith(propertyName):
|
if not property_value['name'].lower().startswith(property_name):
|
||||||
continue
|
continue
|
||||||
if not property_value.get('type'):
|
if not property_value.get('type'):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -170,13 +170,13 @@ def getContentWarningButton(postID: str, translate: {},
|
||||||
'</div></details>\n'
|
'</div></details>\n'
|
||||||
|
|
||||||
|
|
||||||
def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
def _setActorPropertyUrl(actor_json: {}, property_name: str, url: str) -> None:
|
||||||
"""Sets a url for the given actor property
|
"""Sets a url for the given actor property
|
||||||
"""
|
"""
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
actor_json['attachment'] = []
|
actor_json['attachment'] = []
|
||||||
|
|
||||||
propertyNameLower = propertyName.lower()
|
property_nameLower = property_name.lower()
|
||||||
|
|
||||||
# remove any existing value
|
# remove any existing value
|
||||||
propertyFound = None
|
propertyFound = None
|
||||||
|
@ -185,7 +185,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
||||||
continue
|
continue
|
||||||
if not property_value.get('type'):
|
if not property_value.get('type'):
|
||||||
continue
|
continue
|
||||||
if not property_value['name'].lower().startswith(propertyNameLower):
|
if not property_value['name'].lower().startswith(property_nameLower):
|
||||||
continue
|
continue
|
||||||
propertyFound = property_value
|
propertyFound = property_value
|
||||||
break
|
break
|
||||||
|
@ -212,7 +212,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
||||||
continue
|
continue
|
||||||
if not property_value.get('type'):
|
if not property_value.get('type'):
|
||||||
continue
|
continue
|
||||||
if not property_value['name'].lower().startswith(propertyNameLower):
|
if not property_value['name'].lower().startswith(property_nameLower):
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
|
@ -220,7 +220,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
newAddress = {
|
newAddress = {
|
||||||
"name": propertyName,
|
"name": property_name,
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": url
|
"value": url
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,10 +364,10 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
if not property_value.get('name'):
|
if not property_value.get('name'):
|
||||||
continue
|
continue
|
||||||
propertyName = property_value['name'].lower()
|
property_name = property_value['name'].lower()
|
||||||
found = False
|
found = False
|
||||||
for name, alias in webfingerPropertyName.items():
|
for name, alias in webfingerPropertyName.items():
|
||||||
if name == propertyName:
|
if name == property_name:
|
||||||
if alias in aliasesNotFound:
|
if alias in aliasesNotFound:
|
||||||
aliasesNotFound.remove(alias)
|
aliasesNotFound.remove(alias)
|
||||||
found = True
|
found = True
|
||||||
|
@ -388,11 +388,11 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
||||||
aliasIndex = 0
|
aliasIndex = 0
|
||||||
found = False
|
found = False
|
||||||
for alias in wfJson['aliases']:
|
for alias in wfJson['aliases']:
|
||||||
if alias.startswith(webfingerPropertyName[propertyName] + ':'):
|
if alias.startswith(webfingerPropertyName[property_name] + ':'):
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
aliasIndex += 1
|
aliasIndex += 1
|
||||||
newAlias = webfingerPropertyName[propertyName] + ':' + newValue
|
newAlias = webfingerPropertyName[property_name] + ':' + newValue
|
||||||
if found:
|
if found:
|
||||||
if wfJson['aliases'][aliasIndex] != newAlias:
|
if wfJson['aliases'][aliasIndex] != newAlias:
|
||||||
changed = True
|
changed = True
|
||||||
|
|
Loading…
Reference in New Issue