Rewrote account switching, fix some minor bugs here and there
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user