Edit memorial accounts

main
Bob Mottram 2023-08-31 23:29:10 +01:00
parent 0f26c8fc0d
commit 12dfeee1f7
30 changed files with 150 additions and 30 deletions

View File

@ -296,6 +296,8 @@ from languages import set_actor_languages
from languages import get_understood_languages
from like import update_likes_collection
from reaction import update_reaction_collection
from utils import get_memorials
from utils import set_memorials
from utils import is_memorial_account
from utils import is_public_post_from_url
from utils import license_link_from_name
@ -6897,6 +6899,18 @@ class PubServer(BaseHTTPRequestHandler):
set_config_param(base_dir,
'instanceDescription', '')
# change memorial accounts
curr_memorial = get_memorials(base_dir)
if fields.get('memorialAccounts'):
if fields['memorialAccounts'] != \
curr_memorial:
set_memorials(base_dir,
fields['memorialAccounts'])
else:
if curr_memorial:
set_memorials(base_dir,
'memorialAccounts', '')
# change email address
current_email_address = get_email_address(actor_json)
if fields.get('email'):

View File

@ -634,5 +634,7 @@
"Block military instances": "منع الحالات العسكرية",
"Display on your public profile": "عرض على ملفك الشخصي العام",
"FollowWarning": "تحذير: قد يكون هذا المثيل يمنعك",
"FollowAccountWarning": "تحذير: قد يكون هذا الحساب قد قام بحظرك"
"FollowAccountWarning": "تحذير: قد يكون هذا الحساب قد قام بحظرك",
"Nicknames of memorial accounts (one per line)": "ألقاب الحسابات التذكارية (واحد في كل سطر)",
"Memorials": "النصب التذكارية"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "সামরিক দৃষ্টান্ত ব্লক করুন",
"Display on your public profile": "আপনার পাবলিক প্রোফাইলে প্রদর্শন করুন",
"FollowWarning": "সতর্কতা: এই উদাহরণটি আপনাকে অবরুদ্ধ করতে পারে",
"FollowAccountWarning": "সতর্কতা: এই অ্যাকাউন্টটি আপনাকে ব্লক করতে পারে"
"FollowAccountWarning": "সতর্কতা: এই অ্যাকাউন্টটি আপনাকে ব্লক করতে পারে",
"Nicknames of memorial accounts (one per line)": "স্মারক অ্যাকাউন্টের ডাকনাম (প্রতি লাইনে একটি)",
"Memorials": "স্মারক"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Bloquejar instàncies militars",
"Display on your public profile": "Mostra al teu perfil públic",
"FollowWarning": "ADVERTIMENT: aquesta instància pot estar bloquejant-vos",
"FollowAccountWarning": "ADVERTIMENT: és possible que aquest compte us estigui bloquejant"
"FollowAccountWarning": "ADVERTIMENT: és possible que aquest compte us estigui bloquejant",
"Nicknames of memorial accounts (one per line)": "Sobrenoms dels comptes commemoratius (un per línia)",
"Memorials": "Memorials"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Rhwystro achosion milwrol",
"Display on your public profile": "Arddangos ar eich proffil cyhoeddus",
"FollowWarning": "RHYBUDD: efallai bod yr achos hwn yn eich rhwystro",
"FollowAccountWarning": "RHYBUDD: efallai bod y cyfrif hwn yn eich rhwystro"
"FollowAccountWarning": "RHYBUDD: efallai bod y cyfrif hwn yn eich rhwystro",
"Nicknames of memorial accounts (one per line)": "Llysenwau cyfrifon coffa (un fesul llinell)",
"Memorials": "Cofebau"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Militärische Instanzen blockieren",
"Display on your public profile": "Anzeige in Ihrem öffentlichen Profil",
"FollowWarning": "ACHTUNG: Diese Instanz blockiert Sie möglicherweise",
"FollowAccountWarning": "ACHTUNG: Dieses Konto blockiert Sie möglicherweise"
"FollowAccountWarning": "ACHTUNG: Dieses Konto blockiert Sie möglicherweise",
"Nicknames of memorial accounts (one per line)": "Spitznamen der Gedenkkonten (einer pro Zeile)",
"Memorials": "Denkmäler"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Αποκλεισμός στρατιωτικών περιπτώσεων",
"Display on your public profile": "Εμφάνιση στο δημόσιο προφίλ σας",
"FollowWarning": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: αυτή η περίπτωση μπορεί να σας μπλοκάρει",
"FollowAccountWarning": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: αυτός ο λογαριασμός μπορεί να σας αποκλείει"
"FollowAccountWarning": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: αυτός ο λογαριασμός μπορεί να σας αποκλείει",
"Nicknames of memorial accounts (one per line)": "Ψευδώνυμα λογαριασμών μνήμης (ένα ανά γραμμή)",
"Memorials": "Μνημείων"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Block military instances",
"Display on your public profile": "Display on your public profile",
"FollowWarning": "WARNING: this instance may be blocking you",
"FollowAccountWarning": "WARNING: this account may be blocking you"
"FollowAccountWarning": "WARNING: this account may be blocking you",
"Nicknames of memorial accounts (one per line)": "Nicknames of memorial accounts (one per line)",
"Memorials": "Memorials"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Bloquear instancias militares",
"Display on your public profile": "Mostrar en su perfil público",
"FollowWarning": "ADVERTENCIA: esta instancia puede estar bloqueándote",
"FollowAccountWarning": "ADVERTENCIA: esta cuenta puede estar bloqueándote"
"FollowAccountWarning": "ADVERTENCIA: esta cuenta puede estar bloqueándote",
"Nicknames of memorial accounts (one per line)": "Apodos de cuentas conmemorativas (uno por línea)",
"Memorials": "Memoriales"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "موارد نظامی را مسدود کنید",
"Display on your public profile": "نمایش در نمایه عمومی شما",
"FollowWarning": "هشدار: این مورد ممکن است شما را مسدود کند",
"FollowAccountWarning": "هشدار: این حساب ممکن است شما را مسدود کند"
"FollowAccountWarning": "هشدار: این حساب ممکن است شما را مسدود کند",
"Nicknames of memorial accounts (one per line)": "نام مستعار حساب های یادبود (یکی در هر خط)",
"Memorials": "یادبودها"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Bloquer les instances militaires",
"Display on your public profile": "Afficher sur votre profil public",
"FollowWarning": "ATTENTION : cette instance peut vous bloquer",
"FollowAccountWarning": "ATTENTION : ce compte peut vous bloquer"
"FollowAccountWarning": "ATTENTION : ce compte peut vous bloquer",
"Nicknames of memorial accounts (one per line)": "Surnoms des comptes commémoratifs (un par ligne)",
"Memorials": "Mémoriaux"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Bloc cásanna míleata",
"Display on your public profile": "Taispeáin ar do phróifíl phoiblí",
"FollowWarning": "RABHADH: seans go bhfuil an cás seo ag cur bac ort",
"FollowAccountWarning": "RABHADH: seans go bhfuil an cuntas seo ag cur bac ort"
"FollowAccountWarning": "RABHADH: seans go bhfuil an cuntas seo ag cur bac ort",
"Nicknames of memorial accounts (one per line)": "Leasainmneacha na gcuntas cuimhneacháin (ceann in aghaidh na líne)",
"Memorials": "Cuimhneacháin"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "חסום מקרים צבאיים",
"Display on your public profile": "הצג בפרופיל הציבורי שלך",
"FollowWarning": "אזהרה: ייתכן שהמקרה הזה חוסם אותך",
"FollowAccountWarning": "אזהרה: ייתכן שחשבון זה חוסם אותך"
"FollowAccountWarning": "אזהרה: ייתכן שחשבון זה חוסם אותך",
"Nicknames of memorial accounts (one per line)": "כינויים של חשבונות זיכרון (אחד בכל שורה)",
"Memorials": "אנדרטאות"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "सैन्य उदाहरणों को ब्लॉक करें",
"Display on your public profile": "अपनी सार्वजनिक प्रोफ़ाइल पर प्रदर्शित करें",
"FollowWarning": "चेतावनी: यह उदाहरण आपको अवरुद्ध कर सकता है",
"FollowAccountWarning": "चेतावनी: यह खाता आपको ब्लॉक कर सकता है"
"FollowAccountWarning": "चेतावनी: यह खाता आपको ब्लॉक कर सकता है",
"Nicknames of memorial accounts (one per line)": "स्मारक खातों के उपनाम (प्रति पंक्ति एक)",
"Memorials": "इतिवृत्त"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Blocca istanze militari",
"Display on your public profile": "Visualizza sul tuo profilo pubblico",
"FollowWarning": "ATTENZIONE: questa istanza potrebbe bloccarti",
"FollowAccountWarning": "ATTENZIONE: questo account potrebbe bloccarti"
"FollowAccountWarning": "ATTENZIONE: questo account potrebbe bloccarti",
"Nicknames of memorial accounts (one per line)": "Soprannomi degli account commemorativi (uno per riga)",
"Memorials": "Memoriali"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "軍事インスタンスをブロックする",
"Display on your public profile": "公開プロフィールに表示する",
"FollowWarning": "警告: このインスタンスはあなたをブロックしている可能性があります",
"FollowAccountWarning": "警告: このアカウントはあなたをブロックしている可能性があります"
"FollowAccountWarning": "警告: このアカウントはあなたをブロックしている可能性があります",
"Nicknames of memorial accounts (one per line)": "追悼アカウントのニックネーム1行に1つ",
"Memorials": "記念碑"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "군사 인스턴스 차단",
"Display on your public profile": "공개 프로필에 표시",
"FollowWarning": "경고: 이 인스턴스가 귀하를 차단하고 있을 수 있습니다.",
"FollowAccountWarning": "경고: 이 계정이 귀하를 차단하고 있을 수 있습니다."
"FollowAccountWarning": "경고: 이 계정이 귀하를 차단하고 있을 수 있습니다.",
"Nicknames of memorial accounts (one per line)": "추모 계정의 닉네임(한 줄에 하나씩)",
"Memorials": "기록"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Mînakên leşkerî asteng bikin",
"Display on your public profile": "Li ser profîla xweya giştî nîşan bidin",
"FollowWarning": "HIŞYARÎ: dibe ku ev mînak we asteng bike",
"FollowAccountWarning": "HIŞYARÎ: Dibe ku ev hesab we asteng bike"
"FollowAccountWarning": "HIŞYARÎ: Dibe ku ev hesab we asteng bike",
"Nicknames of memorial accounts (one per line)": "Nasnavên hesabên bîranînê (yek ji rêzê)",
"Memorials": "Memorials"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Blokkeer militaire instanties",
"Display on your public profile": "Weergave op uw openbare profiel",
"FollowWarning": "WAARSCHUWING: deze instantie blokkeert u mogelijk",
"FollowAccountWarning": "WAARSCHUWING: dit account blokkeert u mogelijk"
"FollowAccountWarning": "WAARSCHUWING: dit account blokkeert u mogelijk",
"Nicknames of memorial accounts (one per line)": "Bijnamen van herdenkingsverslagen (één per regel)",
"Memorials": "Gedenktekens"
}

