mirror of https://gitlab.com/bashrc2/epicyon
Separate function for searching wanted items
parent
a723c66b89
commit
5ee1c48b6a
|
@ -637,6 +637,45 @@ def _receive_search_emoji(self, search_str: str,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _receive_search_wanted(self, search_str: str,
|
||||||
|
actor_str: str,
|
||||||
|
translate: {},
|
||||||
|
base_dir: str,
|
||||||
|
page_number: int,
|
||||||
|
max_posts_in_feed: int,
|
||||||
|
http_prefix: str,
|
||||||
|
domain_full: str,
|
||||||
|
calling_domain: str,
|
||||||
|
shared_items_federated_domains: [],
|
||||||
|
domain: str,
|
||||||
|
theme_name: str,
|
||||||
|
access_keys: {}) -> bool:
|
||||||
|
"""Receive a search for wanted items from the search screen
|
||||||
|
"""
|
||||||
|
# wanted items search
|
||||||
|
nickname = get_nickname_from_actor(actor_str)
|
||||||
|
wanted_items_str = \
|
||||||
|
html_search_shared_items(translate,
|
||||||
|
base_dir,
|
||||||
|
search_str[1:], page_number,
|
||||||
|
max_posts_in_feed,
|
||||||
|
http_prefix,
|
||||||
|
domain_full,
|
||||||
|
actor_str, calling_domain,
|
||||||
|
shared_items_federated_domains,
|
||||||
|
'wanted', nickname, domain,
|
||||||
|
theme_name,
|
||||||
|
access_keys)
|
||||||
|
if wanted_items_str:
|
||||||
|
msg = wanted_items_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,
|
||||||
|
@ -915,26 +954,15 @@ def receive_search_query(self, calling_domain: str, cookie: str,
|
||||||
calling_domain):
|
calling_domain):
|
||||||
return
|
return
|
||||||
elif search_str.startswith('.'):
|
elif search_str.startswith('.'):
|
||||||
# wanted items search
|
if _receive_search_wanted(self, search_str,
|
||||||
nickname = get_nickname_from_actor(actor_str)
|
actor_str, translate,
|
||||||
wanted_items_str = \
|
base_dir, page_number,
|
||||||
html_search_shared_items(translate,
|
max_posts_in_feed,
|
||||||
base_dir,
|
http_prefix, domain_full,
|
||||||
search_str[1:], page_number,
|
calling_domain,
|
||||||
max_posts_in_feed,
|
shared_items_federated_domains,
|
||||||
http_prefix,
|
domain, theme_name,
|
||||||
domain_full,
|
access_keys):
|
||||||
actor_str, calling_domain,
|
|
||||||
shared_items_federated_domains,
|
|
||||||
'wanted', nickname, domain,
|
|
||||||
theme_name,
|
|
||||||
access_keys)
|
|
||||||
if wanted_items_str:
|
|
||||||
msg = wanted_items_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
|
||||||
else:
|
else:
|
||||||
# shared items search
|
# shared items search
|
||||||
|
|
Loading…
Reference in New Issue