Flag for premium accounts

merge-requests/30/head
Bob Mottram 2024-03-20 20:42:12 +00:00
parent 3f2bf43883
commit 0b4b366f84
28 changed files with 81 additions and 36 deletions

View File

@ -659,5 +659,6 @@
"Show all events": "عرض كافة الأحداث", "Show all events": "عرض كافة الأحداث",
"Blocking API endpoints": "حظر نقاط نهاية API", "Blocking API endpoints": "حظر نقاط نهاية API",
"Payment required": "الدفع مطلوب", "Payment required": "الدفع مطلوب",
"It's time to splash that cash": "لقد حان الوقت لصرف هذه الأموال" "It's time to splash that cash": "لقد حان الوقت لصرف هذه الأموال",
"Premium account": "حساب الأقساط"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "সমস্ত ঘটনা দেখান", "Show all events": "সমস্ত ঘটনা দেখান",
"Blocking API endpoints": "এপিআই এন্ডপয়েন্ট ব্লক করা", "Blocking API endpoints": "এপিআই এন্ডপয়েন্ট ব্লক করা",
"Payment required": "অর্থপ্রদান আবশ্যক", "Payment required": "অর্থপ্রদান আবশ্যক",
"It's time to splash that cash": "এটা যে নগদ স্প্ল্যাশ সময়" "It's time to splash that cash": "এটা যে নগদ স্প্ল্যাশ সময়",
"Premium account": "প্রিমিয়াম অ্যাকাউন্ট"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Mostra tots els esdeveniments", "Show all events": "Mostra tots els esdeveniments",
"Blocking API endpoints": "Bloqueig de punts finals de l'API", "Blocking API endpoints": "Bloqueig de punts finals de l'API",
"Payment required": "Cal pagar", "Payment required": "Cal pagar",
"It's time to splash that cash": "És hora d'esquitxar aquests diners en efectiu" "It's time to splash that cash": "És hora d'esquitxar aquests diners en efectiu",
"Premium account": "Compte Premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Dangos pob digwyddiad", "Show all events": "Dangos pob digwyddiad",
"Blocking API endpoints": "Rhwystro pwyntiau terfyn API", "Blocking API endpoints": "Rhwystro pwyntiau terfyn API",
"Payment required": "Angen taliad", "Payment required": "Angen taliad",
"It's time to splash that cash": "Mae'n bryd tasgu'r arian hwnnw" "It's time to splash that cash": "Mae'n bryd tasgu'r arian hwnnw",
"Premium account": "Cyfrif premiwm"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Alle Veranstaltungen anzeigen", "Show all events": "Alle Veranstaltungen anzeigen",
"Blocking API endpoints": "Blockieren von API-Endpunkten", "Blocking API endpoints": "Blockieren von API-Endpunkten",
"Payment required": "Bezahlung erforderlich", "Payment required": "Bezahlung erforderlich",
"It's time to splash that cash": "Es ist Zeit, das Geld auszugeben" "It's time to splash that cash": "Es ist Zeit, das Geld auszugeben",
"Premium account": "Premiumaccount"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Εμφάνιση όλων των συμβάντων", "Show all events": "Εμφάνιση όλων των συμβάντων",
"Blocking API endpoints": "Αποκλεισμός τελικών σημείων API", "Blocking API endpoints": "Αποκλεισμός τελικών σημείων API",
"Payment required": "Απαιτείται πληρωμή", "Payment required": "Απαιτείται πληρωμή",
"It's time to splash that cash": "Ήρθε η ώρα να ρίξετε αυτά τα μετρητά" "It's time to splash that cash": "Ήρθε η ώρα να ρίξετε αυτά τα μετρητά",
"Premium account": "Λογαριασμός Premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Show all events", "Show all events": "Show all events",
"Blocking API endpoints": "Blocking API endpoints", "Blocking API endpoints": "Blocking API endpoints",
"Payment required": "Payment required", "Payment required": "Payment required",
"It's time to splash that cash": "It's time to splash that cash" "It's time to splash that cash": "It's time to splash that cash",
"Premium account": "Premium account"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Mostrar todos los eventos", "Show all events": "Mostrar todos los eventos",
"Blocking API endpoints": "Bloqueo de puntos finales de API", "Blocking API endpoints": "Bloqueo de puntos finales de API",
"Payment required": "Pago requerido", "Payment required": "Pago requerido",
"It's time to splash that cash": "Es hora de gastar ese dinero" "It's time to splash that cash": "Es hora de gastar ese dinero",
"Premium account": "Cuenta privilegiada"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "نمایش همه رویدادها", "Show all events": "نمایش همه رویدادها",
"Blocking API endpoints": "مسدود کردن نقاط پایانی API", "Blocking API endpoints": "مسدود کردن نقاط پایانی API",
"Payment required": "مستلزم پرداخت", "Payment required": "مستلزم پرداخت",
"It's time to splash that cash": "وقت آن است که آن پول نقد را بپاشیم" "It's time to splash that cash": "وقت آن است که آن پول نقد را بپاشیم",
"Premium account": "حساب ویژه"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Afficher tous les événements", "Show all events": "Afficher tous les événements",
"Blocking API endpoints": "Blocage des points de terminaison de l'API", "Blocking API endpoints": "Blocage des points de terminaison de l'API",
"Payment required": "Paiement Requis", "Payment required": "Paiement Requis",
"It's time to splash that cash": "Il est temps de dépenser cet argent" "It's time to splash that cash": "Il est temps de dépenser cet argent",
"Premium account": "Compte Premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Taispeáin gach imeacht", "Show all events": "Taispeáin gach imeacht",
"Blocking API endpoints": "Ag cur bac ar chríochphointí API", "Blocking API endpoints": "Ag cur bac ar chríochphointí API",
"Payment required": "Íocaíocht ag teastáil", "Payment required": "Íocaíocht ag teastáil",
"It's time to splash that cash": "Tá sé in am an t-airgead sin a splancadh" "It's time to splash that cash": "Tá sé in am an t-airgead sin a splancadh",
"Premium account": "Cuntas préimhe"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "הצג את כל האירועים", "Show all events": "הצג את כל האירועים",
"Blocking API endpoints": "חסימת נקודות קצה של API", "Blocking API endpoints": "חסימת נקודות קצה של API",
"Payment required": "נדרש תשלום", "Payment required": "נדרש תשלום",
"It's time to splash that cash": "הגיע הזמן להתיז את המזומנים האלה" "It's time to splash that cash": "הגיע הזמן להתיז את המזומנים האלה",
"Premium account": "חשבון פרימיום"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "सभी घटनाएँ दिखाएँ", "Show all events": "सभी घटनाएँ दिखाएँ",
"Blocking API endpoints": "एपीआई समापनबिंदुओं को अवरुद्ध करना", "Blocking API endpoints": "एपीआई समापनबिंदुओं को अवरुद्ध करना",
"Payment required": "भुगतान की आवश्यकता है", "Payment required": "भुगतान की आवश्यकता है",
"It's time to splash that cash": "अब उस नकदी को बिखेरने का समय आ गया है" "It's time to splash that cash": "अब उस नकदी को बिखेरने का समय आ गया है",
"Premium account": "प्रीमियम खाता"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Mostra tutti gli eventi", "Show all events": "Mostra tutti gli eventi",
"Blocking API endpoints": "Blocco degli endpoint API", "Blocking API endpoints": "Blocco degli endpoint API",
"Payment required": "Pagamento richiesto", "Payment required": "Pagamento richiesto",
"It's time to splash that cash": "È ora di spendere quei soldi" "It's time to splash that cash": "È ora di spendere quei soldi",
"Premium account": "Account premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "すべてのイベントを表示", "Show all events": "すべてのイベントを表示",
"Blocking API endpoints": "APIエンドポイントのブロック", "Blocking API endpoints": "APIエンドポイントのブロック",
"Payment required": "支払いが必要", "Payment required": "支払いが必要",
"It's time to splash that cash": "お金を投じる時が来ました" "It's time to splash that cash": "お金を投じる時が来ました",
"Premium account": "プレミアムアカウント"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "모든 이벤트 표시", "Show all events": "모든 이벤트 표시",
"Blocking API endpoints": "API 엔드포인트 차단", "Blocking API endpoints": "API 엔드포인트 차단",
"Payment required": "결제 필요", "Payment required": "결제 필요",
"It's time to splash that cash": "이제 그 현금을 쏟아부을 시간이다" "It's time to splash that cash": "이제 그 현금을 쏟아부을 시간이다",
"Premium account": "프리미엄 계정"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Hemî bûyeran nîşan bide", "Show all events": "Hemî bûyeran nîşan bide",
"Blocking API endpoints": "Astengkirina xalên dawiya API-ê", "Blocking API endpoints": "Astengkirina xalên dawiya API-ê",
"Payment required": "Payment pêwîst", "Payment required": "Payment pêwîst",
"It's time to splash that cash": "Wext e ku meriv wê drav birijîne" "It's time to splash that cash": "Wext e ku meriv wê drav birijîne",
"Premium account": "Hesabê Premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Toon alle evenementen", "Show all events": "Toon alle evenementen",
"Blocking API endpoints": "API-eindpunten blokkeren", "Blocking API endpoints": "API-eindpunten blokkeren",
"Payment required": "Betaling Vereist", "Payment required": "Betaling Vereist",
"It's time to splash that cash": "Het is tijd om met dat geld te spetteren" "It's time to splash that cash": "Het is tijd om met dat geld te spetteren",
"Premium account": "Premium account"
} }

