diff --git a/cmd/server/main.go b/cmd/server/main.go index 97f6651..9a82bd8 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -6,10 +6,8 @@ import ( "bytes" "log" "net/http" - "strings" "github.com/go-playground/validator/v10" - jwtgo "github.com/golang-jwt/jwt" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) @@ -40,16 +38,7 @@ func main() { // Routes e.GET("/", func(c echo.Context) error { - tokenString := getToken(c) loggedIn := false - if tokenString != "" { - token, err := jwtgo.Parse(tokenString, func(token *jwtgo.Token) (interface{}, error) { - return []byte(cfg.JWTSecret), nil - }) - if err == nil && token.Valid { - loggedIn = true - } - } var buf bytes.Buffer err := templates.Index(loggedIn).Render(c.Request().Context(), &buf) if err != nil { diff --git a/templates/index_templ.go b/templates/index_templ.go new file mode 100644 index 0000000..bf49715 --- /dev/null +++ b/templates/index_templ.go @@ -0,0 +1,50 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.977 +package templates + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +func Index(loggedIn bool) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
Your personal ebook management system. Track reading progress, organize your library, and enjoy beautiful themes.
Discover the features that make ebook management effortless
Track your reading progress across all your ebooks with detailed statistics.
Choose from 11 stunning themes including Tokyo Night, Dracula, and Catppuccin variants.
Built with Go and HTMX for lightning-fast performance and smooth interactions.
Sign in to start managing your ebook library