changes + add uploader
This commit is contained in:
parent
7e1c36c966
commit
1383b52f85
@ -32,6 +32,10 @@ func Setup() {
|
|||||||
|
|
||||||
web.RegisterAppSetupFunc(func(a *fiber.App) {
|
web.RegisterAppSetupFunc(func(a *fiber.App) {
|
||||||
a.Get("/app/uploader", func(c *fiber.Ctx) error {
|
a.Get("/app/uploader", func(c *fiber.Ctx) error {
|
||||||
|
_, err := user.GetSession(c)
|
||||||
|
if err != nil {
|
||||||
|
return c.Redirect("/auth?redirect=/app/uploader", http.StatusUnauthorized)
|
||||||
|
}
|
||||||
data := *web.Common(c)
|
data := *web.Common(c)
|
||||||
data["Title"] = "tmp"
|
data["Title"] = "tmp"
|
||||||
return c.Render("apps/uploader/index", data, "layouts/base")
|
return c.Render("apps/uploader/index", data, "layouts/base")
|
||||||
@ -39,7 +43,7 @@ func Setup() {
|
|||||||
a.Get("/app/uploader/:key", func(c *fiber.Ctx) error {
|
a.Get("/app/uploader/:key", func(c *fiber.Ctx) error {
|
||||||
encryptionKey, err := hex.DecodeString(c.Params("key"))
|
encryptionKey, err := hex.DecodeString(c.Params("key"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return c.Next()
|
||||||
}
|
}
|
||||||
storageKey := hashKey(encryptionKey)
|
storageKey := hashKey(encryptionKey)
|
||||||
|
|
||||||
@ -57,7 +61,7 @@ func Setup() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if accessCount >= int64(row.MaxVisits) {
|
if accessCount == int64(row.MaxVisits) || accessCount > int64(row.MaxVisits) {
|
||||||
return c.Next()
|
return c.Next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user