main
Bob Mottram 2024-07-15 20:01:13 +01:00
parent f3e0bdbc5f
commit d6cb1dbd46
2 changed files with 21 additions and 18 deletions

View File

@ -198,12 +198,13 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
req_prefix = http_prefix + '://' + req_domain
paths = get_user_paths()
for user_path in paths:
if req_prefix + user_path + req_nick in approve_follows_str:
exists = True
approve_handle_full = req_prefix + user_path + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
break
if req_prefix + user_path + req_nick not in approve_follows_str:
continue
exists = True
approve_handle_full = req_prefix + user_path + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
break
if not exists:
if req_prefix + '/' + req_nick in approve_follows_str:

26
maps.py
View File

@ -71,25 +71,27 @@ def get_location_from_post(post_json_object: {}) -> str:
# location representation used by pixelfed
locn_exists = False
locn2 = None
if post_obj.get('location'):
if isinstance(post_obj['location'], dict):
if post_obj['location'].get('longitude') and \
post_obj['location'].get('latitude'):
if isinstance(post_obj['location']['longitude'], str) and \
isinstance(post_obj['location']['latitude'], str):
if is_float(post_obj['location']['longitude']) and \
is_float(post_obj['location']['latitude']):
locn2 = post_obj['location']
if isinstance(locn2, dict):
if locn2.get('longitude') and \
locn2.get('latitude'):
if isinstance(locn2['longitude'], str) and \
isinstance(locn2['latitude'], str):
if is_float(locn2['longitude']) and \
is_float(locn2['latitude']):
locn_exists = True
if not locn_exists:
if post_obj['location'].get('name'):
if isinstance(post_obj['location']['name'], str):
locn = post_obj['location']['name']
if locn2.get('name'):
if isinstance(locn2['name'], str):
locn = locn2['name']
if locn_exists:
osm_domain = 'osm.org'
zoom = 17
locn = _geocoords_to_osm_link(osm_domain, zoom,
post_obj['location']['latitude'],
post_obj['location']['longitude'])
locn2['latitude'],
locn2['longitude'])
return locn