Basic Email Protection

This commit is contained in:
BlenderDumbass 2024-11-25 23:53:31 +02:00
parent a4da8a4f52
commit 1a9d3d0b39

View file

@ -38,10 +38,11 @@ def headers(server, code):
server.end_headers() server.end_headers()
def head(title="", description="", image="", config={}): def head(title="", description="", image="", config={}, author=""):
if image.startswith("/"): image = config.get("url","")+image if image.startswith("/"): image = config.get("url","")+image
favicon = config.get("favicon", "/icon/internet") favicon = config.get("favicon", "/icon/internet")
html = """ html = """
@ -65,6 +66,32 @@ def head(title="", description="", image="", config={}):
<meta property="og:description" content=\""""+Simplify(description, False)+""""> <meta property="og:description" content=\""""+Simplify(description, False)+"""">
<meta property="og:image" content=\""""+image+""""> <meta property="og:image" content=\""""+image+"""">
"""
# Author tags.
if author:
account = accounts().get(author, {})
name = account.get("title", account)
mastodon = account.get("mastodon", "")
try:
if "/" in mastodon:
mastodon = mastodon.replace("https://", "").replace("http://", "")
mastodon = mastodon.split("/")[1]+"@"+mastodon.split("/")[0]
except:
pass
if mastodon:
html = html + """
<meta name=article:author content=\""""+name+"""">
<meta name=fediverse:creator content=\""""+mastodon+"""">
"""
html = html + """
<!-- This meta tag is needed for pretty rendering on phones --> <!-- This meta tag is needed for pretty rendering on phones -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@ -406,7 +433,9 @@ def ArticlePage(server, url):
# Generating <head> # Generating <head>
html = head(title = Articles.get(article, {}).get("title", article), html = head(title = Articles.get(article, {}).get("title", article),
description = Articles.get(article, {}).get("description", ""), description = Articles.get(article, {}).get("description", ""),
config = config image = Articles.get(article, {}).get("thumbnail", ""),
config = config,
author = Articles.get(article, {}).get("author")
) )
@ -551,6 +580,9 @@ def AccountPage(server, account):
html = html + '</center>' html = html + '</center>'
# Protecting emails and stuff from scrubbers
if len(str(server.cookie)) == 50:
# Website # Website
website = Safe(Accounts.get(account, {}).get("website" , "")) website = Safe(Accounts.get(account, {}).get("website" , ""))