mirror of
https://github.com/rls-moe/nyx
synced 2024-11-14 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 (
|
import (
|
||||||
"github.com/icza/session"
|
"github.com/icza/session"
|
||||||
|
"go.rls.moe/nyx/config"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func SetupSessionManager(c *config.Config) {
|
||||||
session.Global.Close()
|
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 {
|
func GetSession(r *http.Request) session.Session {
|
||||||
|
@ -14,14 +14,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var riceConf = rice.Config{
|
|
||||||
LocateOrder: []rice.LocateMethod{
|
|
||||||
rice.LocateWorkingDirectory,
|
|
||||||
rice.LocateEmbedded,
|
|
||||||
rice.LocateAppended,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func Start(config *config.Config) error {
|
func Start(config *config.Config) error {
|
||||||
err := admin.LoadTemplates()
|
err := admin.LoadTemplates()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -35,6 +27,7 @@ func Start(config *config.Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
middle.SetupSessionManager(config)
|
||||||
|
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user