Rewrote account switching, fix some minor bugs here and there

This commit is contained in:
Mukhtar Akere
2025-09-16 21:15:24 +01:00
parent 76f5b85313
commit 30b2db06e7
34 changed files with 945 additions and 866 deletions

View File

@@ -1,14 +1,14 @@
package web
import (
"cmp"
"embed"
"html/template"
"github.com/gorilla/sessions"
"github.com/rs/zerolog"
"github.com/sirrobot01/decypharr/internal/config"
"github.com/sirrobot01/decypharr/internal/logger"
"github.com/sirrobot01/decypharr/pkg/wire"
"html/template"
"os"
)
var restartFunc func()
@@ -64,6 +64,7 @@ type Web struct {
}
func New() *Web {
cfg := config.Get()
templates := template.Must(template.ParseFS(
content,
"templates/layout.html",
@@ -75,8 +76,7 @@ func New() *Web {
"templates/login.html",
"templates/register.html",
))
secretKey := cmp.Or(os.Getenv("DECYPHARR_SECRET_KEY"), "\"wqj(v%lj*!-+kf@4&i95rhh_!5_px5qnuwqbr%cjrvrozz_r*(\"")
cookieStore := sessions.NewCookieStore([]byte(secretKey))
cookieStore := sessions.NewCookieStore([]byte(cfg.SecretKey()))
cookieStore.Options = &sessions.Options{
Path: "/",
MaxAge: 86400 * 7,