From 56b55ad941dd8985cc0e957b6b8366be8640d027 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 15 Dec 2023 19:13:56 +0800 Subject: [PATCH] chore: update memo metadata --- server/frontend/frontend.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/frontend/frontend.go b/server/frontend/frontend.go index 68620876..6734d208 100644 --- a/server/frontend/frontend.go +++ b/server/frontend/frontend.go @@ -80,9 +80,6 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) { if memo == nil { return c.HTML(http.StatusOK, rawIndexHTML) } - if memo.Visibility != store.Public { - return c.HTML(http.StatusOK, rawIndexHTML) - } creator, err := s.Store.GetUser(ctx, &store.FindUser{ ID: &memo.CreatorID, }) @@ -97,15 +94,21 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) { } func generateMemoMetadata(memo *store.Memo, creator *store.User) string { + description := memo.Content + if memo.Visibility == store.Private { + description = "This memo is private." + } else if memo.Visibility == store.Protected { + description = "This memo is protected." + } metadataList := []string{ - fmt.Sprintf(``, memo.Content), + fmt.Sprintf(``, description), fmt.Sprintf(``, fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username)), - fmt.Sprintf(``, memo.Content), + fmt.Sprintf(``, description), fmt.Sprintf(``, "https://www.usememos.com/logo.png"), ``, // Twitter related metadata. fmt.Sprintf(``, fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username)), - fmt.Sprintf(``, memo.Content), + fmt.Sprintf(``, description), fmt.Sprintf(``, "https://www.usememos.com/logo.png"), ``, }