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
17e116b9
Commit
17e116b9
authored
Dec 01, 2025
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter
parent
545323d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
rss.go
server/router/rss/rss.go
+7
-7
No files found.
server/router/rss/rss.go
View file @
17e116b9
...
...
@@ -27,11 +27,11 @@ const (
)
var
(
// Regex to match markdown headings at the start of a line
// Regex to match markdown headings at the start of a line
.
markdownHeadingRegex
=
regexp
.
MustCompile
(
`^#{1,6}\s*`
)
)
// cacheEntry represents a cached RSS feed with expiration
// cacheEntry represents a cached RSS feed with expiration
.
type
cacheEntry
struct
{
content
string
etag
string
...
...
@@ -291,7 +291,7 @@ func (s *RSSService) generateRSSFromMemoList(ctx context.Context, memoList []*st
return
rss
,
lastModified
,
nil
}
func
(
s
*
RSSService
)
generateItemTitle
(
content
string
)
string
{
func
(
*
RSSService
)
generateItemTitle
(
content
string
)
string
{
// Extract first line as title
lines
:=
strings
.
Split
(
content
,
"
\n
"
)
title
:=
strings
.
TrimSpace
(
lines
[
0
])
...
...
@@ -335,7 +335,7 @@ func (s *RSSService) getRSSItemDescription(content string) (string, error) {
return
html
,
nil
}
// getFromCache retrieves a cached feed entry if it exists and is not expired
// getFromCache retrieves a cached feed entry if it exists and is not expired
.
func
(
s
*
RSSService
)
getFromCache
(
key
string
)
*
cacheEntry
{
s
.
cacheMutex
.
RLock
()
entry
,
exists
:=
s
.
cache
[
key
]
...
...
@@ -357,7 +357,7 @@ func (s *RSSService) getFromCache(key string) *cacheEntry {
return
entry
}
// putInCache stores a feed in the cache and returns its ETag
// putInCache stores a feed in the cache and returns its ETag
.
func
(
s
*
RSSService
)
putInCache
(
key
,
content
string
,
lastModified
time
.
Time
)
string
{
s
.
cacheMutex
.
Lock
()
defer
s
.
cacheMutex
.
Unlock
()
...
...
@@ -391,8 +391,8 @@ func (s *RSSService) putInCache(key, content string, lastModified time.Time) str
return
etag
}
// setRSSHeaders sets appropriate HTTP headers for RSS responses
func
(
s
*
RSSService
)
setRSSHeaders
(
c
echo
.
Context
,
etag
string
,
lastModified
time
.
Time
)
{
// setRSSHeaders sets appropriate HTTP headers for RSS responses
.
func
(
*
RSSService
)
setRSSHeaders
(
c
echo
.
Context
,
etag
string
,
lastModified
time
.
Time
)
{
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
"application/rss+xml; charset=utf-8"
)
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderCacheControl
,
fmt
.
Sprintf
(
"public, max-age=%d"
,
int
(
defaultCacheDuration
.
Seconds
())))
c
.
Response
()
.
Header
()
.
Set
(
"ETag"
,
etag
)
...
...
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