mirror of
https://github.com/rls-moe/nyx
synced 2024-11-22 22:12:24 +00:00
Added Insecure HTTP Mode
This commit is contained in:
parent
e85636f4b9
commit
53039e6102
@ -2,12 +2,16 @@ package middle
|
||||
|
||||
import (
|
||||
"github.com/icza/session"
|
||||
"go.rls.moe/nyx/config"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func init() {
|
||||
func SetupSessionManager(c *config.Config) {
|
||||
session.Global.Close()
|
||||
session.Global = session.NewCookieManager(session.NewInMemStore())
|
||||
session.Global = session.NewCookieManagerOptions(session.NewInMemStore(),
|
||||
&session.CookieMngrOptions{
|
||||
AllowHTTP: c.DisableSecurity,
|
||||
})
|
||||
}
|
||||
|
||||
func GetSession(r *http.Request) session.Session {
|
||||
|
@ -14,14 +14,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var riceConf = rice.Config{
|
||||
LocateOrder: []rice.LocateMethod{
|
||||
rice.LocateWorkingDirectory,
|
||||
rice.LocateEmbedded,
|
||||
rice.LocateAppended,
|
||||
},
|
||||
}
|
||||
|
||||
func Start(config *config.Config) error {
|
||||
err := admin.LoadTemplates()
|
||||
if err != nil {
|
||||
@ -35,6 +27,7 @@ func Start(config *config.Config) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
middle.SetupSessionManager(config)
|
||||
|
||||
r := chi.NewRouter()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user