diff --git a/daemon.py b/daemon.py index 844a771fd..d72c34d61 100644 --- a/daemon.py +++ b/daemon.py @@ -4591,6 +4591,23 @@ class PubServer(BaseHTTPRequestHandler): del actorJson['movedTo'] actorChanged = True + # Other accounts (alsoKnownAs) + occupationName = "" + if actorJson.get('occupationName'): + occupationName = actorJson['occupationName'] + if fields.get('occupationName'): + fields['occupationName'] = \ + removeHtml(fields['occupationName']) + if occupationName != \ + fields['occupationName']: + actorJson['occupationName'] = \ + fields['occupationName'] + actorChanged = True + else: + if occupationName: + actorJson['occupationName'] = '' + actorChanged = True + # Other accounts (alsoKnownAs) alsoKnownAs = [] if actorJson.get('alsoKnownAs'): diff --git a/person.py b/person.py index 3d7f6d04e..389a36026 100644 --- a/person.py +++ b/person.py @@ -296,6 +296,7 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, 'tts': personId + '/speaker', 'shares': personId + '/shares', 'orgSchema': None, + 'occupation': "", 'skills': {}, 'roles': {}, 'availability': None, diff --git a/translations/ar.json b/translations/ar.json index 29042f88f..e06f1bf25 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "إظهار عدد الحسابات داخل البيانات الوصفية للمثيلات", "Show version number within instance metadata": "إظهار رقم الإصدار داخل البيانات الوصفية للمثيل", "Joined": "تاريخ الانضمام", - "City for spoofed GPS image metadata": "مدينة للبيانات الوصفية لصور GPS المخادعة" + "City for spoofed GPS image metadata": "مدينة للبيانات الوصفية لصور GPS المخادعة", + "Occupation": "الاحتلال" } diff --git a/translations/ca.json b/translations/ca.json index f16675caf..b7fbfdc6a 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -441,5 +441,6 @@ "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", "Joined": "Data d'unió", - "City for spoofed GPS image metadata": "Ciutat per a metadades d'imatges GPS falsificades" + "City for spoofed GPS image metadata": "Ciutat per a metadades d'imatges GPS falsificades", + "Occupation": "Ocupació" } diff --git a/translations/cy.json b/translations/cy.json index dde27f918..03a6dc09d 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -441,5 +441,6 @@ "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", "Joined": "Dyddiad ymuno", - "City for spoofed GPS image metadata": "Dinas ar gyfer metadata delwedd GPS spoofed" + "City for spoofed GPS image metadata": "Dinas ar gyfer metadata delwedd GPS spoofed", + "Occupation": "Ngalwedigaeth" } diff --git a/translations/de.json b/translations/de.json index e4f00a856..f193a603e 100644 --- a/translations/de.json +++ b/translations/de.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "Anzahl der Konten in Instanzmetadaten anzeigen", "Show version number within instance metadata": "Versionsnummer in Instanzmetadaten anzeigen", "Joined": "Verbundenes Datum", - "City for spoofed GPS image metadata": "Stadt für gefälschte GPS-Bildmetadaten" + "City for spoofed GPS image metadata": "Stadt für gefälschte GPS-Bildmetadaten", + "Occupation": "Besetzung" } diff --git a/translations/en.json b/translations/en.json index 387101a1e..3216f1d53 100644 --- a/translations/en.json +++ b/translations/en.json @@ -441,5 +441,6 @@ "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", "Joined": "Joined", - "City for spoofed GPS image metadata": "City for spoofed GPS image metadata" + "City for spoofed GPS image metadata": "City for spoofed GPS image metadata", + "Occupation": "Occupation" } diff --git a/translations/es.json b/translations/es.json index bded71c6b..b966a4777 100644 --- a/translations/es.json +++ b/translations/es.json @@ -441,5 +441,6 @@ "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", "Joined": "Fecha unida", - "City for spoofed GPS image metadata": "Ciudad para metadatos de imagen GPS falsificados" + "City for spoofed GPS image metadata": "Ciudad para metadatos de imagen GPS falsificados", + "Occupation": "Ocupación" } diff --git a/translations/fr.json b/translations/fr.json index 9f73c5ee2..197c319fa 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -441,5 +441,6 @@ "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", "Joined": "Joint", - "City for spoofed GPS image metadata": "Ville pour les métadonnées d'image GPS falsifiées" + "City for spoofed GPS image metadata": "Ville pour les métadonnées d'image GPS falsifiées", + "Occupation": "Occupation" } diff --git a/translations/ga.json b/translations/ga.json index be92f6613..549abadce 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -441,5 +441,6 @@ "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í", "Joined": "Dáta comhcheangailte", - "City for spoofed GPS image metadata": "Cathair le haghaidh meiteashonraí íomhá GPS spoofed" + "City for spoofed GPS image metadata": "Cathair le haghaidh meiteashonraí íomhá GPS spoofed", + "Occupation": "Slí bheatha" } diff --git a/translations/hi.json b/translations/hi.json index d2f1df28f..8d42d418c 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "उदाहरण मेटाडेटा के भीतर खातों की संख्या दिखाएं", "Show version number within instance metadata": "उदाहरण मेटाडेटा के भीतर संस्करण संख्या दिखाएं", "Joined": "दिनांक", - "City for spoofed GPS image metadata": "स्पूफ जीपीएस जीपीएस मेटाडेटा के लिए शहर" + "City for spoofed GPS image metadata": "स्पूफ जीपीएस जीपीएस मेटाडेटा के लिए शहर", + "Occupation": "व्यवसाय" } diff --git a/translations/it.json b/translations/it.json index 95f68e575..3557bbd26 100644 --- a/translations/it.json +++ b/translations/it.json @@ -441,5 +441,6 @@ "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", "Joined": "Unito", - "City for spoofed GPS image metadata": "Città per metadati di immagini GPS falsificate" + "City for spoofed GPS image metadata": "Città per metadati di immagini GPS falsificate", + "Occupation": "Occupazione" } diff --git a/translations/ja.json b/translations/ja.json index 44aa8f38c..04de4d1fd 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "インスタンスメタデータ内のアカウント数を表示する", "Show version number within instance metadata": "インスタンスメタデータ内にバージョン番号を表示する", "Joined": "参加日", - "City for spoofed GPS image metadata": "なりすましGPS画像メタデータの都市" + "City for spoofed GPS image metadata": "なりすましGPS画像メタデータの都市", + "Occupation": "職業" } diff --git a/translations/ku.json b/translations/ku.json index 3f1295df3..bb69bf5e2 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -441,5 +441,6 @@ "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", "Joined": "Beşdarbûna Dîrokê", - "City for spoofed GPS image metadata": "Bajar ji bo metadata wêneya GPS ya xapînok" + "City for spoofed GPS image metadata": "Bajar ji bo metadata wêneya GPS ya xapînok", + "Occupation": "Sinet" } diff --git a/translations/oc.json b/translations/oc.json index 47b3ca685..f9d2fe53b 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -437,5 +437,6 @@ "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", "Joined": "Joined", - "City for spoofed GPS image metadata": "City for spoofed GPS image metadata" + "City for spoofed GPS image metadata": "City for spoofed GPS image metadata", + "Occupation": "Occupation" } diff --git a/translations/pt.json b/translations/pt.json index a139c9f3d..956805c99 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -441,5 +441,6 @@ "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", "Joined": "Data juntada", - "City for spoofed GPS image metadata": "Cidade para metadados de imagem GPS falsificados" + "City for spoofed GPS image metadata": "Cidade para metadados de imagem GPS falsificados", + "Occupation": "Ocupação" } diff --git a/translations/ru.json b/translations/ru.json index 1d2b79ecc..6a29ea88b 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "Показать количество учетных записей в метаданных экземпляра", "Show version number within instance metadata": "Показать номер версии в метаданных экземпляра", "Joined": "Присоединенная дата", - "City for spoofed GPS image metadata": "Город для поддельных метаданных изображения GPS" + "City for spoofed GPS image metadata": "Город для поддельных метаданных изображения GPS", + "Occupation": "Занятие" } diff --git a/translations/zh.json b/translations/zh.json index cb3996ace..80222724e 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -441,5 +441,6 @@ "Show numbers of accounts within instance metadata": "显示实例元数据中的帐户数", "Show version number within instance metadata": "在实例元数据中显示版本号", "Joined": "加入日期", - "City for spoofed GPS image metadata": "欺骗性GPS影像元数据的城市" + "City for spoofed GPS image metadata": "欺骗性GPS影像元数据的城市", + "Occupation": "职业" } diff --git a/webapp_profile.py b/webapp_profile.py index e02201a46..e5b569978 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -45,6 +45,7 @@ from webapp_utils import htmlHideFromScreenReader from webapp_utils import scheduledPostsExist from webapp_utils import getPersonAvatarUrl from webapp_utils import htmlHeaderWithExternalStyle +from webapp_utils import htmlHeaderWithPersonMarkup from webapp_utils import htmlFooter from webapp_utils import addEmojiToDisplayName from webapp_utils import getBannerFile @@ -342,7 +343,8 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, alsoKnownAs: [], pinnedContent: str, accessKeys: {}, - joinedDate: str) -> str: + joinedDate: str, + occupationName: str) -> str: """The header of the profile screen, containing background image and avatar """ @@ -361,7 +363,14 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, translate['Switch to timeline view'] + '">\n' + \ ' \n' - htmlStr += '

