mirror of https://gitlab.com/bashrc2/epicyon
Specify permitted sites to buy from
parent
1b5594bcbd
commit
8126f138c5
37
daemon.py
37
daemon.py
|
@ -7882,6 +7882,40 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
set_config_param(base_dir, 'crawlersAllowed',
|
||||
crawlers_allowed_str)
|
||||
|
||||
# save allowed buy domains
|
||||
buy_sites = {}
|
||||
if fields.get('buySitesStr'):
|
||||
buy_sites_str = \
|
||||
fields['buySitesStr']
|
||||
buy_sites_list = \
|
||||
buy_sites_str.split('\n')
|
||||
for site_url in buy_sites_list:
|
||||
if ' ' in site_url:
|
||||
site_url = site_url.split(' ')[-1]
|
||||
buy_icon_text = \
|
||||
site_url.replace(site_url, '').strip()
|
||||
if not buy_icon_text:
|
||||
buy_icon_text = site_url
|
||||
else:
|
||||
buy_icon_text = site_url
|
||||
if buy_sites.get(buy_icon_text):
|
||||
continue
|
||||
buy_sites[buy_icon_text] = site_url.strip()
|
||||
if str(self.server.buy_sites) != \
|
||||
str(buy_sites):
|
||||
self.server.buy_sites = buy_sites
|
||||
buy_sites_filename = \
|
||||
base_dir + '/accounts/buy_sites.json'
|
||||
if buy_sites:
|
||||
save_json(buy_sites, buy_sites_filename)
|
||||
else:
|
||||
if os.path.isfile(buy_sites_filename):
|
||||
try:
|
||||
os.remove(buy_sites_filename)
|
||||
except OSError:
|
||||
print('EX: unable to delete ' +
|
||||
buy_sites_filename)
|
||||
|
||||
# save peertube instances list
|
||||
peertube_instances_file = \
|
||||
base_dir + '/accounts/peertube.txt'
|
||||
|
@ -16398,7 +16432,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.system_language,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.max_recent_posts,
|
||||
self.server.reverse_sequence)
|
||||
self.server.reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "تحرير التذكير",
|
||||
"Purchase": "شراء",
|
||||
"Subscribe": "الإشتراك",
|
||||
"Buy link": "رابط شراء"
|
||||
"Buy link": "رابط شراء",
|
||||
"Buy links are allowed from the following domains": "روابط الشراء مسموح بها من المجالات التالية"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "অনুস্মারক সম্পাদনা করুন",
|
||||
"Purchase": "ক্রয়",
|
||||
"Subscribe": "সাবস্ক্রাইব",
|
||||
"Buy link": "সংযোগ কেনা"
|
||||
"Buy link": "সংযোগ কেনা",
|
||||
"Buy links are allowed from the following domains": "নিম্নলিখিত ডোমেনগুলি থেকে লিঙ্কগুলি কেনার অনুমতি দেওয়া হয়েছে"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Edita el recordatori",
|
||||
"Purchase": "Compra",
|
||||
"Subscribe": "Subscriu-te",
|
||||
"Buy link": "Enllaç de compra"
|
||||
"Buy link": "Enllaç de compra",
|
||||
"Buy links are allowed from the following domains": "Els enllaços de compra es permeten des dels dominis següents"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Golygu nodyn atgoffa",
|
||||
"Purchase": "Prynu",
|
||||
"Subscribe": "Tanysgrifio",
|
||||
"Buy link": "Prynu dolen"
|
||||
"Buy link": "Prynu dolen",
|
||||
"Buy links are allowed from the following domains": "Caniateir dolenni prynu o'r parthau canlynol"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Erinnerung bearbeiten",
|
||||
"Purchase": "Kaufen",
|
||||
"Subscribe": "Abonnieren",
|
||||
"Buy link": "Link kaufen"
|
||||
"Buy link": "Link kaufen",
|
||||
"Buy links are allowed from the following domains": "Kauflinks sind von den folgenden Domains erlaubt"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Επεξεργασία υπενθύμισης",
|
||||
"Purchase": "Αγορά",
|
||||
"Subscribe": "Εγγραφείτε",
|
||||
"Buy link": "Σύνδεσμος αγοράς"
|
||||
"Buy link": "Σύνδεσμος αγοράς",
|
||||
"Buy links are allowed from the following domains": "Οι σύνδεσμοι αγοράς επιτρέπονται από τους παρακάτω τομείς"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Edit reminder",
|
||||
"Purchase": "Purchase",
|
||||
"Subscribe": "Subscribe",
|
||||
"Buy link": "Buy link"
|
||||
"Buy link": "Buy link",
|
||||
"Buy links are allowed from the following domains": "Buy links are allowed from the following domains"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Editar recordatorio",
|
||||
"Purchase": "Compra",
|
||||
"Subscribe": "Suscribir",
|
||||
"Buy link": "Enlace de compra"
|
||||
"Buy link": "Enlace de compra",
|
||||
"Buy links are allowed from the following domains": "Se permiten enlaces de compra de los siguientes dominios"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "ویرایش یادآوری",
|
||||
"Purchase": "خرید",
|
||||
"Subscribe": "اشتراک در",
|
||||
"Buy link": "لینک خرید"
|
||||
"Buy link": "لینک خرید",
|
||||
"Buy links are allowed from the following domains": "لینک خرید از دامنه های زیر مجاز است"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Modifier le rappel",
|
||||
"Purchase": "Acheter",
|
||||
"Subscribe": "S'abonner",
|
||||
"Buy link": "Acheter un lien"
|
||||
"Buy link": "Acheter un lien",
|
||||
"Buy links are allowed from the following domains": "Les liens d'achat sont autorisés à partir des domaines suivants"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Cuir meabhrúchán in eagar",
|
||||
"Purchase": "Ceannach",
|
||||
"Subscribe": "Liostáil",
|
||||
"Buy link": "Ceannaigh nasc"
|
||||
"Buy link": "Ceannaigh nasc",
|
||||
"Buy links are allowed from the following domains": "Ceadaítear naisc cheannaigh ó na fearainn seo a leanas"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "रिमाइंडर संपादित करें",
|
||||
"Purchase": "खरीदना",
|
||||
"Subscribe": "सदस्यता लेने के",
|
||||
"Buy link": "लिंक खरीदें"
|
||||
"Buy link": "लिंक खरीदें",
|
||||
"Buy links are allowed from the following domains": "निम्नलिखित डोमेन से खरीदें लिंक की अनुमति है"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Modifica promemoria",
|
||||
"Purchase": "Acquistare",
|
||||
"Subscribe": "Sottoscrivi",
|
||||
"Buy link": "Link per l'acquisto"
|
||||
"Buy link": "Link per l'acquisto",
|
||||
"Buy links are allowed from the following domains": "I link di acquisto sono consentiti dai seguenti domini"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "リマインダーを編集",
|
||||
"Purchase": "購入",
|
||||
"Subscribe": "申し込む",
|
||||
"Buy link": "購入リンク"
|
||||
"Buy link": "購入リンク",
|
||||
"Buy links are allowed from the following domains": "次のドメインからの購入リンクが許可されています"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "알림 수정",
|
||||
"Purchase": "구입",
|
||||
"Subscribe": "구독하다",
|
||||
"Buy link": "구매 링크"
|
||||
"Buy link": "구매 링크",
|
||||
"Buy links are allowed from the following domains": "다음 도메인에서 구매 링크가 허용됩니다."
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Bîranîna biguherîne",
|
||||
"Purchase": "Kirrîn",
|
||||
"Subscribe": "Subscribe",
|
||||
"Buy link": "Girêdanê bikirin"
|
||||
"Buy link": "Girêdanê bikirin",
|
||||
"Buy links are allowed from the following domains": "Zencîreyên kirînê ji domên jêrîn têne destûr kirin"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Herinnering bewerken",
|
||||
"Purchase": "Aankoop",
|
||||
"Subscribe": "Abonneren",
|
||||
"Buy link": "koop link"
|
||||
"Buy link": "koop link",
|
||||
"Buy links are allowed from the following domains": "Kooplinks zijn toegestaan vanaf de volgende domeinen"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Edit reminder": "Edit reminder",
|
||||
"Purchase": "Purchase",
|
||||
"Subscribe": "Subscribe",
|
||||
"Buy link": "Buy link"
|
||||
"Buy link": "Buy link",
|
||||
"Buy links are allowed from the following domains": "Buy links are allowed from the following domains"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Edytuj przypomnienie",
|
||||
"Purchase": "Zakup",
|
||||
"Subscribe": "Subskrybuj",
|
||||
"Buy link": "Kup Link"
|
||||
"Buy link": "Kup Link",
|
||||
"Buy links are allowed from the following domains": "Kupuj linki są dozwolone z następujących domen"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Editar lembrete",
|
||||
"Purchase": "Comprar",
|
||||
"Subscribe": "Se inscrever",
|
||||
"Buy link": "Link de compra"
|
||||
"Buy link": "Link de compra",
|
||||
"Buy links are allowed from the following domains": "Links de compra são permitidos nos seguintes domínios"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Изменить напоминание",
|
||||
"Purchase": "Покупка",
|
||||
"Subscribe": "Подписаться",
|
||||
"Buy link": "Купить ссылку"
|
||||
"Buy link": "Купить ссылку",
|
||||
"Buy links are allowed from the following domains": "Ссылки на покупку разрешены со следующих доменов"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Badilisha kikumbusho",
|
||||
"Purchase": "Nunua",
|
||||
"Subscribe": "Jisajili",
|
||||
"Buy link": "Nunua kiungo"
|
||||
"Buy link": "Nunua kiungo",
|
||||
"Buy links are allowed from the following domains": "Viungo vya kununua vinaruhusiwa kutoka kwa vikoa vifuatavyo"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Hatırlatıcıyı düzenle",
|
||||
"Purchase": "Satın alma",
|
||||
"Subscribe": "Abone",
|
||||
"Buy link": "Bağlantı satın al"
|
||||
"Buy link": "Bağlantı satın al",
|
||||
"Buy links are allowed from the following domains": "Aşağıdaki alanlardan satın alma bağlantılarına izin verilir"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "Редагувати нагадування",
|
||||
"Purchase": "Купівля",
|
||||
"Subscribe": "Підпишіться",
|
||||
"Buy link": "Купити посилання"
|
||||
"Buy link": "Купити посилання",
|
||||
"Buy links are allowed from the following domains": "Посилання на купівлю дозволено з таких доменів"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "רעדאַגירן דערמאָנונג",
|
||||
"Purchase": "קויפן",
|
||||
"Subscribe": "אַבאָנירן",
|
||||
"Buy link": "קויפן לינק"
|
||||
"Buy link": "קויפן לינק",
|
||||
"Buy links are allowed from the following domains": "קויפן פֿאַרבינדונגען זענען ערלויבט פֿון די פאלגענדע דאָומיינז"
|
||||
}
|
||||
|
|
|
@ -611,5 +611,6 @@
|
|||
"Edit reminder": "编辑提醒",
|
||||
"Purchase": "购买",
|
||||
"Subscribe": "订阅",
|
||||
"Buy link": "购买链接"
|
||||
"Buy link": "购买链接",
|
||||
"Buy links are allowed from the following domains": "允许来自以下域的购买链接"
|
||||
}
|
||||
|
|
|
@ -1884,7 +1884,8 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str,
|
|||
user_agents_blocked: str,
|
||||
crawlers_allowed: str,
|
||||
translate: {}, reply_interval_hours: int,
|
||||
cw_lists: {}, lists_enabled: str) -> str:
|
||||
cw_lists: {}, lists_enabled: str,
|
||||
buy_sites: {}) -> str:
|
||||
"""Filtering and blocking section of edit profile screen
|
||||
"""
|
||||
filter_str = ''
|
||||
|
@ -2071,6 +2072,20 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str,
|
|||
'crawlersAllowedStr', crawlers_allowed_str,
|
||||
200, '', False)
|
||||
|
||||
buy_domains_list_str = ''
|
||||
for buy_icon_text, buy_url in buy_sites.items():
|
||||
if buy_icon_text != buy_url:
|
||||
buy_domains_list_str += \
|
||||
buy_icon_text + ' ' + buy_url.strip() + '\n'
|
||||
else:
|
||||
buy_domains_list_str += buy_url.strip() + '\n'
|
||||
buy_domains_str = \
|
||||
"Buy links are allowed from the following domains"
|
||||
edit_profile_form += \
|
||||
edit_text_area(translate[buy_domains_str], None,
|
||||
'buySitesStr', buy_domains_list_str,
|
||||
200, '', False)
|
||||
|
||||
cw_lists_str = ''
|
||||
for name, _ in cw_lists.items():
|
||||
variablename = get_cw_list_variable(name)
|
||||
|
@ -2513,7 +2528,8 @@ def html_edit_profile(server, translate: {},
|
|||
system_language: str,
|
||||
min_images_for_accounts: [],
|
||||
max_recent_posts: int,
|
||||
reverse_sequence: []) -> str:
|
||||
reverse_sequence: [],
|
||||
buy_sites: {}) -> str:
|
||||
"""Shows the edit profile screen
|
||||
"""
|
||||
path = path.replace('/inbox', '').replace('/outbox', '')
|
||||
|
@ -2754,7 +2770,7 @@ def html_edit_profile(server, translate: {},
|
|||
_html_edit_profile_filtering(base_dir, nickname, domain,
|
||||
user_agents_blocked, crawlers_allowed,
|
||||
translate, reply_interval_hours,
|
||||
cw_lists, lists_enabled)
|
||||
cw_lists, lists_enabled, buy_sites)
|
||||
|
||||
# git projects section
|
||||
edit_profile_form += \
|
||||
|
|
|
@ -2148,7 +2148,7 @@ def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
|||
def load_buy_sites(base_dir: str) -> {}:
|
||||
"""Loads domains from which buying is permitted
|
||||
"""
|
||||
buy_sites_filename = base_dir + '/accounts/buy_sites.txt'
|
||||
buy_sites_filename = base_dir + '/accounts/buy_sites.json'
|
||||
if os.path.isfile(buy_sites_filename):
|
||||
buy_sites_json = load_json(buy_sites_filename)
|
||||
if buy_sites_json:
|
||||
|
|
Loading…
Reference in New Issue