mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: rename internal/session package to internal/ctx
This commit is contained in:
parent
35348fef6a
commit
25cddbada6
2
Makefile
2
Makefile
@ -322,7 +322,7 @@ build-hway: gen-templ gen-pkl
|
||||
|
||||
build-motr: gen-templ gen-pkl
|
||||
@echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault"
|
||||
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./pkg/dwn/wasm/main.go
|
||||
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/main.go
|
||||
|
||||
build-nebula:
|
||||
@echo "(nebula) Building nebula"
|
||||
|
@ -15,14 +15,14 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
promise "github.com/nlepage/go-js-promise"
|
||||
|
||||
"github.com/onsonr/sonr/internal/session"
|
||||
"github.com/onsonr/sonr/internal/ctx"
|
||||
"github.com/onsonr/sonr/pkg/nebula/routes"
|
||||
"github.com/onsonr/sonr/pkg/nebula/worker"
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.Use(session.UseSession)
|
||||
e.Use(ctx.UseSession)
|
||||
registerViews(e)
|
||||
registerState(e)
|
||||
Serve(e)
|
@ -1,4 +1,4 @@
|
||||
package session
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,10 +1,8 @@
|
||||
package session
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/segmentio/ksuid"
|
||||
|
||||
"github.com/onsonr/sonr/internal/headers"
|
||||
)
|
||||
|
||||
// GetSession returns the current Session
|
||||
@ -16,7 +14,7 @@ func GetSession(c echo.Context) *Session {
|
||||
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sc := initSession(c)
|
||||
headers := new(headers.RequestHeaders)
|
||||
headers := new(RequestHeaders)
|
||||
err := sc.Bind(headers)
|
||||
if err != nil {
|
||||
return err
|
@ -1,4 +1,4 @@
|
||||
package headers
|
||||
package ctx
|
||||
|
||||
type RequestHeaders struct {
|
||||
CacheControl *string `header:"Cache-Control"`
|
@ -1,4 +1,4 @@
|
||||
package headers
|
||||
package ctx
|
||||
|
||||
type ResponseHeaders struct {
|
||||
// HTMX Specific
|
@ -4,14 +4,14 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/session"
|
||||
"github.com/onsonr/sonr/internal/ctx"
|
||||
"github.com/onsonr/sonr/pkg/nebula/routes"
|
||||
"github.com/syumai/workers"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := echo.New()
|
||||
s.Use(session.UseSession)
|
||||
s.Use(ctx.UseSession)
|
||||
|
||||
s.GET("/", routes.Home)
|
||||
s.GET("/login", routes.LoginStart)
|
||||
|
Loading…
x
Reference in New Issue
Block a user