Add simple file cache (no auto deletion yet)

This commit is contained in:
Zed
2019-06-23 02:46:46 +02:00
parent 64259ef1ea
commit d070e76e1a
2 changed files with 25 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
import strutils, strformat, uri
import nimcrypto
import nimcrypto, regex
const key = "supersecretkey"
@@ -21,3 +21,7 @@ proc getSigUrl*(link: string; path: string): string =
sig = getHmac(link)
url = encodeUrl(link)
&"/{path}/{sig}/{url}"
proc cleanFilename*(filename: string): string =
const reg = re"[^A-Za-z0-9._-]"
filename.replace(reg, "_")