View File

@ -655,5 +655,6 @@
"Show all events": "Show all events", "Show all events": "Show all events",
"Blocking API endpoints": "Blocking API endpoints", "Blocking API endpoints": "Blocking API endpoints",
"Payment required": "Payment required", "Payment required": "Payment required",
"It's time to splash that cash": "It's time to splash that cash" "It's time to splash that cash": "It's time to splash that cash",
"Premium account": "Premium account"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Pokaż wszystkie wydarzenia", "Show all events": "Pokaż wszystkie wydarzenia",
"Blocking API endpoints": "Blokowanie punktów końcowych API", "Blocking API endpoints": "Blokowanie punktów końcowych API",
"Payment required": "Płatność wymagana", "Payment required": "Płatność wymagana",
"It's time to splash that cash": "Czas przelać tę kasę" "It's time to splash that cash": "Czas przelać tę kasę",
"Premium account": "Konto premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Mostrar todos os eventos", "Show all events": "Mostrar todos os eventos",
"Blocking API endpoints": "Bloqueio de endpoints de API", "Blocking API endpoints": "Bloqueio de endpoints de API",
"Payment required": "Pagamento Requerido", "Payment required": "Pagamento Requerido",
"It's time to splash that cash": "É hora de gastar esse dinheiro" "It's time to splash that cash": "É hora de gastar esse dinheiro",
"Premium account": "Conta Premium"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Показать все события", "Show all events": "Показать все события",
"Blocking API endpoints": "Блокировка конечных точек API", "Blocking API endpoints": "Блокировка конечных точек API",
"Payment required": "Требуется оплата", "Payment required": "Требуется оплата",
"It's time to splash that cash": "Пришло время выплеснуть эти деньги" "It's time to splash that cash": "Пришло время выплеснуть эти деньги",
"Premium account": "Премиум аккаунт"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Onyesha matukio yote", "Show all events": "Onyesha matukio yote",
"Blocking API endpoints": "Inazuia miisho ya API", "Blocking API endpoints": "Inazuia miisho ya API",
"Payment required": "Malipo yanahitajika", "Payment required": "Malipo yanahitajika",
"It's time to splash that cash": "Ni wakati wa kunyunyiza pesa hizo" "It's time to splash that cash": "Ni wakati wa kunyunyiza pesa hizo",
"Premium account": "Akaunti ya malipo"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Tüm etkinlikleri göster", "Show all events": "Tüm etkinlikleri göster",
"Blocking API endpoints": "API uç noktalarını engelleme", "Blocking API endpoints": "API uç noktalarını engelleme",
"Payment required": "Ödeme gerekli", "Payment required": "Ödeme gerekli",
"It's time to splash that cash": "O parayı sıçratmanın zamanı geldi" "It's time to splash that cash": "O parayı sıçratmanın zamanı geldi",
"Premium account": "Özel hesap"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "Показати всі події", "Show all events": "Показати всі події",
"Blocking API endpoints": "Блокування кінцевих точок API", "Blocking API endpoints": "Блокування кінцевих точок API",
"Payment required": "Потрібна оплата", "Payment required": "Потрібна оплата",
"It's time to splash that cash": "Настав час виплеснути ці гроші" "It's time to splash that cash": "Настав час виплеснути ці гроші",
"Premium account": "Преміум акаунт"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "ווייַזן אַלע געשעענישן", "Show all events": "ווייַזן אַלע געשעענישן",
"Blocking API endpoints": "בלאַקינג אַפּי ענדפּאָינץ", "Blocking API endpoints": "בלאַקינג אַפּי ענדפּאָינץ",
"Payment required": "צאָלונג פארלאנגט", "Payment required": "צאָלונג פארלאנגט",
"It's time to splash that cash": "עס איז צייט צו שפּריצן די געלט" "It's time to splash that cash": "עס איז צייט צו שפּריצן די געלט",
"Premium account": "פּרעמיום חשבון"
} }

