From de313157e9ae29466a1bbedc6b274f8276854b20 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 8 Nov 2022 19:48:09 +0000 Subject: [PATCH 01/14] Send button for dms --- translations/ar.json | 3 ++- translations/bn.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/el.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ko.json | 3 ++- translations/ku.json | 3 ++- translations/nl.json | 3 ++- translations/oc.json | 3 ++- translations/pl.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/tr.json | 3 ++- translations/uk.json | 3 ++- translations/yi.json | 3 ++- translations/zh.json | 3 ++- webapp_create_post.py | 5 ++++- 26 files changed, 54 insertions(+), 26 deletions(-) diff --git a/translations/ar.json b/translations/ar.json index 9ac84707f..33257ce21 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "رفض حسابات البريد العشوائي", "User Manual": "دليل الاستخدام", - "Allow announces": "تعلن السماح" + "Allow announces": "تعلن السماح", + "Send": "إرسال" } diff --git a/translations/bn.json b/translations/bn.json index d1585defb..8931ea853 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "স্প্যাম অ্যাকাউন্ট প্রত্যাখ্যান করুন", "User Manual": "ব্যবহার বিধি", - "Allow announces": "ঘোষণার অনুমতি দিন" + "Allow announces": "ঘোষণার অনুমতি দিন", + "Send": "পাঠান" } diff --git a/translations/ca.json b/translations/ca.json index f8f89aaf0..82d94a1b6 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Rebutja els comptes de correu brossa", "User Manual": "Manual d'usuari", - "Allow announces": "Permet anuncis" + "Allow announces": "Permet anuncis", + "Send": "Enviar" } diff --git a/translations/cy.json b/translations/cy.json index b7fd46cd9..1a23578a4 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Gwrthod cyfrifon sbam", "User Manual": "Llawlyfr Defnyddiwr", - "Allow announces": "Caniatáu cyhoeddiadau" + "Allow announces": "Caniatáu cyhoeddiadau", + "Send": "Anfon" } diff --git a/translations/de.json b/translations/de.json index 392968280..4a4a03a1b 100644 --- a/translations/de.json +++ b/translations/de.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Gwrthod cyfrifon sbam", "User Manual": "Benutzerhandbuch", - "Allow announces": "Zulassen kündigt an" + "Allow announces": "Zulassen kündigt an", + "Send": "Senden" } diff --git a/translations/el.json b/translations/el.json index 28a04b514..582241efc 100644 --- a/translations/el.json +++ b/translations/el.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Gwrthod cyfrifon sbam", "User Manual": "Εγχειρίδιο χρήστη", - "Allow announces": "Allow ανακοινώνει" + "Allow announces": "Allow ανακοινώνει", + "Send": "Στείλετε" } diff --git a/translations/en.json b/translations/en.json index 1e66e70f9..f5c8d8dca 100644 --- a/translations/en.json +++ b/translations/en.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Reject spam accounts", "User Manual": "User Manual", - "Allow announces": "Allow announces" + "Allow announces": "Allow announces", + "Send": "Send" } diff --git a/translations/es.json b/translations/es.json index dfb233c07..85c67e1ee 100644 --- a/translations/es.json +++ b/translations/es.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Rechazar cuentas de spam", "User Manual": "Manual de usuario", - "Allow announces": "Permitir anuncios" + "Allow announces": "Permitir anuncios", + "Send": "Enviar" } diff --git a/translations/fr.json b/translations/fr.json index 1652a4c56..e3c1947f6 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Rejeter les comptes de spam", "User Manual": "Manuel de l'Utilisateur", - "Allow announces": "Autoriser les annonces" + "Allow announces": "Autoriser les annonces", + "Send": "Envoyer" } diff --git a/translations/ga.json b/translations/ga.json index 0589f0e24..a6d84e9ea 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Diúltaigh cuntais turscair", "User Manual": "Lámhleabhar Úsáideora", - "Allow announces": "Ceadaigh fógraí" + "Allow announces": "Ceadaigh fógraí", + "Send": "Seol" } diff --git a/translations/hi.json b/translations/hi.json index 560d4e201..b6827900e 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "स्पैम खातों को अस्वीकार करें", "User Manual": "उपयोगकर्ता पुस्तिका", - "Allow announces": "घोषणा की अनुमति दें" + "Allow announces": "घोषणा की अनुमति दें", + "Send": "भेजना" } diff --git a/translations/it.json b/translations/it.json index e2a4559e5..005f70ac8 100644 --- a/translations/it.json +++ b/translations/it.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Rifiuta gli account spam", "User Manual": "Manuale d'uso", - "Allow announces": "Consenti annunci" + "Allow announces": "Consenti annunci", + "Send": "Inviare" } diff --git a/translations/ja.json b/translations/ja.json index e5d0d80f9..f156e9f74 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "スパムアカウントを拒否", "User Manual": "ユーザーマニュアル", - "Allow announces": "アナウンスを許可" + "Allow announces": "アナウンスを許可", + "Send": "送信" } diff --git a/translations/ko.json b/translations/ko.json index 00b8ee2ea..26a01a955 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "스팸 계정 거부", "User Manual": "사용자 매뉴얼", - "Allow announces": "공지 허용" + "Allow announces": "공지 허용", + "Send": "보내다" } diff --git a/translations/ku.json b/translations/ku.json index ce3dd1bdb..bd7680798 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Hesabên spam red bikin", "User Manual": "Manual Bikarhêner", - "Allow announces": "Destûr dide ragihandin" + "Allow announces": "Destûr dide ragihandin", + "Send": "Şandin" } diff --git a/translations/nl.json b/translations/nl.json index 591668797..1848cc074 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Spamaccounts afwijzen", "User Manual": "Handleiding", - "Allow announces": "Aankondigingen toestaan" + "Allow announces": "Aankondigingen toestaan", + "Send": "Versturen" } diff --git a/translations/oc.json b/translations/oc.json index fc514f626..f7aaefda8 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -592,5 +592,6 @@ "devops": "devops", "Reject spam accounts": "Reject spam accounts", "User Manual": "User Manual", - "Allow announces": "Allow announces" + "Allow announces": "Allow announces", + "Send": "Send" } diff --git a/translations/pl.json b/translations/pl.json index 1c4b3c514..fb71d30c1 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Odrzuć konta spamowe", "User Manual": "Instrukcja obsługi", - "Allow announces": "Zezwól na ogłoszenia" + "Allow announces": "Zezwól na ogłoszenia", + "Send": "Wysłać" } diff --git a/translations/pt.json b/translations/pt.json index dfcb99f94..8e5ff42f1 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Rejeitar contas de spam", "User Manual": "Manual do usuário", - "Allow announces": "Permitir anúncios" + "Allow announces": "Permitir anúncios", + "Send": "Mandar" } diff --git a/translations/ru.json b/translations/ru.json index e3dee70e4..55c8f3f6b 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Отклонить спам-аккаунты", "User Manual": "Руководство пользователя", - "Allow announces": "Разрешить объявления" + "Allow announces": "Разрешить объявления", + "Send": "Отправлять" } diff --git a/translations/sw.json b/translations/sw.json index 848475e63..fcda7ebfa 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Kataa akaunti za barua taka", "User Manual": "Mwongozo wa mtumiaji", - "Allow announces": "Ruhusu matangazo" + "Allow announces": "Ruhusu matangazo", + "Send": "Tuma" } diff --git a/translations/tr.json b/translations/tr.json index f5561cecc..36cca3993 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Spam hesapları reddet", "User Manual": "Kullanım kılavuzu", - "Allow announces": "Duyurulara izin ver" + "Allow announces": "Duyurulara izin ver", + "Send": "Göndermek" } diff --git a/translations/uk.json b/translations/uk.json index b77aed64f..2312ad352 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "Відхилити спам-акаунти", "User Manual": "Посібник користувача", - "Allow announces": "Дозволити оголошення" + "Allow announces": "Дозволити оголошення", + "Send": "" } diff --git a/translations/yi.json b/translations/yi.json index 287c5a75d..1cb086745 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "אָפּוואַרפן ספּאַם אַקאַונץ", "User Manual": "באנוצער אנווייזער", - "Allow announces": "לאָזן אַנאַונסיז" + "Allow announces": "לאָזן אַנאַונסיז", + "Send": "שיקן" } diff --git a/translations/zh.json b/translations/zh.json index 63773410e..1a9b1bbe6 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -596,5 +596,6 @@ "devops": "devops", "Reject spam accounts": "拒绝垃圾邮件帐户", "User Manual": "用户手册", - "Allow announces": "לאָזן אַנאַונסיז" + "Allow announces": "לאָזן אַנאַונסיז", + "Send": "发送" } diff --git a/webapp_create_post.py b/webapp_create_post.py index 3bb172511..859f0b85c 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -880,7 +880,10 @@ def html_new_post(media_instance: bool, translate: {}, ' \n' - submit_text = translate['Publish'] + if box_name != 'dm': + submit_text = translate['Publish'] + else: + submit_text = translate['Send'] if custom_submit_text: submit_text = custom_submit_text new_post_form += \ From fb1f08bce7ff76bd9a122df780580444d74420fc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 8 Nov 2022 19:53:26 +0000 Subject: [PATCH 02/14] dm condition --- webapp_create_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index 859f0b85c..b8461cc35 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -880,7 +880,7 @@ def html_new_post(media_instance: bool, translate: {}, ' \n' - if box_name != 'dm': + if not path.endswith('/newdm'): submit_text = translate['Publish'] else: submit_text = translate['Send'] From 26ca9342b90874c6dd243c43022b86f449cb9a53 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 8 Nov 2022 20:20:36 +0000 Subject: [PATCH 03/14] Send button for reports --- webapp_create_post.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index b8461cc35..c764f442b 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -880,7 +880,8 @@ def html_new_post(media_instance: bool, translate: {}, ' \n' - if not path.endswith('/newdm'): + if not path.endswith('/newdm') and \ + not path.endswith('/newreport'): submit_text = translate['Publish'] else: submit_text = translate['Send'] From f92de60558faebfc3d0e80f292d12ab35cae8020 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 10:40:11 +0000 Subject: [PATCH 04/14] Function for url cross-verification --- epicyon.py | 34 ++++++++++++++++++++++++++++++++++ session.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/epicyon.py b/epicyon.py index f064d75a8..4ab1cec28 100644 --- a/epicyon.py +++ b/epicyon.py @@ -48,6 +48,7 @@ from session import create_session from session import get_json from session import get_vcard from session import download_html +from session import verify_html from session import download_ssml from newswire import get_rss from filters import add_filter @@ -373,6 +374,9 @@ def _command_options() -> None: help='Show the SSML for a given activitypub url') parser.add_argument('--htmlpost', dest='htmlpost', type=str, default=None, help='Show the html for a given activitypub url') + parser.add_argument('--verifyurl', dest='verifyurl', type=str, + default=None, + help='Verify an identity using the given url') parser.add_argument('--rss', dest='rss', type=str, default=None, help='Show an rss feed for a given url') parser.add_argument('-f', '--federate', nargs='+', dest='federation_list', @@ -1159,6 +1163,36 @@ def _command_options() -> None: print(test_html) sys.exit() + if argb.verifyurl: + if not argb.nickname: + print('You must specify a nickname for the handle ' + + 'to be verified nickname@domain using the ' + + '--nickname option') + sys.exit() + profile_str = 'https://www.w3.org/ns/activitystreams' + as_header = { + 'Accept': 'text/html; profile="' + profile_str + '"' + } + if not argb.domain: + argb.domain = get_config_param(base_dir, 'domain') + domain = '' + if argb.domain: + domain = argb.domain + if not domain: + print('You must specify a domain for the handle ' + + 'to be verified nickname@domain using the ' + + '--domain option') + sys.exit() + session = create_session(None) + verified = \ + verify_html(session, argb.verifyurl, debug, __version__, + http_prefix, argb.nickname, domain) + if verified: + print('Verified') + sys.exit() + print('Verification failed') + sys.exit() + # create cache for actors if not os.path.isdir(base_dir + '/cache'): os.mkdir(base_dir + '/cache') diff --git a/session.py b/session.py index 3d153e265..074e0cc35 100644 --- a/session.py +++ b/session.py @@ -372,6 +372,43 @@ def download_html(signing_priv_key_pem: str, None, quiet, debug, False) +def verify_html(session, url: str, debug: bool, + version: str, http_prefix: str, nickname: str, domain: str, + timeout_sec: int = 20, quiet: bool = False) -> bool: + """Verify that the handle for nickname@domain exists within the + given url + """ + as_header = { + 'Accept': 'text/html' + } + verification_site_html = \ + download_html(None, session, url, + as_header, None, debug, __version__, + http_prefix, domain, timeout_sec, quiet) + if not verification_site_html: + if debug: + print('Verification site could not be contacted ' + + url) + return False + verification_site_html = verification_site_html.decode() + actor_links = [ + domain + '/@' + nickname, + domain + '/users/' + nickname + ] + for actor in actor_links: + if domain.endswith('.onion') or domain.endswith('.i2p'): + actor = 'http://' + actor + else: + actor = http_prefix + '://' + actor + link_str = ' rel="me" href="' + actor + '"' + if link_str in verification_site_html: + return True + link_str = ' href="' + actor + '" rel="me"' + if link_str in verification_site_html: + return True + return False + + def download_ssml(signing_priv_key_pem: str, session, url: str, headers: {}, params: {}, debug: bool, version: str, http_prefix: str, domain: str, From 61cbc36126fd850c80103b3917fbf0c2142b6c15 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 10:44:36 +0000 Subject: [PATCH 05/14] Missing translation --- translations/uk.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/uk.json b/translations/uk.json index 2312ad352..83cbd5b03 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -597,5 +597,5 @@ "Reject spam accounts": "Відхилити спам-акаунти", "User Manual": "Посібник користувача", "Allow announces": "Дозволити оголошення", - "Send": "" + "Send": "Надіслати" } From 7c22ebd582b9946979e739dd7af6aeeb74819bd9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 12:10:29 +0000 Subject: [PATCH 06/14] Verification of website and blog --- daemon.py | 15 +++++++++++++++ session.py | 37 +++++++++++++++++++++++++++++++++++++ webapp_profile.py | 16 ++++++++++++++-- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index f2d2e7283..d3a8286bb 100644 --- a/daemon.py +++ b/daemon.py @@ -21,6 +21,7 @@ from functools import partial from hashlib import sha256 from hashlib import md5 from shutil import copyfile +from session import site_is_verified from session import create_session from session import get_session_for_domain from session import get_session_for_domains @@ -6309,6 +6310,13 @@ class PubServer(BaseHTTPRequestHandler): if fields['blogAddress'] != current_blog_address: set_blog_address(actor_json, fields['blogAddress']) + site_is_verified(curr_session, + self.server.base_dir, + self.server.http_prefix, + nickname, domain, + fields['blogAddress'], + True, + self.server.debug) actor_changed = True else: if current_blog_address: @@ -6479,6 +6487,13 @@ class PubServer(BaseHTTPRequestHandler): set_website(actor_json, fields['websiteUrl'], self.server.translate) + site_is_verified(curr_session, + self.server.base_dir, + self.server.http_prefix, + nickname, domain, + fields['websiteUrl'], + True, + self.server.debug) actor_changed = True else: if current_website: diff --git a/session.py b/session.py index 074e0cc35..cfb0b2744 100644 --- a/session.py +++ b/session.py @@ -9,6 +9,8 @@ __module_group__ = "Session" import os import requests +from utils import text_in_file +from utils import acct_dir from utils import url_permitted from utils import is_image_file from httpsig import create_signed_header @@ -378,6 +380,9 @@ def verify_html(session, url: str, debug: bool, """Verify that the handle for nickname@domain exists within the given url """ + if not url_exists(session, url, 3, http_prefix, domain): + return False + as_header = { 'Accept': 'text/html' } @@ -409,6 +414,38 @@ def verify_html(session, url: str, debug: bool, return False +def site_is_verified(session, base_dir: str, http_prefix: str, + nickname: str, domain: str, + url: str, update: bool, debug: bool) -> bool: + """Is the given website verified? + """ + verified_sites_filename = \ + acct_dir(base_dir, nickname, domain) + '/verified_sites.txt' + verified_file_exists = False + if os.path.isfile(verified_sites_filename): + verified_file_exists = True + if text_in_file(url, verified_sites_filename + '\n', True): + return True + if not update: + return False + + verified = \ + verify_html(session, url, debug, + __version__, http_prefix, nickname, domain) + if verified: + write_type = 'a+' + if not verified_file_exists: + write_type = 'w+' + try: + with open(verified_sites_filename, write_type, + encoding='utf-8') as fp_verified: + fp_verified.write(url + '\n') + except OSError: + print('EX: Verified sites could not be updated ' + + verified_sites_filename) + return verified + + def download_ssml(signing_priv_key_pem: str, session, url: str, headers: {}, params: {}, debug: bool, version: str, http_prefix: str, domain: str, diff --git a/webapp_profile.py b/webapp_profile.py index f7f91dfca..e5733ac86 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -84,6 +84,7 @@ from blocking import get_cw_list_variable from blocking import is_blocked from content import bold_reading_string from roles import is_devops +from session import site_is_verified THEME_FORMATS = '.zip, .gz' @@ -712,6 +713,7 @@ def html_profile(signing_priv_key_pem: str, tox_address = get_tox_address(profile_json) briar_address = get_briar_address(profile_json) cwtch_address = get_cwtch_address(profile_json) + verified_site_checkmark = '✔️' if donate_url or website_url or xmpp_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 \ @@ -724,8 +726,13 @@ def html_profile(signing_priv_key_pem: str, '

\n' if website_url: + donate_section += '

' + translate['Website'] + ': ' + if site_is_verified(session, base_dir, http_prefix, + nickname, domain, + website_url, False, debug): + donate_section += verified_site_checkmark donate_section += \ - '

' + translate['Website'] + ': ' + \ website_url + '

\n' if gemini_link: @@ -739,8 +746,13 @@ def html_profile(signing_priv_key_pem: str, email_address + '" tabindex="1">' + \ email_address + '

\n' if blog_address: + donate_section += '

Blog: ' + if site_is_verified(session, base_dir, http_prefix, + nickname, domain, + blog_address, False, debug): + donate_section += verified_site_checkmark donate_section += \ - '

Blog: ' + \ blog_address + '

\n' if xmpp_address: From 60539478969ee951eed5771786267d8c87396741 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 12:16:18 +0000 Subject: [PATCH 07/14] Verification of website and blog --- daemon.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/daemon.py b/daemon.py index d3a8286bb..b0c8a0b30 100644 --- a/daemon.py +++ b/daemon.py @@ -6310,14 +6310,14 @@ class PubServer(BaseHTTPRequestHandler): if fields['blogAddress'] != current_blog_address: set_blog_address(actor_json, fields['blogAddress']) - site_is_verified(curr_session, - self.server.base_dir, - self.server.http_prefix, - nickname, domain, - fields['blogAddress'], - True, - self.server.debug) actor_changed = True + site_is_verified(curr_session, + self.server.base_dir, + self.server.http_prefix, + nickname, domain, + fields['blogAddress'], + True, + self.server.debug) else: if current_blog_address: set_blog_address(actor_json, '') @@ -6487,14 +6487,14 @@ class PubServer(BaseHTTPRequestHandler): set_website(actor_json, fields['websiteUrl'], self.server.translate) - site_is_verified(curr_session, - self.server.base_dir, - self.server.http_prefix, - nickname, domain, - fields['websiteUrl'], - True, - self.server.debug) actor_changed = True + site_is_verified(curr_session, + self.server.base_dir, + self.server.http_prefix, + nickname, domain, + fields['websiteUrl'], + True, + self.server.debug) else: if current_website: set_website(actor_json, '', self.server.translate) From 2d7b3e06a2419d6fbda330fd5b11635923507ff7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 12:22:13 +0000 Subject: [PATCH 08/14] Ending on wrong parameter --- session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session.py b/session.py index cfb0b2744..16971aadd 100644 --- a/session.py +++ b/session.py @@ -424,7 +424,7 @@ def site_is_verified(session, base_dir: str, http_prefix: str, verified_file_exists = False if os.path.isfile(verified_sites_filename): verified_file_exists = True - if text_in_file(url, verified_sites_filename + '\n', True): + if text_in_file(url + '\n', verified_sites_filename, True): return True if not update: return False From 46553d82230a8a1d082cb3a0dcc75dc0e884ed98 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 12:34:48 +0000 Subject: [PATCH 09/14] Different color for verified sites --- epicyon-profile.css | 5 +++++ webapp_profile.py | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index 0ac1a1819..78f736349 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -35,6 +35,7 @@ --pageslist-color: #dddddd; --pageslist-selected-color: white; --main-fg-color: #dddddd; + --verified-site-color: green; --cw-color: #dddddd; --cw-style: normal; --cw-weight: bold; @@ -1126,6 +1127,10 @@ h3 { user-select: all; } +.verified_site { + color: var(--verified-site-color) +} + @media screen and (min-width: 400px) { body, html { background-color: var(--main-bg-color); diff --git a/webapp_profile.py b/webapp_profile.py index e5733ac86..f8e5a8195 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -726,13 +726,18 @@ def html_profile(signing_priv_key_pem: str, '

