Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
eca91d5c
Unverified
Commit
eca91d5c
authored
May 27, 2025
by
Maximilian Krauß
Committed by
GitHub
May 27, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(rss): use server title and description for RSS feed, if configured (#4717)
parent
ad2c5f0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
rss.go
server/router/rss/rss.go
+29
-2
No files found.
server/router/rss/rss.go
View file @
eca91d5c
...
@@ -26,6 +26,11 @@ type RSSService struct {
...
@@ -26,6 +26,11 @@ type RSSService struct {
Store
*
store
.
Store
Store
*
store
.
Store
}
}
type
RSSHeading
struct
{
Title
string
Description
string
}
func
NewRSSService
(
profile
*
profile
.
Profile
,
store
*
store
.
Store
)
*
RSSService
{
func
NewRSSService
(
profile
*
profile
.
Profile
,
store
*
store
.
Store
)
*
RSSService
{
return
&
RSSService
{
return
&
RSSService
{
Profile
:
profile
,
Profile
:
profile
,
...
@@ -93,10 +98,14 @@ func (s *RSSService) GetUserRSS(c echo.Context) error {
...
@@ -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
)
{
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
{
feed
:=
&
feeds
.
Feed
{
Title
:
"Memos"
,
Title
:
rssHeading
.
Title
,
Link
:
&
feeds
.
Link
{
Href
:
baseURL
},
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
(),
Created
:
time
.
Now
(),
}
}
...
@@ -150,3 +159,21 @@ func getRSSItemDescription(content string) (string, error) {
...
@@ -150,3 +159,21 @@ func getRSSItemDescription(content string) (string, error) {
result
:=
renderer
.
NewHTMLRenderer
()
.
Render
(
nodes
)
result
:=
renderer
.
NewHTMLRenderer
()
.
Render
(
nodes
)
return
result
,
nil
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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment