mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Buy link on edit new post
							parent
							
								
									78bc0937e2
								
							
						
					
					
						commit
						6928de6465
					
				
							
								
								
									
										13
									
								
								daemon.py
								
								
								
								
							
							
						
						
									
										13
									
								
								daemon.py
								
								
								
								
							| 
						 | 
				
			
			@ -3671,6 +3671,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            if self.server.default_post_language.get(nickname):
 | 
			
		||||
                default_post_language = \
 | 
			
		||||
                    self.server.default_post_language[nickname]
 | 
			
		||||
            default_buy_site = ''
 | 
			
		||||
            msg = \
 | 
			
		||||
                html_new_post({}, False, self.server.translate,
 | 
			
		||||
                              base_dir,
 | 
			
		||||
| 
						 | 
				
			
			@ -3712,7 +3713,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                              self.server.dogwhistles,
 | 
			
		||||
                              self.server.min_images_for_accounts,
 | 
			
		||||
                              None, None, default_post_language,
 | 
			
		||||
                              self.server.buy_sites)
 | 
			
		||||
                              self.server.buy_sites,
 | 
			
		||||
                              default_buy_site)
 | 
			
		||||
            if msg:
 | 
			
		||||
                msg = msg.encode('utf-8')
 | 
			
		||||
                msglen = len(msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -3832,6 +3834,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
            if self.server.default_post_language.get(nickname):
 | 
			
		||||
                default_post_language = \
 | 
			
		||||
                    self.server.default_post_language[nickname]
 | 
			
		||||
            default_buy_site = ''
 | 
			
		||||
            msg = \
 | 
			
		||||
                html_new_post({}, False, self.server.translate,
 | 
			
		||||
                              base_dir,
 | 
			
		||||
| 
						 | 
				
			
			@ -3872,7 +3875,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                              self.server.dogwhistles,
 | 
			
		||||
                              self.server.min_images_for_accounts,
 | 
			
		||||
                              None, None, default_post_language,
 | 
			
		||||
                              self.server.buy_sites)
 | 
			
		||||
                              self.server.buy_sites,
 | 
			
		||||
                              default_buy_site)
 | 
			
		||||
            if msg:
 | 
			
		||||
                msg = msg.encode('utf-8')
 | 
			
		||||
                msglen = len(msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -16268,7 +16272,7 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                                         nickname,
 | 
			
		||||
                                         self.server.domain_full,
 | 
			
		||||
                                         self.server.person_cache)
 | 
			
		||||
 | 
			
		||||
            default_buy_site = ''
 | 
			
		||||
            msg = \
 | 
			
		||||
                html_new_post(edit_post_params, media_instance,
 | 
			
		||||
                              translate,
 | 
			
		||||
| 
						 | 
				
			
			@ -16313,7 +16317,8 @@ class PubServer(BaseHTTPRequestHandler):
 | 
			
		|||
                              self.server.min_images_for_accounts,
 | 
			
		||||
                              new_post_month, new_post_year,
 | 
			
		||||
                              default_post_language,
 | 
			
		||||
                              self.server.buy_sites)
 | 
			
		||||
                              self.server.buy_sites,
 | 
			
		||||
                              default_buy_site)
 | 
			
		||||
            if not msg:
 | 
			
		||||
                print('Error replying to ' + in_reply_to_url)
 | 
			
		||||
                self._404()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "التسجيلات المتبقية",
 | 
			
		||||
    "Edit reminder": "تحرير التذكير",
 | 
			
		||||
    "Purchase": "شراء",
 | 
			
		||||
    "Subscribe": "الإشتراك"
 | 
			
		||||
    "Subscribe": "الإشتراك",
 | 
			
		||||
    "Buy link": "رابط شراء"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "রেজিস্ট্রেশন বাকি",
 | 
			
		||||
    "Edit reminder": "অনুস্মারক সম্পাদনা করুন",
 | 
			
		||||
    "Purchase": "ক্রয়",
 | 
			
		||||
    "Subscribe": "সাবস্ক্রাইব"
 | 
			
		||||
    "Subscribe": "সাবস্ক্রাইব",
 | 
			
		||||
    "Buy link": "সংযোগ কেনা"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Inscripcions restants",
 | 
			
		||||
    "Edit reminder": "Edita el recordatori",
 | 
			
		||||
    "Purchase": "Compra",
 | 
			
		||||
    "Subscribe": "Subscriu-te"
 | 
			
		||||
    "Subscribe": "Subscriu-te",
 | 
			
		||||
    "Buy link": "Enllaç de compra"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Cofrestriadau ar ôl",
 | 
			
		||||
    "Edit reminder": "Golygu nodyn atgoffa",
 | 
			
		||||
    "Purchase": "Prynu",
 | 
			
		||||
    "Subscribe": "Tanysgrifio"
 | 
			
		||||
    "Subscribe": "Tanysgrifio",
 | 
			
		||||
    "Buy link": "Prynu dolen"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Anmeldungen verbleiben",
 | 
			
		||||
    "Edit reminder": "Erinnerung bearbeiten",
 | 
			
		||||
    "Purchase": "Kaufen",
 | 
			
		||||
    "Subscribe": "Abonnieren"
 | 
			
		||||
    "Subscribe": "Abonnieren",
 | 
			
		||||
    "Buy link": "Link kaufen"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Απομένουν οι εγγραφές",
 | 
			
		||||
    "Edit reminder": "Επεξεργασία υπενθύμισης",
 | 
			
		||||
    "Purchase": "Αγορά",
 | 
			
		||||
    "Subscribe": "Εγγραφείτε"
 | 
			
		||||
    "Subscribe": "Εγγραφείτε",
 | 
			
		||||
    "Buy link": "Σύνδεσμος αγοράς"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Registrations remaining",
 | 
			
		||||
    "Edit reminder": "Edit reminder",
 | 
			
		||||
    "Purchase": "Purchase",
 | 
			
		||||
    "Subscribe": "Subscribe"
 | 
			
		||||
    "Subscribe": "Subscribe",
 | 
			
		||||
    "Buy link": "Buy link"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Registros restantes",
 | 
			
		||||
    "Edit reminder": "Editar recordatorio",
 | 
			
		||||
    "Purchase": "Compra",
 | 
			
		||||
    "Subscribe": "Suscribir"
 | 
			
		||||
    "Subscribe": "Suscribir",
 | 
			
		||||
    "Buy link": "Enlace de compra"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "ثبت نام باقی مانده است",
 | 
			
		||||
    "Edit reminder": "ویرایش یادآوری",
 | 
			
		||||
    "Purchase": "خرید",
 | 
			
		||||
    "Subscribe": "اشتراک در"
 | 
			
		||||
    "Subscribe": "اشتراک در",
 | 
			
		||||
    "Buy link": "لینک خرید"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Inscriptions restantes",
 | 
			
		||||
    "Edit reminder": "Modifier le rappel",
 | 
			
		||||
    "Purchase": "Acheter",
 | 
			
		||||
    "Subscribe": "S'abonner"
 | 
			
		||||
    "Subscribe": "S'abonner",
 | 
			
		||||
    "Buy link": "Acheter un lien"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Clárúcháin fágtha",
 | 
			
		||||
    "Edit reminder": "Cuir meabhrúchán in eagar",
 | 
			
		||||
    "Purchase": "Ceannach",
 | 
			
		||||
    "Subscribe": "Liostáil"
 | 
			
		||||
    "Subscribe": "Liostáil",
 | 
			
		||||
    "Buy link": "Ceannaigh nasc"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "रजिस्ट्रेशन बाकी हैं",
 | 
			
		||||
    "Edit reminder": "रिमाइंडर संपादित करें",
 | 
			
		||||
    "Purchase": "खरीदना",
 | 
			
		||||
    "Subscribe": "सदस्यता लेने के"
 | 
			
		||||
    "Subscribe": "सदस्यता लेने के",
 | 
			
		||||
    "Buy link": "लिंक खरीदें"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Iscrizioni rimanenti",
 | 
			
		||||
    "Edit reminder": "Modifica promemoria",
 | 
			
		||||
    "Purchase": "Acquistare",
 | 
			
		||||
    "Subscribe": "Sottoscrivi"
 | 
			
		||||
    "Subscribe": "Sottoscrivi",
 | 
			
		||||
    "Buy link": "Link per l'acquisto"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "残りの登録数",
 | 
			
		||||
    "Edit reminder": "リマインダーを編集",
 | 
			
		||||
    "Purchase": "購入",
 | 
			
		||||
    "Subscribe": "申し込む"
 | 
			
		||||
    "Subscribe": "申し込む",
 | 
			
		||||
    "Buy link": "購入リンク"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "남은 등록",
 | 
			
		||||
    "Edit reminder": "알림 수정",
 | 
			
		||||
    "Purchase": "구입",
 | 
			
		||||
    "Subscribe": "구독하다"
 | 
			
		||||
    "Subscribe": "구독하다",
 | 
			
		||||
    "Buy link": "구매 링크"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Registrations maye",
 | 
			
		||||
    "Edit reminder": "Bîranîna biguherîne",
 | 
			
		||||
    "Purchase": "Kirrîn",
 | 
			
		||||
    "Subscribe": "Subscribe"
 | 
			
		||||
    "Subscribe": "Subscribe",
 | 
			
		||||
    "Buy link": "Girêdanê bikirin"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Resterende inschrijvingen",
 | 
			
		||||
    "Edit reminder": "Herinnering bewerken",
 | 
			
		||||
    "Purchase": "Aankoop",
 | 
			
		||||
    "Subscribe": "Abonneren"
 | 
			
		||||
    "Subscribe": "Abonneren",
 | 
			
		||||
    "Buy link": "koop link"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -606,5 +606,6 @@
 | 
			
		|||
    "Registrations remaining": "Registrations remaining",
 | 
			
		||||
    "Edit reminder": "Edit reminder",
 | 
			
		||||
    "Purchase": "Purchase",
 | 
			
		||||
    "Subscribe": "Subscribe"
 | 
			
		||||
    "Subscribe": "Subscribe",
 | 
			
		||||
    "Buy link": "Buy link"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Pozostały zapisy",
 | 
			
		||||
    "Edit reminder": "Edytuj przypomnienie",
 | 
			
		||||
    "Purchase": "Zakup",
 | 
			
		||||
    "Subscribe": "Subskrybuj"
 | 
			
		||||
    "Subscribe": "Subskrybuj",
 | 
			
		||||
    "Buy link": "Kup Link"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Inscrições restantes",
 | 
			
		||||
    "Edit reminder": "Editar lembrete",
 | 
			
		||||
    "Purchase": "Comprar",
 | 
			
		||||
    "Subscribe": "Se inscrever"
 | 
			
		||||
    "Subscribe": "Se inscrever",
 | 
			
		||||
    "Buy link": "Link de compra"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Осталось регистраций",
 | 
			
		||||
    "Edit reminder": "Изменить напоминание",
 | 
			
		||||
    "Purchase": "Покупка",
 | 
			
		||||
    "Subscribe": "Подписаться"
 | 
			
		||||
    "Subscribe": "Подписаться",
 | 
			
		||||
    "Buy link": "Купить ссылку"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Usajili uliosalia",
 | 
			
		||||
    "Edit reminder": "Badilisha kikumbusho",
 | 
			
		||||
    "Purchase": "Nunua",
 | 
			
		||||
    "Subscribe": "Jisajili"
 | 
			
		||||
    "Subscribe": "Jisajili",
 | 
			
		||||
    "Buy link": "Nunua kiungo"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "kalan kayıtlar",
 | 
			
		||||
    "Edit reminder": "Hatırlatıcıyı düzenle",
 | 
			
		||||
    "Purchase": "Satın alma",
 | 
			
		||||
    "Subscribe": "Abone"
 | 
			
		||||
    "Subscribe": "Abone",
 | 
			
		||||
    "Buy link": "Bağlantı satın al"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "Залишилось реєстрацій",
 | 
			
		||||
    "Edit reminder": "Редагувати нагадування",
 | 
			
		||||
    "Purchase": "Купівля",
 | 
			
		||||
    "Subscribe": "Підпишіться"
 | 
			
		||||
    "Subscribe": "Підпишіться",
 | 
			
		||||
    "Buy link": "Купити посилання"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "רעדזשיסטריישאַנז רוען",
 | 
			
		||||
    "Edit reminder": "רעדאַגירן דערמאָנונג",
 | 
			
		||||
    "Purchase": "קויפן",
 | 
			
		||||
    "Subscribe": "אַבאָנירן"
 | 
			
		||||
    "Subscribe": "אַבאָנירן",
 | 
			
		||||
    "Buy link": "קויפן לינק"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,5 +610,6 @@
 | 
			
		|||
    "Registrations remaining": "剩余名额",
 | 
			
		||||
    "Edit reminder": "编辑提醒",
 | 
			
		||||
    "Purchase": "购买",
 | 
			
		||||
    "Subscribe": "订阅"
 | 
			
		||||
    "Subscribe": "订阅",
 | 
			
		||||
    "Buy link": "购买链接"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ from utils import get_currencies
 | 
			
		|||
