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, "Bookmann - Home

📚 Bookmann

Your personal ebook management system. Track reading progress, organize your library, and enjoy beautiful themes.

Why Bookmann?

Discover the features that make ebook management effortless

📖

Reading Progress

Track your reading progress across all your ebooks with detailed statistics.

🎨

Beautiful Themes

Choose from 11 stunning themes including Tokyo Night, Dracula, and Catppuccin variants.

Fast & Modern

Built with Go and HTMX for lightning-fast performance and smooth interactions.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !loggedIn { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

Join Bookmann Today

Sign in to start managing your ebook library

Login

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +var _ = templruntime.GeneratedTemplate