mirror of https://gitlab.com/bashrc2/epicyon
Allow default download filename for mozilla browsers
parent
bb122c5647
commit
c997c49f88
|
@ -3104,7 +3104,8 @@ def daemon_http_get(self) -> None:
|
|||
self.server.access_keys,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
self.server.auto_cw_cache,
|
||||
ua_str)
|
||||
self.server.getreq_busy = False
|
||||
return
|
||||
|
||||
|
|
|
@ -168,7 +168,8 @@ def hashtag_search2(self, calling_domain: str,
|
|||
access_keys: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: [],
|
||||
auto_cw_cache: {}) -> None:
|
||||
auto_cw_cache: {},
|
||||
ua_str: str) -> None:
|
||||
"""Return the result of a hashtag search
|
||||
"""
|
||||
page_number = 1
|
||||
|
@ -235,7 +236,7 @@ def hashtag_search2(self, calling_domain: str,
|
|||
'search',
|
||||
min_images_for_accounts,
|
||||
buy_sites,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, ua_str)
|
||||
if hashtag_str:
|
||||
msg = hashtag_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
|
|
@ -458,7 +458,8 @@ def daemon_http_post(self) -> None:
|
|||
self.server.key_shortcuts,
|
||||
self.server.max_shares_on_profile,
|
||||
self.server.no_of_books,
|
||||
self.server.shared_items_federated_domains)
|
||||
self.server.shared_items_federated_domains,
|
||||
ua_str)
|
||||
self.server.postreq_busy = False
|
||||
return
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ def _receive_search_hashtag(self, actor_str: str,
|
|||
min_images_for_accounts: {},
|
||||
buy_sites: [],
|
||||
auto_cw_cache: {},
|
||||
calling_domain: str) -> bool:
|
||||
calling_domain: str,
|
||||
ua_str: str) -> bool:
|
||||
"""Receive a search for a hashtag from the search screen
|
||||
"""
|
||||
nickname = get_nickname_from_actor(actor_str)
|
||||
|
@ -132,7 +133,7 @@ def _receive_search_hashtag(self, actor_str: str,
|
|||
'search',
|
||||
min_images_for_accounts,
|
||||
buy_sites,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, ua_str)
|
||||
if hashtag_str:
|
||||
msg = hashtag_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -752,7 +753,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
|
|||
key_shortcuts: {},
|
||||
max_shares_on_profile: int,
|
||||
no_of_books: int,
|
||||
shared_items_federated_domains: []) -> None:
|
||||
shared_items_federated_domains: [],
|
||||
ua_str: str) -> None:
|
||||
"""Receive a search query
|
||||
"""
|
||||
# get the page number
|
||||
|
@ -857,7 +859,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
|
|||
min_images_for_accounts,
|
||||
buy_sites,
|
||||
auto_cw_cache,
|
||||
calling_domain):
|
||||
calling_domain,
|
||||
ua_str):
|
||||
return
|
||||
elif (search_str.startswith('*') or
|
||||
search_str.endswith(' skill')):
|
||||
|
|
20
maps.py
20
maps.py
|
@ -867,7 +867,7 @@ def map_format_from_tagmaps_path(base_dir: str, path: str,
|
|||
def html_hashtag_maps(base_dir: str, tag_name: str,
|
||||
translate: {}, map_format: str,
|
||||
nickname: str, domain: str,
|
||||
session) -> str:
|
||||
session, ua_str: str) -> str:
|
||||
"""Returns html for maps associated with a hashtag
|
||||
"""
|
||||
tag_map_filename = base_dir + '/tagmaps/' + tag_name + '.txt'
|
||||
|
@ -878,6 +878,7 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
|
|||
|
||||
html_str = ''
|
||||
map_str = None
|
||||
ua_str_lower = ua_str.lower()
|
||||
for period_str, hours in time_period.items():
|
||||
new_map_str = \
|
||||
_hashtag_map_within_hours(base_dir, tag_name, hours,
|
||||
|
@ -889,17 +890,22 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
|
|||
continue
|
||||
map_str = new_map_str
|
||||
period_str2 = period_str.replace('Last ', '').lower()
|
||||
endpoint_str = \
|
||||
'/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_')
|
||||
tag_name_str = tag_name + '-' + period_str2.replace(' ', '_')
|
||||
endpoint_str = '/tagmaps/' + tag_name_str
|
||||
if html_str:
|
||||
html_str += ' '
|
||||
description = period_str
|
||||
if translate.get(period_str):
|
||||
description = translate[period_str]
|
||||
# NOTE: don't use download="preferredfilename" which is
|
||||
# unsupported by some browsers
|
||||
html_str += '<a href="' + endpoint_str + '" download>' + \
|
||||
description + '</a>'
|
||||
if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
|
||||
html_str += '<a href="' + endpoint_str + \
|
||||
'" download="' + tag_name_str + '.kml">' + \
|
||||
description + '</a>'
|
||||
else:
|
||||
# NOTE: don't use download="preferredfilename" which is
|
||||
# unsupported by some browsers
|
||||
html_str += '<a href="' + endpoint_str + '" download>' + \
|
||||
description + '</a>'
|
||||
if html_str:
|
||||
html_str = '📌 ' + html_str
|
||||
return html_str
|
||||
|
|
|
@ -880,7 +880,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
|
|||
dogwhistles: {}, map_format: str,
|
||||
access_keys: {}, box_name: str,
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}, auto_cw_cache: {}) -> str:
|
||||
buy_sites: {}, auto_cw_cache: {},
|
||||
ua_str: str) -> str:
|
||||
"""Show a page containing search results for a hashtag
|
||||
or after selecting a hashtag from the swarm
|
||||
"""
|
||||
|
@ -972,7 +973,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
|
|||
|
||||
# maps for geolocations with this hashtag
|
||||
maps_str = html_hashtag_maps(base_dir, hashtag, translate, map_format,
|
||||
nickname, domain, session)
|
||||
nickname, domain, session, ua_str)
|
||||
if maps_str:
|
||||
maps_str = '<center>' + maps_str + '</center>\n'
|
||||
hashtag_search_form += maps_str
|
||||
|
|
Loading…
Reference in New Issue