Diffstat (limited to 'internal/router/api-v1-general-page-bottom-embeds.go')
| -rw-r--r-- | internal/router/api-v1-general-page-bottom-embeds.go | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/internal/router/api-v1-general-page-bottom-embeds.go b/internal/router/api-v1-general-page-bottom-embeds.go index c4d9543..f0957f3 100644 --- a/internal/router/api-v1-general-page-bottom-embeds.go +++ b/internal/router/api-v1-general-page-bottom-embeds.go @@ -6,7 +6,6 @@ import ( "net/url" "slices" "strings" - "time" "github.com/SayaAndy/saya-today-web/internal/b2" "github.com/SayaAndy/saya-today-web/locale" @@ -31,14 +30,8 @@ func Api_V1_GeneralPage_BottomEmbeds(l map[string]*locale.LocaleConfig, langs [] } path := urlStruct.EscapedPath() - cacheKey := fmt.Sprintf("bottom-embeds.%s", path) - if val, ok := PCache.Get(cacheKey); val != nil && ok { - c.Set(fiber.HeaderContentType, fiber.MIMETextHTMLCharsetUTF8) - return c.Status(fiber.StatusOK).Type("html").Send(val) - } - pathParts := strings.Split(strings.Trim(path, "/"), "/") - if len(pathParts) == 0 { + if len(pathParts) < 2 { return c.Status(fiber.ErrBadRequest.Code).SendString("'Referer' header is invalid: expect format '/{lang}/...'") } @@ -58,8 +51,6 @@ func Api_V1_GeneralPage_BottomEmbeds(l map[string]*locale.LocaleConfig, langs [] additionalTemplates = append(additionalTemplates, "views/pages/blog-catalogue.html") } else if len(pathParts) == 3 && pathParts[1] == "blog" { additionalTemplates = append(additionalTemplates, "views/pages/blog-page.html") - } else if len(pathParts) == 1 { - additionalTemplates = append(additionalTemplates, "views/pages/home-page.html") } content, err := tm.Render("general-page-bottom-embeds", values, additionalTemplates...) @@ -68,7 +59,6 @@ func Api_V1_GeneralPage_BottomEmbeds(l map[string]*locale.LocaleConfig, langs [] return c.Status(fiber.ErrInternalServerError.Code).SendString("failed to generate div") } - go PCache.SetWithTTL(cacheKey, content, int64(len(content)), 5*time.Minute) c.Set(fiber.HeaderContentType, fiber.MIMETextHTMLCharsetUTF8) return c.Status(fiber.StatusOK).Type("html").Send(content) } |