\n' if website_url: - donate_section += '

' + translate['Website'] + ': ' + donate_section += \ + '

' + translate['Website'] + ': ' if site_is_verified(session, base_dir, http_prefix, nickname, domain, website_url, False, debug): - donate_section += verified_site_checkmark + donate_section += \ + verified_site_checkmark + \ + '' + \ website_url + '

\n' if gemini_link: @@ -750,9 +755,13 @@ def html_profile(signing_priv_key_pem: str, if site_is_verified(session, base_dir, http_prefix, nickname, domain, blog_address, False, debug): - donate_section += verified_site_checkmark + donate_section += \ + verified_site_checkmark + \ + '' + \ blog_address + '

\n' if xmpp_address: From fcb79e2597fda8271cc400710c91c6843b2dedb6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 13:08:32 +0000 Subject: [PATCH 10/14] Verified website style --- webapp_profile.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index f8e5a8195..c21ea8a93 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -713,7 +713,7 @@ def html_profile(signing_priv_key_pem: str, tox_address = get_tox_address(profile_json) briar_address = get_briar_address(profile_json) cwtch_address = get_cwtch_address(profile_json) - verified_site_checkmark = '✔️' + verified_site_checkmark = '✔' if donate_url or website_url or xmpp_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 \ @@ -732,14 +732,16 @@ def html_profile(signing_priv_key_pem: str, nickname, domain, website_url, False, debug): donate_section += \ + '
' + \ verified_site_checkmark + \ - '' + \ + website_url + '

