From 547c1e022324bb0977a48475669a7a7435762952 Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 7 Oct 2024 17:31:49 +0200 Subject: [PATCH] protect mails against spammers --- src/frontend/templates/service.html | 4 ++-- src/server/server.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontend/templates/service.html b/src/frontend/templates/service.html index 80b1a7b..298b3ed 100644 --- a/src/frontend/templates/service.html +++ b/src/frontend/templates/service.html @@ -230,13 +230,13 @@ {{ else if or (eq .Platform "mail") (eq .Platform "email") }}
  • - + Mail - {{.Link}} + {{mailsafe .Link}}
  • {{ else if eq .Platform "url" }} diff --git a/src/server/server.go b/src/server/server.go index dec2e7c..66325e7 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -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) }