mirror of https://gitlab.com/bashrc2/epicyon
Load buy sites from file
parent
2f9a0c7792
commit
9d844e641b
|
@ -178,6 +178,7 @@ from webapp_podcast import html_podcast_episode
|
|||
from webapp_theme_designer import html_theme_designer
|
||||
from webapp_minimalbutton import set_minimal
|
||||
from webapp_minimalbutton import is_minimal
|
||||
from webapp_utils import load_buy_sites
|
||||
from webapp_utils import get_default_path
|
||||
from webapp_utils import get_avatar_image_url
|
||||
from webapp_utils import html_hashtag_blocked
|
||||
|
@ -22983,7 +22984,7 @@ def run_daemon(max_hashtags: int,
|
|||
assert not scan_themes_for_scripts(base_dir)
|
||||
|
||||
# permitted sites from which the buy button may be displayed
|
||||
httpd.buy_sites = {}
|
||||
httpd.buy_sites = load_buy_sites(base_dir)
|
||||
|
||||
# which accounts should minimize all attached images by default
|
||||
httpd.min_images_for_accounts = load_min_images_for_accounts(base_dir)
|
||||
|
|
|
@ -2136,3 +2136,14 @@ def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
|||
links[site.title()] = item['href']
|
||||
continue
|
||||
return links
|
||||
|
||||
|
||||
def load_buy_sites(base_dir: str) -> {}:
|
||||
"""Loads domains from which buying is permitted
|
||||
"""
|
||||
buy_sites_filename = base_dir + '/accounts/buy_sites.txt'
|
||||
if os.path.isfile(buy_sites_filename):
|
||||
buy_sites_json = load_json(buy_sites_filename)
|
||||
if buy_sites_json:
|
||||
return buy_sites_json
|
||||
return {}
|
||||
|
|
Loading…
Reference in New Issue