\n' else: - donate_section += '' + \ - website_url + '

\n' + donate_section += \ + '' + \ + website_url + '

\n' if gemini_link: donate_section += \ '

' + 'Gemini' + ': ' + translate['Donate'] + \ '

\n' if website_url: - donate_section += \ - '

' + translate['Website'] + ': ' if site_is_verified(session, base_dir, http_prefix, nickname, domain, website_url, False, debug): donate_section += \ - '

' + \ + '

' + \ + translate['Website'] + ': ' + \ verified_site_checkmark + \ '' + \ website_url + '

\n' else: donate_section += \ + '

' + translate['Website'] + ': ' + \ '' + \ website_url + '

\n' From c690e1659664b8633dfc6ab17deacc82cc054800 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 13:14:00 +0000 Subject: [PATCH 12/14] Verified website style --- epicyon-profile.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index 78f736349..ef6e03fc2 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -35,7 +35,7 @@ --pageslist-color: #dddddd; --pageslist-selected-color: white; --main-fg-color: #dddddd; - --verified-site-color: green; + --verified-site-color: lightgreen; --cw-color: #dddddd; --cw-style: normal; --cw-weight: bold; @@ -1130,6 +1130,12 @@ h3 { .verified_site { color: var(--verified-site-color) } +.verified_site a:link { + color: var(--verified-site-color) +} +.verified_site a:visited { + color: var(--verified-site-color) +} @media screen and (min-width: 400px) { body, html { From 1b4d7427593ba3c4da066c9c64ac0f7bde27133d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Nov 2022 13:18:56 +0000 Subject: [PATCH 13/14] Verified blog style --- webapp_profile.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index da3b7d334..2404e5084 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -732,8 +732,7 @@ def html_profile(signing_priv_key_pem: str, donate_section += \ '

' + \ translate['Website'] + ': ' + \ - verified_site_checkmark + \ - '' + \ website_url + '

\n' else: @@ -753,19 +752,20 @@ def html_profile(signing_priv_key_pem: str, email_address + '" tabindex="1">' + \ email_address + '

\n' if blog_address: - donate_section += '

Blog: ' if site_is_verified(session, base_dir, http_prefix, nickname, domain, blog_address, False, debug): donate_section += \ - verified_site_checkmark + \ - '

\n' else: - donate_section += '' + \ - blog_address + '

\n' + donate_section += \ + '

Blog: ' + \ + blog_address + '

\n' if xmpp_address: donate_section += \ '

' + translate['XMPP'] + ':