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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
</label> {{end}}
|
</label> {{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .SignedIn}}
|
{{if .SignedIn}}
|
||||||
<label class="cursor-pointer label mt-5"> <span
|
<label class="cursor-pointer label mt-5"> <span
|
||||||
class="label-text">Share</span> <input name="share" type="checkbox"
|
class="label-text">Share</span> <input name="share" type="checkbox"
|
||||||
class="checkbox checkbox-primary" />
|
class="checkbox checkbox-primary" />
|
||||||
</label>
|
</label>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div> <label>
|
<div> <label>
|
||||||
<span>max questions</span> <input value="0" placeholder="max
|
<span>max questions</span> <input value="0" placeholder="max
|
||||||
|
Loading…
Reference in New Issue
Block a user