2023-09-10 17:39:34 +02:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
|
2023-10-04 13:36:54 +02:00
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/server/router/context"
|
2023-09-10 17:39:34 +02:00
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/server/router/handler"
|
2024-07-12 15:30:41 +02:00
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/server/router/middleware"
|
2023-09-10 17:39:34 +02:00
|
|
|
)
|
|
|
|
|
2024-07-09 22:41:29 +02:00
|
|
|
type Context = context.Context
|
2023-10-04 13:36:54 +02:00
|
|
|
|
2024-07-09 22:41:29 +02:00
|
|
|
func Init(e *echo.Echo, sc Context) {
|
2024-07-12 15:30:41 +02:00
|
|
|
e.Use(middleware.Session(sc))
|
2023-10-04 13:36:54 +02:00
|
|
|
|
2024-07-09 22:41:29 +02:00
|
|
|
e.GET("/", handler.HandleIndex(sc))
|
2024-07-10 09:14:06 +02:00
|
|
|
e.GET("/about", handler.HandleAbout(sc))
|
2024-07-12 13:26:27 +02:00
|
|
|
|
|
|
|
e.GET("/login", handler.HandleAuth(sc, "login"))
|
|
|
|
e.GET("/login/:method", handler.HandleAuth(sc, "login"))
|
|
|
|
e.GET("/signup", handler.HandleAuth(sc, "register"))
|
|
|
|
e.GET("/signup/:method", handler.HandleAuth(sc, "register"))
|
|
|
|
e.GET("/api/lnauth/callback", handler.HandleLnAuthCallback(sc))
|
|
|
|
e.GET("/session", handler.HandleSessionCheck(sc))
|
2024-07-14 12:57:40 +02:00
|
|
|
|
|
|
|
e.GET("/user", handler.HandleUser(sc), middleware.SessionGuard(sc))
|
|
|
|
e.POST("/logout", handler.HandleLogout(sc), middleware.SessionGuard(sc))
|
2023-09-10 17:39:34 +02:00
|
|
|
}
|