from utils import get_category_types
 | 
			
		||||
from utils import get_account_timezone
 | 
			
		||||
from utils import get_supported_languages
 | 
			
		||||
from webapp_utils import get_buy_links
 | 
			
		||||
from webapp_utils import html_following_data_list
 | 
			
		||||
from webapp_utils import html_common_emoji
 | 
			
		||||
from webapp_utils import begin_edit_section
 | 
			
		||||
| 
						 | 
				
			
			@ -240,7 +241,8 @@ def html_new_post(edit_post_params: {},
 | 
			
		|||
                  min_images_for_accounts: [],
 | 
			
		||||
                  default_month: int, default_year: int,
 | 
			
		||||
                  default_post_language: str,
 | 
			
		||||
                  buy_sites: {}) -> str:
 | 
			
		||||
                  buy_sites: {},
 | 
			
		||||
                  default_buy_site: str) -> str:
 | 
			
		||||
    """New post screen
 | 
			
		||||
    """
 | 
			
		||||
    # get the json if this is an edited post
 | 
			
		||||
| 
						 | 
				
			
			@ -257,6 +259,12 @@ def html_new_post(edit_post_params: {},
 | 
			
		|||
                    return ''
 | 
			
		||||
        if not edited_post_json:
 | 
			
		||||
            return ''
 | 
			
		||||
        buy_links = \
 | 
			
		||||
            get_buy_links(edited_post_json, translate, buy_sites)
 | 
			
		||||
        if buy_links:
 | 
			
		||||
            for _, buy_url in buy_links.items():
 | 
			
		||||
                default_buy_site = buy_url
 | 
			
		||||
                break
 | 
			
		||||
        if edited_post_json['object'].get('conversation'):
 | 
			
		||||
            conversation_id = edited_post_json['object']['conversation']
 | 
			
		||||
        elif edited_post_json['object'].get('context'):
 | 
			
		||||
| 
						 | 
				
			
			@ -481,7 +489,6 @@ def html_new_post(edit_post_params: {},
 | 
			
		|||
        '    <textarea id="imageDescription" name="imageDescription" ' + \
 | 
			
		||||
        'style="height:' + str(image_description_height) + \
 | 
			
		||||
        'px" spellcheck="true" autocomplete="on"></textarea>\n'
 | 
			
		||||
 | 
			
		||||
    new_post_image_section += end_edit_section()
 | 
			
		||||
 | 
			
		||||
    new_post_emoji_section = ''
 | 
			
		||||
| 
						 | 
				
			
			@ -768,6 +775,9 @@ def html_new_post(edit_post_params: {},
 | 
			
		|||
                '      <label class="labels">' + \
 | 
			
		||||
                translate['Language used'] + '</label>\n'
 | 
			
		||||
            replies_section += languages_dropdown
 | 
			
		||||
            buy_link_str = '🛒 ' + translate['Buy link']
 | 
			
		||||
            replies_section += edit_text_field(buy_link_str + ':', 'buySite',
 | 
			
		||||
                                               default_buy_site, 'https://...')
 | 
			
		||||
            replies_section += '</div>\n'
 | 
			
		||||
 | 
			
		||||
            date_and_location = \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1844,19 +1844,21 @@ def _get_buy_footer(buy_links: {}, translate: {}) -> str:
 | 
			
		|||
    if not buy_links:
 | 
			
		||||
        return ''
 | 
			
		||||
    icon_filename = 'buy.png'
 | 
			
		||||
    buy_title, buy_url = buy_links.items()[0]
 | 
			
		||||
    if buy_title:
 | 
			
		||||
        description = buy_title
 | 
			
		||||
    else:
 | 
			
		||||
        description = translate['Buy']
 | 
			
		||||
    buy_str = \
 | 
			
		||||
        '        ' + \
 | 
			
		||||
        '<a class="imageAnchor" href="' + buy_url + \
 | 
			
		||||
        '" title="' + description + '" tabindex="10">' + \
 | 
			
		||||
        '<img loading="lazy" decoding="async" title="' + \
 | 
			
		||||
        description + '" alt="' + description + \
 | 
			
		||||
        ' |" src="/icons/' + icon_filename + '"/></a>\n'
 | 
			
		||||
 | 
			
		||||
    description = ''
 | 
			
		||||
    buy_str = ''
 | 
			
		||||
    for buy_title, buy_url in buy_links.items():
 | 
			
		||||
        if buy_title:
 | 
			
		||||
            description = buy_title
 | 
			
		||||
        else:
 | 
			
		||||
            description = translate['Buy']
 | 
			
		||||
        buy_str = \
 | 
			
		||||
            '        ' + \
 | 
			
		||||
            '<a class="imageAnchor" href="' + buy_url + \
 | 
			
		||||
            '" title="' + description + '" tabindex="10">' + \
 | 
			
		||||
            '<img loading="lazy" decoding="async" title="' + \
 | 
			
		||||
            description + '" alt="' + description + \
 | 
			
		||||
            ' |" src="/icons/' + icon_filename + '"/></a>\n'
 | 
			
		||||
        break
 | 
			
		||||
    return buy_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue