mirror of https://gitlab.com/bashrc2/epicyon
Check that alternate addresses are not the same as the main address
parent
0123c52349
commit
72216b4094
|
@ -145,23 +145,30 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
translate['New account'] + \
|
||||
': <a href="' + movedTo + '">@' + newHandle + '</a></p>\n'
|
||||
elif alsoKnownAs:
|
||||
optionsStr += \
|
||||
otherAccountsHtml = \
|
||||
' <p class="optionsText">' + \
|
||||
translate['Other accounts'] + ': '
|
||||
|
||||
ctr = 0
|
||||
if isinstance(alsoKnownAs, list):
|
||||
ctr = 0
|
||||
for altActor in alsoKnownAs:
|
||||
if altActor == optionsActor:
|
||||
continue
|
||||
if ctr > 0:
|
||||
optionsStr += ' '
|
||||
otherAccountsHtml += ' '
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(altActor)
|
||||
optionsStr += \
|
||||
otherAccountsHtml += \
|
||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||
elif isinstance(alsoKnownAs, str):
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
optionsStr += '<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
optionsStr += '</p>\n'
|
||||
if alsoKnownAs != optionsActor:
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
otherAccountsHtml += \
|
||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
otherAccountsHtml += '</p>\n'
|
||||
if ctr > 0:
|
||||
optionsStr += otherAccountsHtml
|
||||
if emailAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">' + translate['Email'] + \
|
||||
|
|
|
@ -242,7 +242,8 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
displayName, followsYou,
|
||||
profileDescriptionShort,
|
||||
avatarUrl, imageUrl,
|
||||
movedTo, alsoKnownAs)
|
||||
movedTo, profileJson['id'],
|
||||
alsoKnownAs)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
||||
|
@ -303,7 +304,8 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
profileStr + htmlFooter()
|
||||
|
||||
|
||||
def _getProfileHeader(baseDir: str, nickname: str, domain: str,
|
||||
def _getProfileHeader(baseDir: str, httpPrefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, translate: {},
|
||||
defaultTimeline: str,
|
||||
displayName: str,
|
||||
|
@ -341,22 +343,30 @@ def _getProfileHeader(baseDir: str, nickname: str, domain: str,
|
|||
'<a href="' + movedTo + '">@' + \
|
||||
newNickname + '@' + newDomainFull + '</a><br>\n'
|
||||
elif alsoKnownAs:
|
||||
htmlStr += \
|
||||
otherAccountsHtml = \
|
||||
' <p>' + translate['Other accounts'] + ': '
|
||||
|
||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
||||
ctr = 0
|
||||
if isinstance(alsoKnownAs, list):
|
||||
ctr = 0
|
||||
for altActor in alsoKnownAs:
|
||||
if altActor == actor:
|
||||
continue
|
||||
if ctr > 0:
|
||||
htmlStr += ' '
|
||||
otherAccountsHtml += ' '
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(altActor)
|
||||
htmlStr += \
|
||||
otherAccountsHtml += \
|
||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||
elif isinstance(alsoKnownAs, str):
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
htmlStr += '<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
htmlStr += '</p>\n'
|
||||
if alsoKnownAs != actor:
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
otherAccountsHtml += \
|
||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
otherAccountsHtml += '</p>\n'
|
||||
if ctr > 0:
|
||||
htmlStr += otherAccountsHtml
|
||||
htmlStr += \
|
||||
' <a href="/users/' + nickname + \
|
||||
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
|
||||
|
@ -379,7 +389,7 @@ def _getProfileHeaderAfterSearch(baseDir: str,
|
|||
followsYou: bool,
|
||||
profileDescriptionShort: str,
|
||||
avatarUrl: str, imageUrl: str,
|
||||
movedTo: str,
|
||||
movedTo: str, actor: str,
|
||||
alsoKnownAs: []) -> str:
|
||||
"""The header of a searched for handle, containing background
|
||||
image and avatar
|
||||
|
@ -412,22 +422,30 @@ def _getProfileHeaderAfterSearch(baseDir: str,
|
|||
htmlStr += ' <p>' + translate['New account'] + \
|
||||
': < a href="' + movedTo + '">@' + newHandle + '</a></p>\n'
|
||||
elif alsoKnownAs:
|
||||
htmlStr += \
|
||||
otherAccountshtml = \
|
||||
' <p>' + translate['Other accounts'] + ': '
|
||||
|
||||
ctr = 0
|
||||
if isinstance(alsoKnownAs, list):
|
||||
ctr = 0
|
||||
for altActor in alsoKnownAs:
|
||||
if altActor == actor:
|
||||
continue
|
||||
if ctr > 0:
|
||||
htmlStr += ' '
|
||||
otherAccountshtml += ' '
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(altActor)
|
||||
htmlStr += \
|
||||
otherAccountshtml += \
|
||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||
elif isinstance(alsoKnownAs, str):
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
htmlStr += '<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
htmlStr += '</p>\n'
|
||||
if alsoKnownAs != actor:
|
||||
ctr += 1
|
||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
||||
otherAccountshtml += \
|
||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||
|
||||
otherAccountshtml += '</p>\n'
|
||||
if ctr > 0:
|
||||
htmlStr += otherAccountshtml
|
||||
|
||||
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
|
||||
htmlStr += ' </figcaption>\n'
|
||||
|
@ -662,7 +680,8 @@ def htmlProfile(rssIconAtTop: bool,
|
|||
|
||||
avatarUrl = profileJson['icon']['url']
|
||||
profileHeaderStr = \
|
||||
_getProfileHeader(baseDir, nickname, domain,
|
||||
_getProfileHeader(baseDir, httpPrefix,
|
||||
nickname, domain,
|
||||
domainFull, translate,
|
||||
defaultTimeline, displayName,
|
||||
avatarDescription,
|
||||
|
|
Loading…
Reference in New Issue