' + displayName + '

\n' + + occupationStr = '' + if occupationName: + occupationStr += \ + ' ' + occupationName + '
\n' + + htmlStr += '

' + displayName + '

\n' + occupationStr + htmlStr += \ '

@' + nickname + '@' + domainFull + '
\n' if joinedDate: @@ -730,6 +739,9 @@ def htmlProfile(rssIconAtTop: bool, if profileJson.get('published'): if 'T' in profileJson['published']: joinedDate = profileJson['published'] + occupationName = None + if profileJson.get('occupationName'): + occupationName = profileJson['occupationName'] avatarUrl = profileJson['icon']['url'] @@ -751,7 +763,7 @@ def htmlProfile(rssIconAtTop: bool, loginButton, avatarUrl, theme, movedTo, alsoKnownAs, pinnedContent, accessKeys, - joinedDate) + joinedDate, occupationName) # keyboard navigation userPathStr = '/users/' + nickname @@ -888,7 +900,7 @@ def htmlProfile(rssIconAtTop: bool, instanceTitle = \ getConfigParam(baseDir, 'instanceTitle') profileStr = \ - htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \ + htmlHeaderWithPersonMarkup(cssFilename, instanceTitle, profileJson) + \ profileStr + htmlFooter() return profileStr @@ -1588,6 +1600,16 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, ' \n' + occupationName = '' + if actorJson.get('occupationName'): + occupationName = actorJson['occupationName'] + + editProfileForm += '
\n' + editProfileForm += \ + ' \n' + alsoKnownAsStr = '' if actorJson.get('alsoKnownAs'): alsoKnownAs = actorJson['alsoKnownAs'] diff --git a/webapp_utils.py b/webapp_utils.py index 6a9666a77..65c68b87f 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -710,6 +710,51 @@ def htmlHeaderWithExternalStyle(cssFilename: str, instanceTitle: str, return htmlStr +def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, + actorJson: {}, lang='en') -> str: + """html header which includes person markup + https://schema.org/Person + """ + htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, lang) + if not actorJson: + return htmlStr + + skillsMarkup = '' + if actorJson.get('skills'): + skillsStr = '' + for skillName, skillValue in actorJson['skills'].items(): + if skillsStr: + skillsStr += ', ' + skillName + else: + skillsStr += skillName + if skillsStr: + occupationStr = '' + if actorJson.get('occupationName'): + occupationName = actorJson['occupationName'] + occupationStr = ' "name": "' + occupationName + '",\n' + skillsMarkup = \ + ' "hasOccupation": {\n' + \ + ' "@type": "Occupation",\n' + \ + occupationStr + \ + ' "skills": "' + skillsStr + '"\n' + \ + ' "},\n' + + personMarkup = \ + ' \n' + htmlStr = htmlStr.replace('\n', '\n' + personMarkup) + return htmlStr + + def htmlFooter() -> str: htmlStr = ' \n' htmlStr += '\n'