Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(rss): use server title and description for RSS feed, if configured (#4717)

Maximilian Kraußeca91d5c0c4d
diff --git a/server/router/rss/rss.go b/server/router/rss/rss.go
index 64ad465ca..8a4435ea1 100644
--- a/server/router/rss/rss.go
+++ b/server/router/rss/rss.go
@@ -26,6 +26,11 @@ type RSSService struct {
Store *store.Store
}
+type RSSHeading struct {
+ Title string
+ Description string
+}
+
func NewRSSService(profile *profile.Profile, store *store.Store) *RSSService {
return &RSSService{
Profile: profile,
@@ -93,10 +98,14 @@ func (s *RSSService) GetUserRSS(c echo.Context) error {
}
func (s *RSSService) generateRSSFromMemoList(ctx context.Context, memoList []*store.Memo, baseURL string) (string, error) {
+ rssHeading, err := getRSSHeading(s.Store, ctx)
+ if err != nil {
+ return "", err
+ }
feed := &feeds.Feed{
- Title: "Memos",
+ Title: rssHeading.Title,
Link: &feeds.Link{Href: baseURL},
- Description: "An open source, lightweight note-taking service. Easily capture and share your great thoughts.",
+ Description: rssHeading.Description,
Created: time.Now(),
}
@@ -150,3 +159,21 @@ func getRSSItemDescription(content string) (string, error) {
result := renderer.NewHTMLRenderer().Render(nodes)
return result, nil
}
+
+func getRSSHeading(store *store.Store, ctx context.Context) (RSSHeading, error) {
+ settings, err := store.GetWorkspaceGeneralSetting(ctx)
+ if err != nil {
+ return RSSHeading{}, err
+ }
+ if settings == nil || settings.CustomProfile == nil {
+ return RSSHeading{
+ Title: "Memos",
+ Description: "An open source, lightweight note-taking service. Easily capture and share your great thoughts.",
+ }, nil
+ }
+ customProfile := settings.CustomProfile
+ return RSSHeading{
+ Title: customProfile.Title,
+ Description: customProfile.Description,
+ }, nil
+}