View File

@ -659,5 +659,6 @@
"Show all events": "显示所有活动", "Show all events": "显示所有活动",
"Blocking API endpoints": "阻止 API 端点", "Blocking API endpoints": "阻止 API 端点",
"Payment required": "需要付款", "Payment required": "需要付款",
"It's time to splash that cash": "是时候挥霍现金了" "It's time to splash that cash": "是时候挥霍现金了",
"Premium account": "至尊帐号"
} }

View File

@ -609,7 +609,8 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
person_url: str, person_url: str,
no_of_books: int, no_of_books: int,
authorized: bool, authorized: bool,
birth_date: str) -> str: birth_date: str,
premium: bool) -> str:
"""The header of the profile screen, containing background """The header of the profile screen, containing background
image and avatar image and avatar
""" """
@ -636,9 +637,13 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
occupation_str += \ occupation_str += \
' <b>' + occupation_name + '</b><br>\n' ' <b>' + occupation_name + '</b><br>\n'
html_str += ' <h1>' + display_name + '\n</h1>\n'
if premium:
html_str += \ html_str += \
' <h1>' + display_name + '\n</h1>\n' + \ ' <b>' + translate['Premium account'] + '</b><br>\n'
occupation_str
html_str += occupation_str
# show if the actor is proxied # show if the actor is proxied
if not actor_proxied: if not actor_proxied:
@ -917,6 +922,13 @@ def _get_profile_header_after_search(base_dir: str,
return html_str return html_str
def _is_premium_account(base_dir: str, nickname: str, domain: str) -> bool:
""" Is the given account a premium one?
"""
premium_filename = acct_dir(base_dir, nickname, domain) + '/.premium'
return os.path.isfile(premium_filename)
def html_profile(signing_priv_key_pem: str, def html_profile(signing_priv_key_pem: str,
rss_icon_at_top: bool, rss_icon_at_top: bool,
icons_as_buttons: bool, icons_as_buttons: bool,
@ -1056,6 +1068,7 @@ def html_profile(signing_priv_key_pem: str,
briar_address = get_briar_address(profile_json) briar_address = get_briar_address(profile_json)
cwtch_address = get_cwtch_address(profile_json) cwtch_address = get_cwtch_address(profile_json)
verified_site_checkmark = '' verified_site_checkmark = ''
premium = _is_premium_account(base_dir, nickname, domain)
if donate_url or website_url or repo_url or xmpp_address or \ if donate_url or website_url or repo_url or xmpp_address or \
matrix_address or ssb_address or tox_address or briar_address or \ matrix_address or ssb_address or tox_address or briar_address or \
cwtch_address or pgp_pub_key or enigma_pub_key or \ cwtch_address or pgp_pub_key or enigma_pub_key or \
@ -1063,10 +1076,13 @@ def html_profile(signing_priv_key_pem: str,
donate_section = '<div class="container">\n' donate_section = '<div class="container">\n'
donate_section += ' <center>\n' donate_section += ' <center>\n'
if donate_url and not is_system_account(nickname): if donate_url and not is_system_account(nickname):
donate_str = translate['Donate']
if premium:
donate_str = translate['Subscribe']
donate_section += \ donate_section += \
' <p><a href="' + donate_url + \ ' <p><a href="' + donate_url + \
'" tabindex="1" rel="donation">' + \ '" tabindex="1" rel="donation">' + \
'<button class="donateButton">' + translate['Donate'] + \ '<button class="donateButton">' + donate_str + \
'</button></a></p>\n' '</button></a></p>\n'
if website_url: if website_url:
if site_is_verified(session, base_dir, http_prefix, if site_is_verified(session, base_dir, http_prefix,
@ -1313,7 +1329,7 @@ def html_profile(signing_priv_key_pem: str,
occupation_name, occupation_name,
actor_proxied, actor, actor_proxied, actor,
no_of_books, authorized, no_of_books, authorized,
birth_date) birth_date, premium)
# keyboard navigation # keyboard navigation
user_path_str = '/users/' + nickname user_path_str = '/users/' + nickname
@ -1468,7 +1484,7 @@ def html_profile(signing_priv_key_pem: str,
translate['Get the source code'] + '" title="' + \ translate['Get the source code'] + '" title="' + \
translate['Get the source code'] + '" src="/icons/agpl.png" /></a>' translate['Get the source code'] + '" src="/icons/agpl.png" /></a>'
if selected == 'posts': if selected == 'posts' and not premium:
max_profile_posts = \ max_profile_posts = \
get_max_profile_posts(base_dir, nickname, domain, 20) get_max_profile_posts(base_dir, nickname, domain, 20)
min_images_for_accounts = [] min_images_for_accounts = []
@ -2865,9 +2881,11 @@ def _html_edit_profile_main(base_dir: str, display_nickname: str, bio_str: str,
edit_text_field(translate['Moved to new account address'], 'movedTo', edit_text_field(translate['Moved to new account address'], 'movedTo',
moved_to, 'https://...') moved_to, 'https://...')
donate_str = translate['Donations link']
if _is_premium_account(base_dir, nickname, domain):
donate_str = translate['Subscribe']
edit_profile_form += \ edit_profile_form += \
edit_text_field(translate['Donations link'], 'donateUrl', edit_text_field(donate_str, 'donateUrl', donate_url, 'https://...')
donate_url, 'https://...')
edit_profile_form += \ edit_profile_form += \
edit_text_field(translate['Website'], 'websiteUrl', edit_text_field(translate['Website'], 'websiteUrl',