aboutsummaryrefslogtreecommitdiff
path: root/app/rediscache.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-11-18 21:42:56 +0000
committerrubenwardy <rw@rubenwardy.com>2019-11-18 21:42:56 +0000
commitff2a74367f3fe980f08c20c691d451d1ae55b95a (patch)
tree73598d0ba42d4a44aef8c4b58763641dabe9d914 /app/rediscache.py
parent3f666d2302f5ad78784f2e8a8362134652eed4b9 (diff)
downloadcheatdb-ff2a74367f3fe980f08c20c691d451d1ae55b95a.tar.xz
Fix download forgery
Diffstat (limited to 'app/rediscache.py')
-rw-r--r--app/rediscache.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/rediscache.py b/app/rediscache.py
new file mode 100644
index 0000000..718a82e
--- /dev/null
+++ b/app/rediscache.py
@@ -0,0 +1,13 @@
+from . import r
+
+# This file acts as a facade between the releases code and redis,
+# and also means that the releases code avoids knowing about `app`
+
+def make_download_key(ip, package):
+ return ("{}/{}/{}").format(ip, package.author.username, package.name)
+
+def set_key(key, v):
+ r.set(key, v)
+
+def has_key(key):
+ return r.exists(key)