View File

@ -630,5 +630,7 @@
"Block military instances": "Block military instances",
"Display on your public profile": "Display on your public profile",
"FollowWarning": "WARNING: this instance may be blocking you",
"FollowAccountWarning": "WARNING: this account may be blocking you"
"FollowAccountWarning": "WARNING: this account may be blocking you",
"Nicknames of memorial accounts (one per line)": "Nicknames of memorial accounts (one per line)",
"Memorials": "Memorials"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Blokuj instancje wojskowe",
"Display on your public profile": "Wyświetlaj na swoim profilu publicznym",
"FollowWarning": "OSTRZEŻENIE: ta instancja może Cię blokować",
"FollowAccountWarning": "OSTRZEŻENIE: to konto może Cię blokować"
"FollowAccountWarning": "OSTRZEŻENIE: to konto może Cię blokować",
"Nicknames of memorial accounts (one per line)": "Pseudonimy kont pamięci (po jednym w wierszu)",
"Memorials": "Pamiętnik"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Bloquear instâncias militares",
"Display on your public profile": "Exibir em seu perfil público",
"FollowWarning": "AVISO: esta instância pode estar bloqueando você",
"FollowAccountWarning": "AVISO: esta conta pode estar bloqueando você"
"FollowAccountWarning": "AVISO: esta conta pode estar bloqueando você",
"Nicknames of memorial accounts (one per line)": "Apelidos de contas memoriais (um por linha)",
"Memorials": "Memoriais"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Блокировать военные инстансы",
"Display on your public profile": "Отобразить в своем общедоступном профиле",
"FollowWarning": "ВНИМАНИЕ: этот экземпляр может блокировать вас.",
"FollowAccountWarning": "ВНИМАНИЕ: этот аккаунт может вас заблокировать"
"FollowAccountWarning": "ВНИМАНИЕ: этот аккаунт может вас заблокировать",
"Nicknames of memorial accounts (one per line)": "Никнеймы мемориальных аккаунтов (по одному в строке)",
"Memorials": "Мемориалы"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Zuia matukio ya kijeshi",
"Display on your public profile": "Onyesha kwenye wasifu wako wa umma",
"FollowWarning": "ONYO: mfano huu unaweza kuwa unakuzuia",
"FollowAccountWarning": "ONYO: akaunti hii inaweza kuwa inakuzuia"
"FollowAccountWarning": "ONYO: akaunti hii inaweza kuwa inakuzuia",
"Nicknames of memorial accounts (one per line)": "Majina ya utani ya akaunti za ukumbusho (moja kwa kila mstari)",
"Memorials": "Makumbusho"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Askeri örnekleri engelle",
"Display on your public profile": "Herkese açık profilinizde görüntüleyin",
"FollowWarning": "UYARI: bu örnek sizi engelliyor olabilir",
"FollowAccountWarning": "DİKKAT: Bu hesap sizi engelliyor olabilir"
"FollowAccountWarning": "DİKKAT: Bu hesap sizi engelliyor olabilir",
"Nicknames of memorial accounts (one per line)": "Anma hesaplarının takma adları (her satıra bir tane)",
"Memorials": "Anıtlar"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "Блокувати військові інстанції",
"Display on your public profile": "Відображати у своєму публічному профілі",
"FollowWarning": "УВАГА: цей екземпляр може блокувати вас",
"FollowAccountWarning": "УВАГА: цей обліковий запис може блокувати вас"
"FollowAccountWarning": "УВАГА: цей обліковий запис може блокувати вас",
"Nicknames of memorial accounts (one per line)": "Ніки меморіалів (по одному в рядку)",
"Memorials": "Меморіали"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "פאַרשפּאַרן מיליטעריש ינסטאַנסיז",
"Display on your public profile": "ווייַז אויף דיין עפנטלעך פּראָפיל",
"FollowWarning": "ווארענונג: דעם בייַשפּיל קען פאַרשפּאַרן איר",
"FollowAccountWarning": "ווארענונג: דער חשבון קען בלאַקינג איר"
"FollowAccountWarning": "ווארענונג: דער חשבון קען בלאַקינג איר",
"Nicknames of memorial accounts (one per line)": "ניקניימז פון דענקמאָל אַקאַונץ (איינער פּער שורה)",
"Memorials": "מעמאָריאַלן"
}

