diff --git a/person.py b/person.py index d56c0fd5f..a72ca31d7 100644 --- a/person.py +++ b/person.py @@ -35,6 +35,7 @@ from auth import storeBasicCredentials from auth import removePassword from roles import setRole from media import removeMetaData +from utils import getStatusNumber from utils import getFullDomain from utils import validNickname from utils import loadJson @@ -272,12 +273,14 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, personId + '/avatar' + \ str(randint(10000000000000, 99999999999999)) + '.png' # nosec + statusNumber, published = getStatusNumber() newPerson = { '@context': [ 'https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1', getDefaultPersonContext() ], + 'published': published, 'alsoKnownAs': [], 'attachment': [], 'devices': personId + '/collections/devices', @@ -563,11 +566,17 @@ def personUpgradeActor(baseDir: str, personJson: {}, if not personJson: personJson = loadJson(filename) - if updateActor: - # add a speaker endpoint - if not personJson.get('tts'): - personJson['tts'] = personJson['id'] + '/speaker' + # add a speaker endpoint + if not personJson.get('tts'): + personJson['tts'] = personJson['id'] + '/speaker' + updateActor = True + if not personJson.get('published'): + statusNumber, published = getStatusNumber() + personJson['published'] = published + updateActor = True + + if updateActor: saveJson(personJson, filename) # also update the actor within the cache diff --git a/translations/ar.json b/translations/ar.json index a8ae3f47f..a16ebaa19 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -439,5 +439,6 @@ "enterNotes": "أدخل الملاحظات", "These access keys may be used": "قد يتم استخدام مفاتيح الوصول هذه، عادة مع مفتاح ALT + SHIFT + مفتاح ALT +", "Show numbers of accounts within instance metadata": "إظهار عدد الحسابات داخل البيانات الوصفية للمثيلات", - "Show version number within instance metadata": "إظهار رقم الإصدار داخل البيانات الوصفية للمثيل" + "Show version number within instance metadata": "إظهار رقم الإصدار داخل البيانات الوصفية للمثيل", + "Joined": "تاريخ الانضمام" } diff --git a/translations/ca.json b/translations/ca.json index 6e8db45ac..a1739b8f8 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -439,5 +439,6 @@ "enterNotes": "Introduïu notes", "These access keys may be used": "Es poden utilitzar aquestes tecles d'accés, típicament amb Alt + Maj + tecla o Alt + clau", "Show numbers of accounts within instance metadata": "Mostra el nombre de comptes a les metadades de la instància", - "Show version number within instance metadata": "Mostra el número de versió a les metadades de la instància" + "Show version number within instance metadata": "Mostra el número de versió a les metadades de la instància", + "Joined": "Data d'unió" } diff --git a/translations/cy.json b/translations/cy.json index 012710f78..06f365df7 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -439,5 +439,6 @@ "enterNotes": "Rhowch nodiadau", "These access keys may be used": "Gellir defnyddio'r allweddi mynediad hyn, fel arfer gyda ALT + Shift + Allwedd Allwedd neu ALT +", "Show numbers of accounts within instance metadata": "Dangos nifer y cyfrifon o fewn metadata", - "Show version number within instance metadata": "Dangos rhif y fersiwn o fewn metadata" + "Show version number within instance metadata": "Dangos rhif y fersiwn o fewn metadata", + "Joined": "Dyddiad ymuno" } diff --git a/translations/de.json b/translations/de.json index 2ebf7d035..87a610034 100644 --- a/translations/de.json +++ b/translations/de.json @@ -439,5 +439,6 @@ "enterNotes": "Notizen eingeben", "These access keys may be used": "Diese Zugriffstasten können verwendet werden, typischerweise mit ALT + SHIFT + -Taste oder ALT + -Taste", "Show numbers of accounts within instance metadata": "Anzahl der Konten in Instanzmetadaten anzeigen", - "Show version number within instance metadata": "Versionsnummer in Instanzmetadaten anzeigen" + "Show version number within instance metadata": "Versionsnummer in Instanzmetadaten anzeigen", + "Joined": "Verbundenes Datum" } diff --git a/translations/en.json b/translations/en.json index c8a29aed5..93c245167 100644 --- a/translations/en.json +++ b/translations/en.json @@ -439,5 +439,6 @@ "enterNotes": "Enter notes", "These access keys may be used": "These access keys may be used, typically with ALT + SHIFT + key or ALT + key", "Show numbers of accounts within instance metadata": "Show numbers of accounts within instance metadata", - "Show version number within instance metadata": "Show version number within instance metadata" + "Show version number within instance metadata": "Show version number within instance metadata", + "Joined": "Joined" } diff --git a/translations/es.json b/translations/es.json index cdd5b698f..15849bc83 100644 --- a/translations/es.json +++ b/translations/es.json @@ -439,5 +439,6 @@ "enterNotes": "Ingresar notas", "These access keys may be used": "Se pueden usar estas teclas de acceso, típicamente con teclas ALT + MAYÚS + teclas o ALT +", "Show numbers of accounts within instance metadata": "Muestra el número de cuentas dentro de los metadatos de la instancia.", - "Show version number within instance metadata": "Mostrar el número de versión dentro de los metadatos de la instancia" + "Show version number within instance metadata": "Mostrar el número de versión dentro de los metadatos de la instancia", + "Joined": "Fecha unida" } diff --git a/translations/fr.json b/translations/fr.json index ad8f62cbf..6f8d9e7e5 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -439,5 +439,6 @@ "enterNotes": "Faire entrer des notes", "These access keys may be used": "Ces touches d'accès peuvent être utilisées typiquement avec une touche Alt + Maj + ou Alt +", "Show numbers of accounts within instance metadata": "Afficher le nombre de comptes dans les métadonnées de l'instance", - "Show version number within instance metadata": "Afficher le numéro de version dans les métadonnées de l'instance" + "Show version number within instance metadata": "Afficher le numéro de version dans les métadonnées de l'instance", + "Joined": "Joint" } diff --git a/translations/ga.json b/translations/ga.json index ebb6d18d4..2473e9712 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -439,5 +439,6 @@ "enterNotes": "Cuir nótaí isteach", "These access keys may be used": "Is féidir na heochracha rochtana seo a úsáid, de ghnáth le Alt + Shift + Eochair nó Alt + Eochair", "Show numbers of accounts within instance metadata": "Taispeáin líon na gcuntas laistigh de mheiteashonraí", - "Show version number within instance metadata": "Taispeáin uimhir an leagain laistigh de mheiteashonraí" + "Show version number within instance metadata": "Taispeáin uimhir an leagain laistigh de mheiteashonraí", + "Joined": "Dáta comhcheangailte" } diff --git a/translations/hi.json b/translations/hi.json index 9861f5b43..520c9ce47 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -439,5 +439,6 @@ "enterNotes": "नोट्स दर्ज करें", "These access keys may be used": "इन एक्सेस कुंजियों का उपयोग किया जा सकता है, आमतौर पर Alt + Shift + कुंजी या Alt + कुंजी के साथ", "Show numbers of accounts within instance metadata": "उदाहरण मेटाडेटा के भीतर खातों की संख्या दिखाएं", - "Show version number within instance metadata": "उदाहरण मेटाडेटा के भीतर संस्करण संख्या दिखाएं" + "Show version number within instance metadata": "उदाहरण मेटाडेटा के भीतर संस्करण संख्या दिखाएं", + "Joined": "दिनांक" } diff --git a/translations/it.json b/translations/it.json index be937bc46..0473de4f0 100644 --- a/translations/it.json +++ b/translations/it.json @@ -439,5 +439,6 @@ "enterNotes": "Inserisci le note", "These access keys may be used": "Questi tasti di accesso possono essere utilizzati, in genere con tasto ALT + MAIUSC + o ALT + Key", "Show numbers of accounts within instance metadata": "Mostra il numero di account all'interno dei metadati dell'istanza", - "Show version number within instance metadata": "Mostra il numero di versione nei metadati dell'istanza" + "Show version number within instance metadata": "Mostra il numero di versione nei metadati dell'istanza", + "Joined": "Unito" } diff --git a/translations/ja.json b/translations/ja.json index eca6ac0b0..972432fe1 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -439,5 +439,6 @@ "enterNotes": "ノートを入力してください", "These access keys may be used": "これらのアクセスキーは、通常はAlt + Shift +キーまたはAlt +キーを使用して使用できます。", "Show numbers of accounts within instance metadata": "インスタンスメタデータ内のアカウント数を表示する", - "Show version number within instance metadata": "インスタンスメタデータ内にバージョン番号を表示する" + "Show version number within instance metadata": "インスタンスメタデータ内にバージョン番号を表示する", + "Joined": "参加日" } diff --git a/translations/ku.json b/translations/ku.json index a25fbbc43..452a3ea93 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -439,5 +439,6 @@ "enterNotes": "Nîşan binivîse", "These access keys may be used": "Dibe ku ev keysên gihîştinê bikar bînin, bi gelemperî bi alt + shift + key an alt + key", "Show numbers of accounts within instance metadata": "Di nav metadata mînakê de hejmarên hesaban nîşan bidin", - "Show version number within instance metadata": "Di nav metadata mînakê de nimreya guhertoyê nîşan bide" + "Show version number within instance metadata": "Di nav metadata mînakê de nimreya guhertoyê nîşan bide", + "Joined": "Beşdarbûna Dîrokê" } diff --git a/translations/oc.json b/translations/oc.json index 03e52d742..40ca10e0a 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -435,5 +435,6 @@ "enterNotes": "Enter notes", "These access keys may be used": "These access keys may be used, typically with ALT + SHIFT + key or ALT + key", "Show numbers of accounts within instance metadata": "Show numbers of accounts within instance metadata", - "Show version number within instance metadata": "Show version number within instance metadata" + "Show version number within instance metadata": "Show version number within instance metadata", + "Joined": "Joined" } diff --git a/translations/pt.json b/translations/pt.json index 4b2135f08..28d1a7f06 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -439,5 +439,6 @@ "enterNotes": "Digite notas", "These access keys may be used": "Essas teclas de acesso podem ser usadas, normalmente com tecla Alt + Shift + Key ou Alt +", "Show numbers of accounts within instance metadata": "Mostra o número de contas nos metadados da instância", - "Show version number within instance metadata": "Mostrar o número da versão nos metadados da instância" + "Show version number within instance metadata": "Mostrar o número da versão nos metadados da instância", + "Joined": "Data juntada" } diff --git a/translations/ru.json b/translations/ru.json index 0fa03d6ad..55857de58 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -439,5 +439,6 @@ "enterNotes": "Введите ноты", "These access keys may be used": "Эти ключевые ключи доступа могут быть использованы, обычно с ALT + Shift + Key или Alt + Key", "Show numbers of accounts within instance metadata": "Показать количество учетных записей в метаданных экземпляра", - "Show version number within instance metadata": "Показать номер версии в метаданных экземпляра" + "Show version number within instance metadata": "Показать номер версии в метаданных экземпляра", + "Joined": "Присоединенная дата" } diff --git a/translations/zh.json b/translations/zh.json index 06eaa96ca..c2492f167 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -439,5 +439,6 @@ "enterNotes": "输入笔记", "These access keys may be used": "可以使用这些访问密钥,通常使用Alt + Shift +键或ALT +键", "Show numbers of accounts within instance metadata": "显示实例元数据中的帐户数", - "Show version number within instance metadata": "在实例元数据中显示版本号" + "Show version number within instance metadata": "在实例元数据中显示版本号", + "Joined": "加入日期" } diff --git a/webapp_profile.py b/webapp_profile.py index 59115eab9..8b1ef701d 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -246,6 +246,11 @@ def htmlProfileAfterSearch(cssCache: {}, if profileJson.get('alsoKnownAs'): alsoKnownAs = profileJson['alsoKnownAs'] + joinedDate = None + if profileJson.get('published'): + if 'T' in profileJson['published']: + joinedDate = profileJson['published'] + profileStr = \ _getProfileHeaderAfterSearch(baseDir, nickname, defaultTimeline, @@ -256,7 +261,8 @@ def htmlProfileAfterSearch(cssCache: {}, profileDescriptionShort, avatarUrl, imageUrl, movedTo, profileJson['id'], - alsoKnownAs, accessKeys) + alsoKnownAs, accessKeys, + joinedDate) domainFull = getFullDomain(domain, port) @@ -335,7 +341,8 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, theme: str, movedTo: str, alsoKnownAs: [], pinnedContent: str, - accessKeys: {}) -> str: + accessKeys: {}, + joinedDate: str) -> str: """The header of the profile screen, containing background image and avatar """ @@ -357,6 +364,10 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, htmlStr += '
@' + nickname + '@' + domainFull + '
\n'
+ if joinedDate:
+ htmlStr += \
+ '
' + translate['Joined'] + ' ' + \
+ joinedDate.split('T')[0] + '
\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
@@ -417,7 +428,8 @@ def _getProfileHeaderAfterSearch(baseDir: str,
avatarUrl: str, imageUrl: str,
movedTo: str, actor: str,
alsoKnownAs: [],
- accessKeys: {}) -> str:
+ accessKeys: {},
+ joinedDate: str) -> str:
"""The header of a searched for handle, containing background
image and avatar
"""
@@ -440,6 +452,9 @@ def _getProfileHeaderAfterSearch(baseDir: str,
htmlStr += '
@' + searchNickname + '@' + searchDomainFull + '
\n'
+ if joinedDate:
+ htmlStr += '
' + translate['Joined'] + ' ' + \ + joinedDate.split('T')[0] + '
\n' if followsYou: htmlStr += '' + translate['Follows you'] + '
\n' if movedTo: @@ -711,6 +726,11 @@ def htmlProfile(rssIconAtTop: bool, if profileJson.get('alsoKnownAs'): alsoKnownAs = profileJson['alsoKnownAs'] + joinedDate = None + if profileJson.get('published'): + if 'T' in profileJson['published']: + joinedDate = profileJson['published'] + avatarUrl = profileJson['icon']['url'] # get pinned post content @@ -730,7 +750,8 @@ def htmlProfile(rssIconAtTop: bool, profileDescriptionShort, loginButton, avatarUrl, theme, movedTo, alsoKnownAs, - pinnedContent, accessKeys) + pinnedContent, accessKeys, + joinedDate) # keyboard navigation userPathStr = '/users/' + nickname