Set default searchableBy per account

main
Bob Mottram 2024-10-12 11:53:04 +01:00
parent 95c8e3ea48
commit 9e433abe4b
5 changed files with 23 additions and 7 deletions

View File

@ -702,6 +702,10 @@ def run_daemon(accounts_data_dir: str,
# the last time when an LLM scraper was replied to
httpd.last_llm_time = None
# default "searchable by" for new posts for each account
# TODO load
httpd.searchable_by_default = {}
# if a custom robots.txt exists then read it
robots_txt_filename = data_dir(base_dir) + '/robots.txt'
httpd.robots_txt = None

View File

@ -4369,7 +4369,8 @@ def daemon_http_get(self) -> None:
self.server.dogwhistles,
self.server.min_images_for_accounts,
self.server.buy_sites,
self.server.auto_cw_cache):
self.server.auto_cw_cache,
self.server.searchable_by_default):
self.server.getreq_busy = False
return

View File

@ -388,9 +388,11 @@ def show_new_post(self, edit_post_params: {},
dogwhistles: {},
min_images_for_accounts: [],
buy_sites: [],
auto_cw_cache: {}) -> bool:
auto_cw_cache: {},
searchable_by_default_dict: []) -> bool:
"""Shows the new post screen
"""
searchable_by_default = 'yourself'
is_new_post_endpoint = False
new_post_month = None
new_post_year = None
@ -420,6 +422,8 @@ def show_new_post(self, edit_post_params: {},
if not nickname:
http_404(self, 103)
return True
if searchable_by_default_dict.get(nickname):
searchable_by_default = searchable_by_default_dict[nickname]
if in_reply_to_url:
reply_interval_hours = default_reply_interval_hrs
if not can_reply_to(base_dir, nickname, domain,
@ -510,7 +514,8 @@ def show_new_post(self, edit_post_params: {},
default_post_language2,
buy_sites,
default_buy_site,
auto_cw_cache)
auto_cw_cache,
searchable_by_default)
if not msg:
print('Error replying to ' + in_reply_to_url)
http_404(self, 104)

View File

@ -950,6 +950,7 @@ def _person_options_dm(self, options_confirm_params: str,
if default_post_language.get(nickname):
default_post_language2 = default_post_language[nickname]
default_buy_site = ''
searchable_by_default = 'yourself'
msg = \
html_new_post({}, False, translate,
base_dir,
@ -993,7 +994,8 @@ def _person_options_dm(self, options_confirm_params: str,
None, None, default_post_language2,
buy_sites,
default_buy_site,
auto_cw_cache)
auto_cw_cache,
searchable_by_default)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -1184,6 +1186,7 @@ def _person_options_report(self, options_confirm_params: str,
if default_post_language.get(nickname):
default_post_language2 = default_post_language[nickname]
default_buy_site = ''
searchable_by_default = 'yourself'
msg = \
html_new_post({}, False, translate,
base_dir,
@ -1226,7 +1229,8 @@ def _person_options_report(self, options_confirm_params: str,
None, None, default_post_language2,
buy_sites,
default_buy_site,
auto_cw_cache)
auto_cw_cache,
searchable_by_default)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)

View File

@ -272,7 +272,8 @@ def html_new_post(edit_post_params: {},
default_post_language: str,
buy_sites: {},
default_buy_site: str,
auto_cw_cache: {}) -> str:
auto_cw_cache: {},
searchable_by_default: str) -> str:
"""New post screen
"""
# get the json if this is an edited post
@ -998,7 +999,8 @@ def html_new_post(edit_post_params: {},
}
searchable_by_dropdown = '<select id="themeDropdown" ' + \
'name="searchableByDropdown" class="theme">'
searchable_by_default = 'yourself'
if not searchable_by_default:
searchable_by_default = 'yourself'
for srch, srch_text in searchables.items():
if srch != searchable_by_default:
searchable_by_dropdown += \