aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorFChannel <>2022-05-05 10:05:40 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commitaf542e339e5a611d2a1b5876450bee841b577640 (patch)
tree987f4fce83d49605a0a81d68fcfac9b2d57cf8a7 /routes
parent493fc8e025fd613d9faf0b573d610e4a0e0c0228 (diff)
removed redis dependency
Diffstat (limited to 'routes')
-rw-r--r--routes/admin.go11
-rw-r--r--routes/archive.go2
-rw-r--r--routes/index.go2
-rw-r--r--routes/news.go4
-rw-r--r--routes/outbox.go2
-rw-r--r--routes/post.go4
6 files changed, 8 insertions, 17 deletions
diff --git a/routes/admin.go b/routes/admin.go
index 580b4dd..771cda2 100644
--- a/routes/admin.go
+++ b/routes/admin.go
@@ -15,7 +15,6 @@ import (
"github.com/FChannel0/FChannel-Server/util"
"github.com/FChannel0/FChannel-Server/webfinger"
"github.com/gofiber/fiber/v2"
- "github.com/gofrs/uuid"
)
func AdminVerify(ctx *fiber.Ctx) error {
@@ -54,17 +53,9 @@ func AdminVerify(ctx *fiber.Ctx) error {
return ctx.Redirect("/"+config.Key, http.StatusPermanentRedirect)
}
- //TODO remove redis dependency
- sessionToken, _ := uuid.NewV4()
-
- _, err = db.Cache.Do("SETEX", sessionToken, "86400", body+"|"+verify.Code)
- if err != nil {
- return ctx.Redirect("/"+config.Key, http.StatusPermanentRedirect)
- }
-
ctx.Cookie(&fiber.Cookie{
Name: "session_token",
- Value: sessionToken.String(),
+ Value: body + "|" + verify.Code,
Expires: time.Now().UTC().Add(60 * 60 * 48 * time.Second),
})
diff --git a/routes/archive.go b/routes/archive.go
index 81cad48..746169f 100644
--- a/routes/archive.go
+++ b/routes/archive.go
@@ -21,7 +21,7 @@ func ArchiveGet(ctx *fiber.Ctx) error {
returnData.Board.To = actor.Outbox
returnData.Board.Actor = *actor
returnData.Board.Summary = actor.Summary
- returnData.Board.ModCred, _ = db.GetPassword(ctx)
+ returnData.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
returnData.Board.Domain = config.Domain
returnData.Board.Restricted = actor.Restricted
returnData.Key = config.Key
diff --git a/routes/index.go b/routes/index.go
index efa8838..c088379 100644
--- a/routes/index.go
+++ b/routes/index.go
@@ -42,7 +42,7 @@ func Index(ctx *fiber.Ctx) error {
data.Board.Name = ""
data.Key = config.Key
data.Board.Domain = config.Domain
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Actor = actor
data.Board.Post.Actor = actor.Id
data.Board.Restricted = actor.Restricted
diff --git a/routes/news.go b/routes/news.go
index 736b664..bd037c2 100644
--- a/routes/news.go
+++ b/routes/news.go
@@ -23,7 +23,7 @@ func NewsGet(ctx *fiber.Ctx) error {
data.Board.Name = ""
data.Key = config.Key
data.Board.Domain = config.Domain
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Actor = actor
data.Board.Post.Actor = actor.Id
data.Board.Restricted = actor.Restricted
@@ -55,7 +55,7 @@ func AllNewsGet(ctx *fiber.Ctx) error {
data.Board.Name = ""
data.Key = config.Key
data.Board.Domain = config.Domain
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Actor = actor
data.Board.Post.Actor = actor.Id
data.Board.Restricted = actor.Restricted
diff --git a/routes/outbox.go b/routes/outbox.go
index c7ca7b4..62d99c4 100644
--- a/routes/outbox.go
+++ b/routes/outbox.go
@@ -71,7 +71,7 @@ func OutboxGet(ctx *fiber.Ctx) error {
data.Board.InReplyTo = ""
data.Board.To = actor.Outbox
data.Board.Actor = actor
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Domain = config.Domain
data.Board.Restricted = actor.Restricted
data.CurrentPage = page
diff --git a/routes/post.go b/routes/post.go
index 7fa3d7b..7ed9e7d 100644
--- a/routes/post.go
+++ b/routes/post.go
@@ -80,7 +80,7 @@ func PostGet(ctx *fiber.Ctx) error {
data.Board.To = actor.Outbox
data.Board.Actor = actor
data.Board.Summary = actor.Summary
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Domain = config.Domain
data.Board.Restricted = actor.Restricted
data.ReturnTo = "feed"
@@ -147,7 +147,7 @@ func CatalogGet(ctx *fiber.Ctx) error {
data.Board.To = actor.Outbox
data.Board.Actor = actor
data.Board.Summary = actor.Summary
- data.Board.ModCred, _ = db.GetPassword(ctx)
+ data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
data.Board.Domain = config.Domain
data.Board.Restricted = actor.Restricted
data.Key = config.Key