diff --git a/petnames.py b/petnames.py index 0ae03f87..3888f5bb 100644 --- a/petnames.py +++ b/petnames.py @@ -59,14 +59,14 @@ def getPetName(baseDir: str, nickname: str, domain: str, """Given a handle returns the petname """ if '@' not in handle: - return None + return '' if handle.startswith('@'): handle = handle[1:] petnamesFilename = baseDir + '/accounts/' + \ nickname + '@' + domain + '/petnames.txt' if not os.path.isfile(petnamesFilename): - return None + return '' with open(petnamesFilename, 'r') as petnamesFile: petnamesStr = petnamesFile.read() if ' ' + handle + '\n' in petnamesStr: @@ -74,4 +74,4 @@ def getPetName(baseDir: str, nickname: str, domain: str, for pet in petnamesList: if pet.endswith(' ' + handle): return pet.replace(' ' + handle, '').strip() - return None + return '' diff --git a/translations/ar.json b/translations/ar.json index 08f24c7a..96fd7166 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "ملاحظة مجدولة لنفسك", "Replying to": "الرد على", "Send to": "ارسل إلى", - "Show a list of addresses to send to": "عرض قائمة بالعناوين التي تريد الإرسال إليها" + "Show a list of addresses to send to": "عرض قائمة بالعناوين التي تريد الإرسال إليها", + "Petname": "Petname" } diff --git a/translations/ca.json b/translations/ca.json index 79c70b2a..f1e15162 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nota programada a tu mateix", "Replying to": "Responent a", "Send to": "Envia a", - "Show a list of addresses to send to": "Mostra una llista d’adreces a les quals enviar-la" + "Show a list of addresses to send to": "Mostra una llista d’adreces a les quals enviar-la", + "Petname": "Nom de mascota" } diff --git a/translations/cy.json b/translations/cy.json index 4f6f79c6..047d14c4 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nodyn wedi'i drefnu i chi'ch hun", "Replying to": "Ymateb i", "Send to": "Anfon i", - "Show a list of addresses to send to": "Dangoswch restr o gyfeiriadau i anfon atynt" + "Show a list of addresses to send to": "Dangoswch restr o gyfeiriadau i anfon atynt", + "Petname": "Enw anwes" } diff --git a/translations/de.json b/translations/de.json index 4e7c8f3e..d0e9b63d 100644 --- a/translations/de.json +++ b/translations/de.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Geplante Notiz an dich", "Replying to": "Antworten auf", "Send to": "Senden an", - "Show a list of addresses to send to": "Zeigen Sie eine Liste der Adressen an, an die gesendet werden soll" + "Show a list of addresses to send to": "Zeigen Sie eine Liste der Adressen an, an die gesendet werden soll", + "Petname": "Haustiername" } diff --git a/translations/en.json b/translations/en.json index b82e5217..f7e7d3f5 100644 --- a/translations/en.json +++ b/translations/en.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Scheduled note to yourself", "Replying to": "Replying to", "Send to": "Send to", - "Show a list of addresses to send to": "Show a list of addresses to send to" + "Show a list of addresses to send to": "Show a list of addresses to send to", + "Petname": "Petname" } diff --git a/translations/es.json b/translations/es.json index 269e313a..5a458d34 100644 --- a/translations/es.json +++ b/translations/es.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nota programada para ti", "Replying to": "Respondiendo a", "Send to": "Enviar a", - "Show a list of addresses to send to": "Mostrar una lista de direcciones para enviar" + "Show a list of addresses to send to": "Mostrar una lista de direcciones para enviar", + "Petname": "Nombre de mascota" } diff --git a/translations/fr.json b/translations/fr.json index a358990d..eb9b8c96 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Note programmée pour vous", "Replying to": "Répondre à", "Send to": "Envoyer à", - "Show a list of addresses to send to": "Afficher une liste d'adresses à envoyer" + "Show a list of addresses to send to": "Afficher une liste d'adresses à envoyer", + "Petname": "Nom d'animal domestique" } diff --git a/translations/ga.json b/translations/ga.json index 6cfb9f22..19b329c4 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nóta sceidealta duit féin", "Replying to": "Ag freagairt do", "Send to": "Sheoladh chuig", - "Show a list of addresses to send to": "Taispeáin liosta seoltaí le seoladh chucu" + "Show a list of addresses to send to": "Taispeáin liosta seoltaí le seoladh chucu", + "Petname": "Ainmainm" } diff --git a/translations/hi.json b/translations/hi.json index 1a6b7e9a..e4fa4375 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "खुद को निर्धारित नोट", "Replying to": "को जवाब दे रहा है", "Send to": "भेजना", - "Show a list of addresses to send to": "भेजने के लिए पते की एक सूची दिखाएं" + "Show a list of addresses to send to": "भेजने के लिए पते की एक सूची दिखाएं", + "Petname": "अल्पार्थक नाम" } diff --git a/translations/it.json b/translations/it.json index 2c78ad20..55e3f94b 100644 --- a/translations/it.json +++ b/translations/it.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nota programmata per te", "Replying to": "In risposta a", "Send to": "Inviare a", - "Show a list of addresses to send to": "Mostra un elenco di indirizzi a cui inviare" + "Show a list of addresses to send to": "Mostra un elenco di indirizzi a cui inviare", + "Petname": "Nome del cucciolo" } diff --git a/translations/ja.json b/translations/ja.json index 0cd23646..d1b3ec73 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "自分への予定されたメモ", "Replying to": "に返信しています", "Send to": "に送る", - "Show a list of addresses to send to": "送信するアドレスのリストを表示する" + "Show a list of addresses to send to": "送信するアドレスのリストを表示する", + "Petname": "ペットネーム" } diff --git a/translations/oc.json b/translations/oc.json index d5fdd98b..5888fe2f 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -233,5 +233,6 @@ "Scheduled note to yourself": "Scheduled note to yourself", "Replying to": "Replying to", "Send to": "Send to", - "Show a list of addresses to send to": "Show a list of addresses to send to" + "Show a list of addresses to send to": "Show a list of addresses to send to", + "Petname": "Petname" } diff --git a/translations/pt.json b/translations/pt.json index 4791a5bb..1d744bcf 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Nota agendada para si mesmo", "Replying to": "Respondendo a", "Send to": "Enviar para", - "Show a list of addresses to send to": "Mostrar uma lista de endereços para enviar para" + "Show a list of addresses to send to": "Mostrar uma lista de endereços para enviar para", + "Petname": "Nome do animal de estimação" } diff --git a/translations/ru.json b/translations/ru.json index 132c5a1a..76def9c2 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -237,5 +237,6 @@ "Scheduled note to yourself": "Запланированная заметка для себя", "Replying to": "Отвечать на", "Send to": "Отправить", - "Show a list of addresses to send to": "Показать список адресов для отправки" + "Show a list of addresses to send to": "Показать список адресов для отправки", + "Petname": "Имя питомца" } diff --git a/translations/zh.json b/translations/zh.json index c4078959..92517106 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -236,5 +236,6 @@ "Scheduled note to yourself": "预定给自己的笔记", "Replying to": "回覆", "Send to": "发给", - "Show a list of addresses to send to": "显示要发送到的地址列表" + "Show a list of addresses to send to": "显示要发送到的地址列表", + "Petname": "宠物名" } diff --git a/webinterface.py b/webinterface.py index 8c545ede..b6cf6b61 100644 --- a/webinterface.py +++ b/webinterface.py @@ -73,6 +73,7 @@ from happening import getCalendarEvents from happening import getTodaysEvents from git import isGitPatch from theme import getThemesList +from petnames import getPetName def getContentWarningButton(postID: str, translate: {}, @@ -5312,6 +5313,10 @@ def htmlPersonOptions(translate: {}, baseDir: str, """Show options for a person: view/follow/block/report """ optionsDomain, optionsPort = getDomainFromActor(optionsActor) + optionsDomainFull = optionsDomain + if optionsPort: + if optionsPort != 80 and optionsPort != 443: + optionsDomainFull = optionsDomain + ':' + str(optionsPort) if os.path.isfile(baseDir + '/img/options-background.png'): if not os.path.isfile(baseDir + '/accounts/options-background.png'): @@ -5321,6 +5326,7 @@ def htmlPersonOptions(translate: {}, baseDir: str, followStr = 'Follow' blockStr = 'Block' nickname = None + optionsNickname = None if originPathStr.startswith('/users/'): nickname = originPathStr.split('/users/')[1] if '/' in nickname: @@ -5408,6 +5414,13 @@ def htmlPersonOptions(translate: {}, baseDir: str, optionsActor + '">' optionsStr += ' ' + if optionsNickname: + handle = optionsNickname + '@' + optionsDomainFull + petname = getPetName(baseDir, nickname, domain, handle) + optionsStr += \ + '
' + translate['Petname'] + ': ' + \ + '
' optionsStr += optionsLinkStr optionsStr += \ '