protect mails against spammers

This commit is contained in:
pluja 2024-10-07 17:31:49 +02:00
parent e21beb3787
commit 547c1e0223
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -230,13 +230,13 @@
</li>
{{ else if or (eq .Platform "mail") (eq .Platform "email") }}
<li class="text-center">
<a class="flex items-center justify-center space-x-2" href="mailto:{{.Link}}">
<a class="flex items-center justify-center space-x-2">
<svg class="size-4 fill-white/80" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>Mail</title>
<path
d="M15.61 12c0 1.99-1.62 3.61-3.61 3.61-1.99 0-3.61-1.62-3.61-3.61 0-1.99 1.62-3.61 3.61-3.61 1.99 0 3.61 1.62 3.61 3.61M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12c2.424 0 4.761-.722 6.76-2.087l.034-.024-1.617-1.879-.027.017A9.494 9.494 0 0 1 12 21.54c-5.26 0-9.54-4.28-9.54-9.54 0-5.26 4.28-9.54 9.54-9.54 5.26 0 9.54 4.28 9.54 9.54a9.63 9.63 0 0 1-.225 2.05c-.301 1.239-1.169 1.618-1.82 1.568-.654-.053-1.42-.52-1.426-1.661V12A6.076 6.076 0 0 0 12 5.93 6.076 6.076 0 0 0 5.93 12 6.076 6.076 0 0 0 12 18.07a6.02 6.02 0 0 0 4.3-1.792 3.9 3.9 0 0 0 3.32 1.805c.874 0 1.74-.292 2.437-.821.719-.547 1.256-1.336 1.553-2.285.047-.154.135-.504.135-.507l.002-.013c.175-.76.253-1.52.253-2.457 0-6.617-5.383-12-12-12" />
</svg>
<span>{{.Link}}</span>
<span>{{mailsafe .Link}}</span>
</a>
</li>
{{ else if eq .Platform "url" }}

View File

@ -207,6 +207,10 @@ func (s *Server) RegisterViews() {
}
return time.Since(tm) < 7*(24*time.Hour)
},
"mailsafe": func(input string) string {
input = strings.ReplaceAll(input, "@", "[at]")
return strings.ReplaceAll(input, ".", "[dot]")
},
})
s.Router.RegisterView(blocks)
}