Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-07-17 10:55:31 +01:00
commit 2876f10cce
3 changed files with 45 additions and 1 deletions

View File

@ -3624,7 +3624,7 @@ class PubServer(BaseHTTPRequestHandler):
onion_domain: str, i2p_domain: str,
debug: bool,
curr_session, proxy_type: str) -> None:
"""Confirms a block
"""Confirms a block from the person options screen
"""
users_path = path.split('/blockconfirm')[0]
origin_path_str = http_prefix + '://' + domain_full + users_path

View File

@ -2644,6 +2644,12 @@ def _valid_post_content(base_dir: str, nickname: str, domain: str,
if summary != valid_content_warning(summary):
print('WARN: invalid content warning ' + summary)
return False
if dangerous_markup(summary, allow_local_network_access):
if message_json['object'].get('id'):
print('REJECT ARBITRARY HTML: ' + message_json['object']['id'])
print('REJECT ARBITRARY HTML: bad string in summary - ' +
summary)
return False
# check for patches before dangeousMarkup, which excludes code
if is_git_patch(base_dir, nickname, domain,

38
maps.py
View File

@ -45,6 +45,42 @@ def _geocoords_from_osm_link(url: str, osm_domain: str) -> (int, float, float):
return zoom, latitude, longitude
def _geocoords_from_osmorg_link(url: str) -> (int, float, float):
"""Returns geocoordinates from an OSM map link
"""
osm_domain = 'osm.org'
if osm_domain not in url:
return None, None, None
if 'mlat=' not in url:
return None, None, None
if 'mlon=' not in url:
return None, None, None
if 'zoom=' not in url:
return None, None, None
latitude = url.split('mlat=')[1]
if '&' in latitude:
latitude = latitude.split('&')[0]
if not is_float(latitude):
return None, None, None
longitude = url.split('mlon=')[1]
if '&' in longitude:
longitude = longitude.split('&')[0]
if not is_float(longitude):
return None, None, None
zoom = url.split('zoom=')[1]
if '&' in zoom:
zoom = zoom.split('&')[0]
if not zoom.isdigit():
return None, None, None
zoom = int(zoom)
latitude = float(latitude)
longitude = float(longitude)
return zoom, latitude, longitude
def _geocoords_from_gmaps_link(url: str) -> (int, float, float):
"""Returns geocoordinates from a Gmaps link
"""
@ -211,6 +247,8 @@ def geocoords_from_map_link(url: str,
"""
if osm_domain in url:
return _geocoords_from_osm_link(url, osm_domain)
if 'osm.org' in url and 'mlat=' in url:
return _geocoords_from_osmorg_link(url)
if '.google.co' in url:
return _geocoords_from_gmaps_link(url)
if '.bing.co' in url: