fds
This commit is contained in:
parent
e9a547fc18
commit
79c13530d2
3 changed files with 6 additions and 3 deletions
|
@ -7,10 +7,13 @@ SITE = environ.get("DOMAIN", '').strip()
|
|||
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
||||
if SITE == "localhost": SITE_FULL = 'http://' + SITE
|
||||
else: SITE_FULL = 'https://' + SITE
|
||||
|
||||
SITE_FULL2 = 'http://' + SITE
|
||||
|
||||
if SITE == 'pcmemes.net': CC = "SPLASH MOUNTAIN"
|
||||
else: CC = "COUNTRY CLUB"
|
||||
CC_TITLE = CC.title()
|
||||
|
||||
|
||||
AJ_REPLACEMENTS = {
|
||||
' your ': " you're ",
|
||||
' to ': " too ",
|
||||
|
|
|
@ -164,7 +164,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
|
||||
for tag in soup.find_all("a"):
|
||||
if tag.get("href"):
|
||||
if not tag["href"].startswith(SITE_FULL) and not tag["href"].startswith('/'):
|
||||
if not tag["href"].startswith(SITE_FULL) and not tag["href"].startswith('/') and not tag["href"].startswith(SITE_FULL2):
|
||||
tag["target"] = "_blank"
|
||||
tag["rel"] = "nofollow noopener noreferrer"
|
||||
|
||||
|
|
|
@ -1091,7 +1091,7 @@ def submit_post(v):
|
|||
body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n\n"
|
||||
gevent.spawn(archiveorg, newposturl)
|
||||
|
||||
url_regex = '<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">(.+)<\/a>'
|
||||
url_regex = '<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">(.*?)<\/a>'
|
||||
for url_match in re.finditer(url_regex, new_post.body_html):
|
||||
href = url_match.group(1)
|
||||
if not href: continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue