diff options
author | Jason A. Donenfeld | 2014-01-13 16:24:40 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2014-01-14 02:00:07 +0100 |
commit | 786609bd36c07b85dbf905fc8c36eba7132122d7 (patch) | |
tree | 03d3a49c01b89e7122bdde4ad088fc225a819e7b /filters | |
parent | filter: add gravatar scripts (diff) | |
download | cgit-786609bd36c07b85dbf905fc8c36eba7132122d7.tar.gz cgit-786609bd36c07b85dbf905fc8c36eba7132122d7.zip |
filter: add page source to email filter
Since the email filter is called from lots of places, the script might benefit from knowing the origin. That way it can modify its contents and/or size depending. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'filters')
-rw-r--r-- | filters/email-gravatar.lua | 2 | ||||
-rwxr-xr-x | filters/email-gravatar.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/filters/email-gravatar.lua b/filters/email-gravatar.lua index 8a53447..982e030 100644 --- a/filters/email-gravatar.lua +++ b/filters/email-gravatar.lua | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | require("crypto") | 10 | require("crypto") |
11 | 11 | ||
12 | function filter_open(email) | 12 | function filter_open(email, page) |
13 | buffer = "" | 13 | buffer = "" |
14 | md5 = crypto.digest("md5", email:sub(2, -2):lower()) | 14 | md5 = crypto.digest("md5", email:sub(2, -2):lower()) |
15 | end | 15 | end |
diff --git a/filters/email-gravatar.py b/filters/email-gravatar.py index 4445615..f90b87d 100755 --- a/filters/email-gravatar.py +++ b/filters/email-gravatar.py | |||
@@ -27,6 +27,8 @@ if email[0] == '<': | |||
27 | if email[-1] == '>': | 27 | if email[-1] == '>': |
28 | email = email[0:-1] | 28 | email = email[0:-1] |
29 | 29 | ||
30 | page = sys.argv[2] | ||
31 | |||
30 | md5 = hashlib.md5(email.encode()).hexdigest() | 32 | md5 = hashlib.md5(email.encode()).hexdigest() |
31 | text = sys.stdin.read().strip() | 33 | text = sys.stdin.read().strip() |
32 | 34 | ||