View File

@ -634,5 +634,7 @@
"Block military instances": "阻止军事实例",
"Display on your public profile": "显示在您的公开个人资料上",
"FollowWarning": "警告:此实例可能会阻止您",
"FollowAccountWarning": "警告:此帐户可能会阻止您"
"FollowAccountWarning": "警告:此帐户可能会阻止您",
"Nicknames of memorial accounts (one per line)": "纪念帐户昵称(每行一个)",
"Memorials": "纪念馆"
}

View File

@ -741,6 +741,33 @@ def is_system_account(nickname: str) -> bool:
return False
def get_memorials(base_dir: str) -> str:
"""Returns the nicknames for memorial accounts
"""
memorial_file = base_dir + '/accounts/memorial'
if not os.path.isfile(memorial_file):
return ''
memorial_str = ''
try:
with open(memorial_file, 'r', encoding='utf-8') as fp_memorial:
memorial_str = fp_memorial.read()
except OSError:
print('EX: unable to read ' + memorial_file)
return memorial_str
def set_memorials(base_dir: str, memorial_str) -> None:
"""Sets the nicknames for memorial accounts
"""
memorial_file = base_dir + '/accounts/memorial'
try:
with open(memorial_file, 'w+', encoding='utf-8') as fp_memorial:
fp_memorial.write(memorial_str)
except OSError:
print('EX: unable to write ' + memorial_file)
def is_memorial_account(base_dir: str, nickname: str) -> bool:
"""Returns true if the given nickname is a memorial account
"""

View File

@ -10,6 +10,7 @@ __module_group__ = "Web Interface"
import os
from pprint import pprint
from webfinger import webfinger_handle
from utils import get_memorials
from utils import text_in_file
from utils import dangerous_markup
from utils import ap_proxy_type
@ -1768,7 +1769,7 @@ def _html_edit_profile_instance(base_dir: str, translate: {},
media_instance_str: str,
blogs_instance_str: str,
news_instance_str: str) -> (str, str,
str, str):
str, str, str):
"""Edit profile instance settings
"""
image_formats = get_image_formats()
@ -1967,8 +1968,11 @@ def _html_edit_profile_instance(base_dir: str, translate: {},
libretranslate_str = \
_html_edit_profile_libre_translate(libretranslate_url,
libretranslate_api_key)
memorial_str = \
_html_edit_profile_memorial(base_dir, translate)
return instance_str, role_assign_str, peertube_str, libretranslate_str
return instance_str, role_assign_str, peertube_str, \
libretranslate_str, memorial_str
def _html_edit_profile_danger_zone(translate: {}) -> str:
@ -2369,6 +2373,22 @@ def _html_edit_profile_libre_translate(libretranslate_url: str,
return edit_profile_form
def _html_edit_profile_memorial(base_dir: str, translate: {}) -> str:
"""Change memorial accounts
"""
memorial_accounts_str = get_memorials(base_dir)
edit_profile_form = begin_edit_section(translate['Memorials'])
title_str = \
translate['Nicknames of memorial accounts (one per line)']
edit_text_area(title_str, None, 'memorialAccounts', memorial_accounts_str,
200, '', True)
edit_profile_form += end_edit_section()
return edit_profile_form
def _html_edit_profile_background(news_instance: bool, translate: {}) -> str:
"""Background images section of edit profile screen
"""
@ -2897,6 +2917,7 @@ def html_edit_profile(server, translate: {},
role_assign_str = ''
peertube_str = ''
libretranslate_str = ''
memorial_str = ''
system_monitor_str = ''
graphics_str = ''
shares_federation_str = ''
@ -2916,7 +2937,8 @@ def html_edit_profile(server, translate: {},
# shared items section
shares_federation_str = \
_html_edit_profile_shared_items(base_dir, translate)
instance_str, role_assign_str, peertube_str, libretranslate_str = \
(instance_str, role_assign_str, peertube_str,
libretranslate_str, memorial_str) = \
_html_edit_profile_instance(base_dir, translate,
peertube_instances,
media_instance_str,
@ -3025,6 +3047,9 @@ def html_edit_profile(server, translate: {},
# automatic translations
edit_profile_form += libretranslate_str
# memorial accounts
edit_profile_form += memorial_str
# system monitor
edit_profile_form += system_monitor_str