]> git.mar77i.info Git - hublib/blobdiff - hub/utils.py
polish structure, update requirements
[hublib] / hub / utils.py
index ae1fd1242684f692ccec08e4293fcaba6807214e..ae448ed8fb499a14c3c9ea486fcc1e59252fbe42 100644 (file)
@@ -1,5 +1,3 @@
-from base64 import urlsafe_b64encode
-from hashlib import pbkdf2_hmac
 from pathlib import Path
 
 from jinja2_simple_tags import StandaloneTag
@@ -12,20 +10,10 @@ class StaticTag(StandaloneTag):
         if not hubapp:
             hubapp = self.context["hubapp"]
         elif isinstance(hubapp, str):
-            hubapp = self.context["hubapp"].app.get_hubapp_by_name(hubapp)
+            hubapp = self.context["hubapp"].app.hubapps[hubapp]
         return hubapp.uri_from(Path(filename))
 
 
-def scramble(secret, value):
-    if isinstance(value, str):
-        value = value.encode()
-    if isinstance(secret, str):
-        secret = secret.encode()
-    return urlsafe_b64encode(
-        pbkdf2_hmac("sha512", value, secret, 221100)
-    ).rstrip(b"=").decode("ascii")
-
-
 def get_redis_pass(redis_conf):
     prefix = "requirepass "
     with open(redis_conf, "rt") as fh: