Allow gemini style links

merge-requests/30/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: if '#' not in lineStr:
if '*' not in lineStr: if '*' not in lineStr:
continue if not lineStr.startswith('=> '):
continue
lineStr = lineStr.strip() lineStr = lineStr.strip()
words = lineStr.split(' ') words = lineStr.split(' ')
# get the link # get the link
@ -186,6 +187,8 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
continue continue
if word == '*': if word == '*':
continue continue
if word == '=>':
continue
if '://' in word: if '://' in word:
linkStr = word linkStr = word
break break
@ -203,6 +206,17 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
'rel="nofollow noopener noreferrer">' + \ 'rel="nofollow noopener noreferrer">' + \
lineStr + '</a></p>\n' lineStr + '</a></p>\n'
linksFileContainsEntries = True 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: else:
if lineStr.startswith('#') or lineStr.startswith('*'): if lineStr.startswith('#') or lineStr.startswith('*'):
lineStr = lineStr[1:].strip() 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 # If this is the inbox timeline then don't show the repeat icon on any DMs
showRepeatIcon = showRepeats showRepeatIcon = showRepeats
isPublicRepeat = False isPublicRepeat = False
showDMicon = False
postIsDM = isDM(postJsonObject) postIsDM = isDM(postJsonObject)
if showRepeats: if showRepeats:
if postIsDM: if postIsDM:
showDMicon = True
showRepeatIcon = False showRepeatIcon = False
else: else:
if not isPublicPost(postJsonObject): if not isPublicPost(postJsonObject):