mirror of https://gitlab.com/bashrc2/epicyon
Separate function for hashtag search
parent
4030055ff5
commit
c417fa90c5
|
@ -52,6 +52,98 @@ def _receive_search_redirect(self, calling_domain: str,
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
|
||||||
|
|
||||||
|
def _receive_search_hashtag(self, actor_str: str,
|
||||||
|
account_timezone: {},
|
||||||
|
bold_reading_nicknames: {},
|
||||||
|
domain: str, port: int,
|
||||||
|
recent_posts_cache: {},
|
||||||
|
max_recent_posts: int,
|
||||||
|
translate: {},
|
||||||
|
base_dir: str,
|
||||||
|
search_str: str,
|
||||||
|
max_posts_in_hashtag_feed: int,
|
||||||
|
curr_session,
|
||||||
|
cached_webfingers: {},
|
||||||
|
person_cache: {},
|
||||||
|
http_prefix: str,
|
||||||
|
project_version: str,
|
||||||
|
yt_replace_domain: str,
|
||||||
|
twitter_replacement_domain: str,
|
||||||
|
show_published_date_only: bool,
|
||||||
|
peertube_instances: [],
|
||||||
|
allow_local_network_access: bool,
|
||||||
|
theme_name: str,
|
||||||
|
system_language: str,
|
||||||
|
max_like_count: int,
|
||||||
|
signing_priv_key_pem: str,
|
||||||
|
cw_lists: {},
|
||||||
|
lists_enabled: {},
|
||||||
|
dogwhistles: {},
|
||||||
|
map_format: str,
|
||||||
|
access_keys: {},
|
||||||
|
min_images_for_accounts: {},
|
||||||
|
buy_sites: [],
|
||||||
|
auto_cw_cache: {},
|
||||||
|
calling_domain: str) -> None:
|
||||||
|
"""Receive a search for a hashtag from the search screen
|
||||||
|
"""
|
||||||
|
nickname = get_nickname_from_actor(actor_str)
|
||||||
|
if not nickname:
|
||||||
|
self.send_response(400)
|
||||||
|
self.end_headers()
|
||||||
|
self.server.postreq_busy = False
|
||||||
|
return True
|
||||||
|
|
||||||
|
# hashtag search
|
||||||
|
timezone = None
|
||||||
|
if account_timezone.get(nickname):
|
||||||
|
timezone = account_timezone.get(nickname)
|
||||||
|
bold_reading = False
|
||||||
|
if bold_reading_nicknames.get(nickname):
|
||||||
|
bold_reading = True
|
||||||
|
hashtag_str = \
|
||||||
|
html_hashtag_search(nickname, domain, port,
|
||||||
|
recent_posts_cache,
|
||||||
|
max_recent_posts,
|
||||||
|
translate,
|
||||||
|
base_dir,
|
||||||
|
search_str[1:], 1,
|
||||||
|
max_posts_in_hashtag_feed,
|
||||||
|
curr_session,
|
||||||
|
cached_webfingers,
|
||||||
|
person_cache,
|
||||||
|
http_prefix,
|
||||||
|
project_version,
|
||||||
|
yt_replace_domain,
|
||||||
|
twitter_replacement_domain,
|
||||||
|
show_published_date_only,
|
||||||
|
peertube_instances,
|
||||||
|
allow_local_network_access,
|
||||||
|
theme_name,
|
||||||
|
system_language,
|
||||||
|
max_like_count,
|
||||||
|
signing_priv_key_pem,
|
||||||
|
cw_lists,
|
||||||
|
lists_enabled,
|
||||||
|
timezone, bold_reading,
|
||||||
|
dogwhistles,
|
||||||
|
map_format,
|
||||||
|
access_keys,
|
||||||
|
'search',
|
||||||
|
min_images_for_accounts,
|
||||||
|
buy_sites,
|
||||||
|
auto_cw_cache)
|
||||||
|
if hashtag_str:
|
||||||
|
msg = hashtag_str.encode('utf-8')
|
||||||
|
msglen = len(msg)
|
||||||
|
login_headers(self, 'text/html',
|
||||||
|
msglen, calling_domain)
|
||||||
|
write2(self, msg)
|
||||||
|
self.server.postreq_busy = False
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def receive_search_query(self, calling_domain: str, cookie: str,
|
def receive_search_query(self, calling_domain: str, cookie: str,
|
||||||
authorized: bool, path: str,
|
authorized: bool, path: str,
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, http_prefix: str,
|
||||||
|
@ -165,59 +257,39 @@ def receive_search_query(self, calling_domain: str, cookie: str,
|
||||||
' in saved', ' in saves', ' bookmark')
|
' in saved', ' in saves', ' bookmark')
|
||||||
|
|
||||||
if search_str.startswith('#'):
|
if search_str.startswith('#'):
|
||||||
nickname = get_nickname_from_actor(actor_str)
|
if _receive_search_hashtag(self, actor_str,
|
||||||
if not nickname:
|
account_timezone,
|
||||||
self.send_response(400)
|
bold_reading_nicknames,
|
||||||
self.end_headers()
|
domain, port,
|
||||||
self.server.postreq_busy = False
|
recent_posts_cache,
|
||||||
return
|
max_recent_posts,
|
||||||
|
translate,
|
||||||
# hashtag search
|
base_dir,
|
||||||
timezone = None
|
search_str,
|
||||||
if account_timezone.get(nickname):
|
max_posts_in_hashtag_feed,
|
||||||
timezone = account_timezone.get(nickname)
|
curr_session,
|
||||||
bold_reading = False
|
cached_webfingers,
|
||||||
if bold_reading_nicknames.get(nickname):
|
person_cache,
|
||||||
bold_reading = True
|
http_prefix,
|
||||||
hashtag_str = \
|
project_version,
|
||||||
html_hashtag_search(nickname, domain, port,
|
yt_replace_domain,
|
||||||
recent_posts_cache,
|
twitter_replacement_domain,
|
||||||
max_recent_posts,
|
show_published_date_only,
|
||||||
translate,
|
peertube_instances,
|
||||||
base_dir,
|
allow_local_network_access,
|
||||||
search_str[1:], 1,
|
theme_name,
|
||||||
max_posts_in_hashtag_feed,
|
system_language,
|
||||||
curr_session,
|
max_like_count,
|
||||||
cached_webfingers,
|
signing_priv_key_pem,
|
||||||
person_cache,
|
cw_lists,
|
||||||
http_prefix,
|
lists_enabled,
|
||||||
project_version,
|
dogwhistles,
|
||||||
yt_replace_domain,
|
map_format,
|
||||||
twitter_replacement_domain,
|
access_keys,
|
||||||
show_published_date_only,
|
min_images_for_accounts,
|
||||||
peertube_instances,
|
buy_sites,
|
||||||
allow_local_network_access,
|
auto_cw_cache,
|
||||||
theme_name,
|
calling_domain):
|
||||||
system_language,
|
|
||||||
max_like_count,
|
|
||||||
signing_priv_key_pem,
|
|
||||||
cw_lists,
|
|
||||||
lists_enabled,
|
|
||||||
timezone, bold_reading,
|
|
||||||
dogwhistles,
|
|
||||||
map_format,
|
|
||||||
access_keys,
|
|
||||||
'search',
|
|
||||||
min_images_for_accounts,
|
|
||||||
buy_sites,
|
|
||||||
auto_cw_cache)
|
|
||||||
if hashtag_str:
|
|
||||||
msg = hashtag_str.encode('utf-8')
|
|
||||||
msglen = len(msg)
|
|
||||||
login_headers(self, 'text/html',
|
|
||||||
msglen, calling_domain)
|
|
||||||
write2(self, msg)
|
|
||||||
self.server.postreq_busy = False
|
|
||||||
return
|
return
|
||||||
elif (search_str.startswith('*') or
|
elif (search_str.startswith('*') or
|
||||||
search_str.endswith(' skill')):
|
search_str.endswith(' skill')):
|
||||||
|
|
Loading…
Reference in New Issue