mirror of https://gitlab.com/bashrc2/epicyon
Check for valid handle
parent
bb954b62c6
commit
e585424814
10
content.py
10
content.py
|
@ -198,8 +198,16 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+replaceDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+replaceDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
possibleNickname=None
|
||||||
|
possibleDomain=None
|
||||||
|
if '@' not in possibleHandle:
|
||||||
|
return False
|
||||||
possibleNickname=possibleHandle.split('@')[0]
|
possibleNickname=possibleHandle.split('@')[0]
|
||||||
|
if not possibleNickname:
|
||||||
|
return False
|
||||||
possibleDomain=possibleHandle.split('@')[1].strip('\n')
|
possibleDomain=possibleHandle.split('@')[1].strip('\n')
|
||||||
|
if not possibleDomain:
|
||||||
|
return False
|
||||||
if following:
|
if following:
|
||||||
for follow in following:
|
for follow in following:
|
||||||
if follow.replace('\n','')!=possibleHandle:
|
if follow.replace('\n','')!=possibleHandle:
|
||||||
|
@ -215,7 +223,6 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
return True
|
return True
|
||||||
# @nick@domain
|
# @nick@domain
|
||||||
if '@' in possibleHandle:
|
|
||||||
if not (possibleDomain=='localhost' or '.' in possibleDomain):
|
if not (possibleDomain=='localhost' or '.' in possibleDomain):
|
||||||
return False
|
return False
|
||||||
recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname
|
recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname
|
||||||
|
@ -228,7 +235,6 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
}
|
}
|
||||||
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
return True
|
return True
|
||||||
return False
|
|
||||||
|
|
||||||
def removeLongWords(content: str,maxWordLength: int,longWordsList: []) -> str:
|
def removeLongWords(content: str,maxWordLength: int,longWordsList: []) -> str:
|
||||||
"""Breaks up long words so that on mobile screens this doesn't disrupt the layout
|
"""Breaks up long words so that on mobile screens this doesn't disrupt the layout
|
||||||
|
|
Loading…
Reference in New Issue