refactor, sketch SSE implementation

This commit is contained in:
Carl Pearson
2024-10-19 06:02:54 -06:00
parent 459e899efe
commit 22a82d0e4c
11 changed files with 266 additions and 124 deletions

View File

@@ -1,12 +1,34 @@
package handlers
import "github.com/sirupsen/logrus"
import (
"ytdlp-site/config"
"github.com/gorilla/sessions"
"github.com/sirupsen/logrus"
)
var log *logrus.Logger
var store *sessions.CookieStore
func Init(logger *logrus.Logger) error {
log = logger.WithFields(logrus.Fields{
"component": "handlers",
}).Logger
// create the cookie store
key, err := config.GetSessionAuthKey()
if err != nil {
return err
}
store = sessions.NewCookieStore(key)
store.Options = &sessions.Options{
Path: "/",
MaxAge: 30 * 24 * 60 * 60, // seconds
HttpOnly: true,
Secure: config.GetSecure(),
}
return nil
}
func Fini() {}