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
a004dcf3
Unverified
Commit
a004dcf3
authored
Feb 10, 2023
by
boojack
Committed by
GitHub
Feb 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: pass empty condition in rss (#1058)
fix: handle empty condition in rss
parent
5df59a48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
rss.go
server/rss.go
+5
-12
memos-header.less
web/src/less/memos-header.less
+1
-1
No files found.
server/rss.go
View file @
a004dcf3
...
...
@@ -14,10 +14,6 @@ import (
)
func
generateRSSFromMemoList
(
memoList
[]
*
api
.
Memo
,
baseURL
string
,
profile
*
api
.
CustomizedProfile
)
(
string
,
error
)
{
if
len
(
memoList
)
==
0
{
return
""
,
nil
}
feed
:=
&
feeds
.
Feed
{
Title
:
profile
.
Name
,
Link
:
&
feeds
.
Link
{
Href
:
baseURL
},
...
...
@@ -56,10 +52,7 @@ func generateRSSFromMemoList(memoList []*api.Memo, baseURL string, profile *api.
if
err
!=
nil
{
return
""
,
err
}
rssPrefix
:=
`<?xml version="1.0" encoding="UTF-8"?>`
return
rss
[
len
(
rssPrefix
)
:
],
nil
return
rss
,
nil
}
func
(
s
*
Server
)
registerRSSRoutes
(
g
*
echo
.
Group
)
{
...
...
@@ -84,13 +77,13 @@ func (s *Server) registerRSSRoutes(g *echo.Group) {
}
baseURL
:=
c
.
Scheme
()
+
"://"
+
c
.
Request
()
.
Host
rss
,
err
:=
generateRSSFromMemoList
(
memoList
,
baseURL
,
&
systemCustomizedProfile
)
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to generate rss"
)
.
SetInternal
(
err
)
}
return
c
.
XMLBlob
(
http
.
StatusOK
,
[]
byte
(
rss
))
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
echo
.
MIMEApplicationXMLCharsetUTF8
)
return
c
.
String
(
http
.
StatusOK
,
rss
)
})
g
.
GET
(
"/u/:id/rss.xml"
,
func
(
c
echo
.
Context
)
error
{
...
...
@@ -125,8 +118,8 @@ func (s *Server) registerRSSRoutes(g *echo.Group) {
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to generate rss"
)
.
SetInternal
(
err
)
}
return
c
.
XMLBlob
(
http
.
StatusOK
,
[]
byte
(
rss
)
)
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
echo
.
MIMEApplicationXMLCharsetUTF8
)
return
c
.
String
(
http
.
StatusOK
,
rss
)
})
}
...
...
web/src/less/memos-header.less
View file @
a004dcf3
...
...
@@ -13,7 +13,7 @@
}
> .title-text {
@apply font-bold text-lg leading-10 mr-
2
text-ellipsis shrink-0 cursor-pointer overflow-hidden text-gray-700 dark:text-gray-200;
@apply font-bold text-lg leading-10 mr-
1
text-ellipsis shrink-0 cursor-pointer overflow-hidden text-gray-700 dark:text-gray-200;
}
}
...
...
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