git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/email-filter.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/email-filter.py b/lib/email-filter.py
new file mode 100644
index 0000000..1b44e1e
--- /dev/null
+++ b/lib/email-filter.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+# Please prefer the email-gravatar.lua using lua: as a prefix over this script. This
+# script is very slow, in comparison.
+#
+# This script may be used with the email-filter or repo.email-filter settings in cgitrc.
+#
+# The following environment variables can be used to retrieve the configuration
+# of the repository for which this script is called:
+# CGIT_REPO_URL ( = repo.url setting )
+# CGIT_REPO_NAME ( = repo.name setting )
+# CGIT_REPO_PATH ( = repo.path setting )
+# CGIT_REPO_OWNER ( = repo.owner setting )
+# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting )
+# CGIT_REPO_SECTION ( = section setting )
+# CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
+#
+# This simply receives text on stdin and replaces any occurrence of "@" by
+# " _ " to obfuscate emails. Not the most sophisticated algorithm (for now),
+# but laziness and time are two important factors.
+# It still helps with receiving email only from the wealthy Nigerian princes.
+# I need to make money, too.
+
+from sys import stdin
+text = stdin.read().strip()
+text=text.replace("@", " _ ")
+
+print(text)