Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon

main
Bob Mottram 2021-05-12 19:59:04 +01:00
commit 5aab31b0d4
20 changed files with 121 additions and 20 deletions

View File

@ -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'):

View File

@ -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,

View File

@ -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": "الاحتلال"
}

View File

@ -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ó"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "व्यवसाय"
}

View File

@ -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"
}

View File

@ -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": "職業"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "Занятие"
}

View File

@ -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": "职业"
}

View File

@ -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' + \
' <img loading="lazy" src="' + avatarUrl + '" ' + \
'alt="" class="title"></a>\n'
htmlStr += ' <h1>' + displayName + '</h1>\n'
occupationStr = ''
if occupationName:
occupationStr += \
' <b>' + occupationName + '</b><br>\n'
htmlStr += ' <h1>' + displayName + '</h1>\n' + occupationStr
htmlStr += \
' <p><b>@' + nickname + '@' + domainFull + '</b><br>\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,
' <input type="file" id="avatar" name="avatar"'
editProfileForm += ' accept="' + imageFormats + '">\n'
occupationName = ''
if actorJson.get('occupationName'):
occupationName = actorJson['occupationName']
editProfileForm += '<label class="labels">' + \
translate['Occupation'] + ':</label><br>\n'
editProfileForm += \
' <input type="text" ' + \
'name="occupationName" value="' + occupationName + '">\n'
alsoKnownAsStr = ''
if actorJson.get('alsoKnownAs'):
alsoKnownAs = actorJson['alsoKnownAs']

View File

@ -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 = \
' <script type="application/ld+json">\n' + \
' {\n' + \
' "@context" : "http://schema.org",\n' + \
' "@type" : "Person",\n' + \
' "name": "' + actorJson['name'] + '",\n' + \
' "image": "' + actorJson['icon']['url'] + '",\n' + \
' "description": "' + actorJson['summary'] + '",\n' + \
skillsMarkup + \
' "url": "' + actorJson['id'] + '"\n' + \
' }\n' + \
' </script>\n'
htmlStr = htmlStr.replace('<head>\n', '<head>\n' + personMarkup)
return htmlStr
def htmlFooter() -> str:
htmlStr = ' </body>\n'
htmlStr += '</html>\n'