Allow gemini style links

merge-requests/21/head
Bob Mottram 2021-02-24 14:31:04 +00:00
parent 91c900a6d6
commit e75e35fc22
2 changed files with 15 additions and 3 deletions

View File

@ -176,7 +176,8 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
if ' ' not in lineStr:
if '#' not in lineStr:
if '*' not in lineStr:
continue
if not lineStr.startswith('=> '):
continue
lineStr = lineStr.strip()
words = lineStr.split(' ')
# get the link
@ -186,6 +187,8 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
continue
if word == '*':
continue
if word == '=>':
continue
if '://' in word:
linkStr = word
break
@ -203,6 +206,17 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
'rel="nofollow noopener noreferrer">' + \
lineStr + '</a></p>\n'
linksFileContainsEntries = True
elif lineStr.startswith('=> '):
# gemini style link
lineStr = lineStr.replace('=> ', '')
lineStr = lineStr.replace(linkStr, '')
# add link to the returned html
htmlStr += \
' <p><a href="' + linkStr + \
'" target="_blank" ' + \
'rel="nofollow noopener noreferrer">' + \
lineStr.strip() + '</a></p>\n'
linksFileContainsEntries = True
else:
if lineStr.startswith('#') or lineStr.startswith('*'):
lineStr = lineStr[1:].strip()

View File

@ -1269,11 +1269,9 @@ def individualPostAsHtml(allowDownloads: bool,
# If this is the inbox timeline then don't show the repeat icon on any DMs
showRepeatIcon = showRepeats
isPublicRepeat = False
showDMicon = False
postIsDM = isDM(postJsonObject)
if showRepeats:
if postIsDM:
showDMicon = True
showRepeatIcon = False
else:
if not isPublicPost(postJsonObject):