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

merge-requests/30/head
Bob Mottram 2022-08-23 21:05:00 +01:00
commit ee51747bc2
5 changed files with 214 additions and 176 deletions

View File

@ -3902,7 +3902,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, bold_reading,
self.server.dogwhistles,
self.server.map_format)
self.server.map_format,
self.server.access_keys,
'search')
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@ -8606,7 +8608,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, bold_reading,
self.server.dogwhistles,
self.server.map_format)
self.server.map_format,
self.server.access_keys,
'search')
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)

File diff suppressed because one or more lines are too long

View File

@ -680,5 +680,5 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
'" download="' + download_filename + '">' + \
description + '</a>'
if html_str:
html_str = '🌍 ' + html_str
html_str = '📌 ' + html_str
return html_str

View File

@ -181,9 +181,13 @@ def html_hash_tag_swarm(base_dir: str, actor: str, translate: {}) -> str:
# swarm of tags
tag_swarm_str = ''
for tag_name in tag_swarm:
tag_display_name = tag_name
tag_map_filename = os.path.join(base_dir + '/tagmaps', tag_name)
if os.path.isfile(tag_map_filename):
tag_display_name = '📌' + tag_name
tag_swarm_str += \
'<a href="' + actor + '/tags/' + tag_name + \
'" class="hashtagswarm">' + tag_name + '</a>\n'
'" class="hashtagswarm">' + tag_display_name + '</a>\n'
if category_swarm_str:
tag_swarm_str = \

View File

@ -30,6 +30,7 @@ from skills import get_skills_from_list
from categories import get_hashtag_category
from feeds import rss2tag_header
from feeds import rss2tag_footer
from webapp_utils import get_banner_file
from webapp_utils import html_common_emoji
from webapp_utils import set_custom_background
from webapp_utils import html_keyboard_navigation
@ -399,6 +400,17 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str,
follow_str = \
html_header_with_external_style(css_filename, instance_title, None)
# set a search banner
search_banner_filename = \
acct_dir(base_dir, search_nickname, domain) + \
'/search_banner.png'
if not os.path.isfile(search_banner_filename):
if os.path.isfile(base_dir +
'/theme/' + theme + '/search_banner.png'):
copyfile(base_dir +
'/theme/' + theme + '/search_banner.png',
search_banner_filename)
# show a banner above the search box
search_banner_file, search_banner_filename = \
get_search_banner_file(base_dir, search_nickname, domain, theme)
@ -738,7 +750,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, map_format: str) -> str:
dogwhistles: {}, map_format: str,
access_keys: {}, box_name: str) -> str:
"""Show a page containing search results for a hashtag
or after selecting a hashtag from the swarm
"""
@ -784,16 +797,33 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
if end_index >= no_of_lines and no_of_lines > 0:
end_index = no_of_lines - 1
# add the page title
instance_title = \
get_config_param(base_dir, 'instanceTitle')
hashtag_search_form = \
html_header_with_external_style(css_filename, instance_title, None)
if nickname:
# banner at top
banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme_name)
hashtag_search_form += \
'<header>\n' + \
'<a href="/users/' + nickname + '/' + box_name + '" title="' + \
translate['Search and follow'] + '" alt="' + \
translate['Search and follow'] + '" ' + \
'aria-flowto="containerHeader" tabindex="1" accesskey="' + \
access_keys['menuSearch'] + '">\n'
hashtag_search_form += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" alt="" ' + \
'src="/users/' + nickname + '/' + banner_file + '" /></a>\n' + \
'</header>\n'
# add the page title
hashtag_search_form += '<center>\n' + \
'<h1><a href="/users/' + nickname + '/search">#' + \
hashtag + '</a>'
else:
# add the page title
hashtag_search_form += '<center>\n' + \
'<h1>#' + hashtag