Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
solo-1
Commits
816d5bb7
Unverified
Commit
816d5bb7
authored
Jul 29, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12826
parent
3d0dcdbf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
src/main/java/org/b3log/solo/model/rss/Item.java
src/main/java/org/b3log/solo/model/rss/Item.java
+2
-2
src/main/java/org/b3log/solo/processor/FeedProcessor.java
src/main/java/org/b3log/solo/processor/FeedProcessor.java
+5
-9
No files found.
src/main/java/org/b3log/solo/model/rss/Item.java
View file @
816d5bb7
...
@@ -29,7 +29,7 @@ import java.util.Set;
...
@@ -29,7 +29,7 @@ import java.util.Set;
* Item.
* Item.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.3.
0, Jul 5, 2018
* @version 1.1.3.
1, Jul 29, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Item
{
public
final
class
Item
{
...
@@ -259,7 +259,7 @@ public final class Item {
...
@@ -259,7 +259,7 @@ public final class Item {
stringBuilder
.
append
(
END_LINK_ELEMENT
);
stringBuilder
.
append
(
END_LINK_ELEMENT
);
stringBuilder
.
append
(
START_DESCRIPTION_ELEMENT
);
stringBuilder
.
append
(
START_DESCRIPTION_ELEMENT
);
stringBuilder
.
append
(
StringEscapeUtils
.
escapeXml
(
description
)
);
stringBuilder
.
append
(
"<![CDATA["
+
description
+
"]]>"
);
stringBuilder
.
append
(
END_DESCRIPTION_ELEMENT
);
stringBuilder
.
append
(
END_DESCRIPTION_ELEMENT
);
stringBuilder
.
append
(
START_AUTHOR_ELEMENT
);
stringBuilder
.
append
(
START_AUTHOR_ELEMENT
);
...
...
src/main/java/org/b3log/solo/processor/FeedProcessor.java
View file @
816d5bb7
...
@@ -44,6 +44,7 @@ import org.b3log.solo.model.rss.Item;
...
@@ -44,6 +44,7 @@ import org.b3log.solo.model.rss.Item;
import
org.b3log.solo.repository.ArticleRepository
;
import
org.b3log.solo.repository.ArticleRepository
;
import
org.b3log.solo.service.ArticleQueryService
;
import
org.b3log.solo.service.ArticleQueryService
;
import
org.b3log.solo.service.OptionQueryService
;
import
org.b3log.solo.service.OptionQueryService
;
import
org.b3log.solo.util.Markdowns
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
...
@@ -59,7 +60,7 @@ import java.util.List;
...
@@ -59,7 +60,7 @@ import java.util.List;
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/feroozkhanchintu">feroozkhanchintu</a>
* @author <a href="https://github.com/feroozkhanchintu">feroozkhanchintu</a>
* @author <a href="https://github.com/nanolikeyou">nanolikeyou</a>
* @author <a href="https://github.com/nanolikeyou">nanolikeyou</a>
* @version 2.0.0.
2, May 15
, 2019
* @version 2.0.0.
3, Jul 29
, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -189,27 +190,22 @@ public class FeedProcessor {
...
@@ -189,27 +190,22 @@ public class FeedProcessor {
channel
.
setLastBuildDate
(
new
Date
());
channel
.
setLastBuildDate
(
new
Date
());
channel
.
setLink
(
Latkes
.
getServePath
());
channel
.
setLink
(
Latkes
.
getServePath
());
channel
.
setAtomLink
(
Latkes
.
getServePath
()
+
"/rss.xml"
);
channel
.
setAtomLink
(
Latkes
.
getServePath
()
+
"/rss.xml"
);
channel
.
setGenerator
(
"Solo, v
er "
+
SoloServletListener
.
VERSION
);
channel
.
setGenerator
(
"Solo, v
"
+
SoloServletListener
.
VERSION
+
", https://solo.b3log.org"
);
final
String
localeString
=
preference
.
getString
(
Option
.
ID_C_LOCALE_STRING
);
final
String
localeString
=
preference
.
getString
(
Option
.
ID_C_LOCALE_STRING
);
final
String
country
=
Locales
.
getCountry
(
localeString
).
toLowerCase
();
final
String
country
=
Locales
.
getCountry
(
localeString
).
toLowerCase
();
final
String
language
=
Locales
.
getLanguage
(
localeString
).
toLowerCase
();
final
String
language
=
Locales
.
getLanguage
(
localeString
).
toLowerCase
();
channel
.
setLanguage
(
language
+
'-'
+
country
);
channel
.
setLanguage
(
language
+
'-'
+
country
);
channel
.
setDescription
(
blogSubtitle
);
channel
.
setDescription
(
blogSubtitle
);
final
List
<
Filter
>
filters
=
new
ArrayList
<>();
final
List
<
Filter
>
filters
=
new
ArrayList
<>();
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_STATUS
,
FilterOperator
.
EQUAL
,
Article
.
ARTICLE_STATUS_C_PUBLISHED
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_STATUS
,
FilterOperator
.
EQUAL
,
Article
.
ARTICLE_STATUS_C_PUBLISHED
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
final
Query
query
=
new
Query
().
setPageCount
(
1
).
setPage
(
1
,
outputCnt
).
final
Query
query
=
new
Query
().
setPageCount
(
1
).
setPage
(
1
,
outputCnt
).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
addSort
(
Article
.
ARTICLE_UPDATED
,
SortDirection
.
DESCENDING
);
addSort
(
Article
.
ARTICLE_UPDATED
,
SortDirection
.
DESCENDING
);
final
JSONObject
articleResult
=
articleRepository
.
get
(
query
);
final
JSONObject
articleResult
=
articleRepository
.
get
(
query
);
final
JSONArray
articles
=
articleResult
.
getJSONArray
(
Keys
.
RESULTS
);
final
JSONArray
articles
=
articleResult
.
getJSONArray
(
Keys
.
RESULTS
);
final
boolean
isFullContent
=
"fullContent"
.
equals
(
preference
.
getString
(
Option
.
ID_C_FEED_OUTPUT_MODE
));
final
boolean
isFullContent
=
"fullContent"
.
equals
(
preference
.
getString
(
Option
.
ID_C_FEED_OUTPUT_MODE
));
for
(
int
i
=
0
;
i
<
articles
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
articles
.
length
();
i
++)
{
final
Item
item
=
getItem
(
articles
,
isFullContent
,
i
);
final
Item
item
=
getItem
(
articles
,
isFullContent
,
i
);
channel
.
addItem
(
item
);
channel
.
addItem
(
item
);
...
@@ -223,8 +219,7 @@ public class FeedProcessor {
...
@@ -223,8 +219,7 @@ public class FeedProcessor {
}
}
}
}
private
Item
getItem
(
final
JSONArray
articles
,
final
boolean
isFullContent
,
int
i
)
private
Item
getItem
(
final
JSONArray
articles
,
final
boolean
isFullContent
,
int
i
)
throws
JSONException
,
ServiceException
{
throws
JSONException
,
ServiceException
{
final
JSONObject
article
=
articles
.
getJSONObject
(
i
);
final
JSONObject
article
=
articles
.
getJSONObject
(
i
);
final
Item
ret
=
new
Item
();
final
Item
ret
=
new
Item
();
String
title
=
article
.
getString
(
Article
.
ARTICLE_TITLE
);
String
title
=
article
.
getString
(
Article
.
ARTICLE_TITLE
);
...
@@ -234,6 +229,7 @@ public class FeedProcessor {
...
@@ -234,6 +229,7 @@ public class FeedProcessor {
?
article
.
getString
(
Article
.
ARTICLE_CONTENT
)
?
article
.
getString
(
Article
.
ARTICLE_CONTENT
)
:
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
);
:
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
);
description
=
EmojiParser
.
parseToAliases
(
description
);
description
=
EmojiParser
.
parseToAliases
(
description
);
description
=
Markdowns
.
toHTML
(
description
);
ret
.
setDescription
(
description
);
ret
.
setDescription
(
description
);
final
long
pubDate
=
article
.
getLong
(
Article
.
ARTICLE_UPDATED
);
final
long
pubDate
=
article
.
getLong
(
Article
.
ARTICLE_UPDATED
);
ret
.
setPubDate
(
new
Date
(
pubDate
));
ret
.
setPubDate
(
new
Date
(
pubDate
));
...
...
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