diff --git a/daemon.py b/daemon.py
index 671e2caec..5abe4bb91 100644
--- a/daemon.py
+++ b/daemon.py
@@ -403,7 +403,7 @@ from crawlers import blocked_user_agent
from crawlers import load_known_web_bots
from qrcode import save_domain_qrcode
from importFollowing import run_import_following_watchdog
-from maps import kml_from_tagmaps_path
+from maps import map_format_from_tagmaps_path
import os
@@ -3853,7 +3853,10 @@ class PubServer(BaseHTTPRequestHandler):
search_str = search_str.split('&')[0]
search_str = \
urllib.parse.unquote_plus(search_str.strip())
- search_str = search_str.lower().strip()
+ search_str = search_str.strip()
+ # hashtags can be combined case
+ if not search_str.startswith('#'):
+ search_str = search_str.lower()
print('search_str: ' + search_str)
if search_for_emoji:
search_str = ':' + search_str + ':'
@@ -3898,7 +3901,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
timezone, bold_reading,
- self.server.dogwhistles)
+ self.server.dogwhistles,
+ self.server.map_format)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@@ -8601,7 +8605,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
timezone, bold_reading,
- self.server.dogwhistles)
+ self.server.dogwhistles,
+ self.server.map_format)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@@ -17091,12 +17096,18 @@ class PubServer(BaseHTTPRequestHandler):
# hashtag map kml
if self.path.startswith('/tagmaps/') or \
(authorized and '/tagmaps/' in self.path):
- kml_str = kml_from_tagmaps_path(self.server.base_dir, self.path)
- if kml_str:
- msg = kml_str.encode('utf-8')
+ map_str = \
+ map_format_from_tagmaps_path(self.server.base_dir, self.path,
+ self.server.map_format)
+ if map_str:
+ msg = map_str.encode('utf-8')
msglen = len(msg)
- header_type = \
- 'application/vnd.google-earth.kml+xml; charset=utf-8'
+ if self.server.map_format == 'gpx':
+ header_type = \
+ 'application/gpx+xml; charset=utf-8'
+ else:
+ header_type = \
+ 'application/vnd.google-earth.kml+xml; charset=utf-8'
self._set_headers(header_type, msglen,
None, calling_domain, True)
self._write(msg)
@@ -20823,7 +20834,8 @@ def load_tokens(base_dir: str, tokens_dict: {}, tokens_lookup: {}) -> None:
break
-def run_daemon(clacks: str,
+def run_daemon(map_format: str,
+ clacks: str,
preferred_podcast_formats: [],
check_actor_timeout: int,
crawlers_allowed: [],
@@ -20948,6 +20960,9 @@ def run_daemon(clacks: str,
httpd.vcard_is_active = False
httpd.masto_api_is_active = False
+ # use kml or gpx format for hashtag maps
+ httpd.map_format = map_format.lower()
+
httpd.dyslexic_font = dyslexic_font
# license for content of the instance
diff --git a/epicyon.py b/epicyon.py
index c1752ad89..a80a62e6c 100644
--- a/epicyon.py
+++ b/epicyon.py
@@ -735,6 +735,9 @@ def _command_options() -> None:
help='Category of item being shared')
parser.add_argument('--location', dest='location', type=str, default=None,
help='Location/City of item being shared')
+ parser.add_argument('--mapFormat', dest='mapFormat', type=str,
+ default='kml',
+ help='Format for hashtag maps GPX/KML')
parser.add_argument('--duration', dest='duration', type=str, default=None,
help='Duration for which to share an item')
parser.add_argument('--registration', dest='registration', type=str,
@@ -3380,6 +3383,12 @@ def _command_options() -> None:
if not registration:
registration = False
+ map_format = get_config_param(base_dir, 'mapFormat')
+ if map_format:
+ argb.mapFormat = map_format
+ else:
+ set_config_param(base_dir, 'mapFormat', argb.mapFormat)
+
minimumvotes = get_config_param(base_dir, 'minvotes')
if minimumvotes:
argb.minimumvotes = int(minimumvotes)
@@ -3626,7 +3635,8 @@ def _command_options() -> None:
if __name__ == "__main__":
argb2, opt2 = _command_options()
print('allowdeletion: ' + str(argb2.allowdeletion))
- run_daemon(argb2.clacks,
+ run_daemon(argb2.mapFormat,
+ argb2.clacks,
opt2['preferred_podcast_formats'],
argb2.check_actor_timeout,
opt2['crawlers_allowed'],
diff --git a/maps.py b/maps.py
index 5a6eafac7..17a23ab03 100644
--- a/maps.py
+++ b/maps.py
@@ -526,20 +526,81 @@ def _hashtag_map_to_kml(base_dir: str, tag_name: str,
return kml_str
-def _hashtag_map_kml_within_hours(base_dir: str, tag_name: str,
- hours: int) -> str:
- """Returns kml for a hashtag containing maps for the last number of hours
+def _hashtag_map_to_gpx(base_dir: str, tag_name: str,
+ start_hours_since_epoch: int,
+ end_hours_since_epoch: int) -> str:
+ """Returns the GPX for a given hashtag between the given times
+ """
+ place_ctr = 0
+ osm_domain = 'openstreetmap.org'
+ tag_map_filename = base_dir + '/tagmaps/' + tag_name + '.txt'
+
+ gpx_str = '\n'
+ gpx_str += '