merge-requests/20/merge
Bob Mottram 2021-07-03 21:15:34 +01:00
parent 500e72f064
commit 9194d95b17
2 changed files with 19 additions and 32 deletions

View File

@ -111,18 +111,12 @@ def manualApproveFollowRequest(session, baseDir: str,
reqNick = approveHandle.split('@')[0]
reqDomain = approveHandle.split('@')[1].strip()
reqPrefix = httpPrefix + '://' + reqDomain
if reqPrefix + '/profile/' + reqNick in approveFollowsStr:
exists = True
approveHandleFull = reqPrefix + '/profile/' + reqNick
elif reqPrefix + '/channel/' + reqNick in approveFollowsStr:
exists = True
approveHandleFull = reqPrefix + '/channel/' + reqNick
elif reqPrefix + '/accounts/' + reqNick in approveFollowsStr:
exists = True
approveHandleFull = reqPrefix + '/accounts/' + reqNick
elif reqPrefix + '/u/' + reqNick in approveFollowsStr:
exists = True
approveHandleFull = reqPrefix + '/u/' + reqNick
paths = ('/profile/', '/channel/', '/accounts/', '/u/')
for userPath in paths:
if reqPrefix + userPath + reqNick in approveFollowsStr:
exists = True
approveHandleFull = reqPrefix + userPath + reqNick
break
if not exists:
print('Manual follow accept: ' + approveHandleFull +
' not in requests file "' +

View File

@ -140,29 +140,22 @@ def markdownToHtml(markdown: str) -> str:
linesList = markdown.split('\n')
htmlStr = ''
ctr = 0
titles = {
"h5": '#####',
"h4": '####',
"h3": '###',
"h2": '##',
"h1": '#'
}
for line in linesList:
if ctr > 0:
htmlStr += '<br>'
if line.startswith('#####'):
line = line.replace('#####', '').strip()
line = '<h5>' + line + '</h5>'
ctr = -1
elif line.startswith('####'):
line = line.replace('####', '').strip()
line = '<h4>' + line + '</h4>'
ctr = -1
elif line.startswith('###'):
line = line.replace('###', '').strip()
line = '<h3>' + line + '</h3>'
ctr = -1
elif line.startswith('##'):
line = line.replace('##', '').strip()
line = '<h2>' + line + '</h2>'
ctr = -1
elif line.startswith('#'):
line = line.replace('#', '').strip()
line = '<h1>' + line + '</h1>'
ctr = -1
for h, hashes in titles.items():
if line.startswith(hashes):
line = line.replace(hashes, '').strip()
line = '<' + h + '>' + line + '</' + h + '>'
ctr = -1
break
htmlStr += line
ctr += 1
return htmlStr