Use referer form data instead of relying on header

This commit is contained in:
Zed
2019-09-05 22:40:36 +02:00
parent f7c1c28368
commit 1e55f21fa5
10 changed files with 94 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
import strutils, strformat, uri
import strutils, strformat, sequtils, uri, tables
import nimcrypto, regex
const key = "supersecretkey"
@@ -25,3 +25,7 @@ proc getSigUrl*(link: string; path: string): string =
proc cleanFilename*(filename: string): string =
const reg = re"[^A-Za-z0-9._-]"
filename.replace(reg, "_")
proc filterParams*(params: Table): seq[(string, string)] =
let filter = ["name", "id"]
toSeq(params.pairs()).filterIt(it[0] notin filter)