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
b1b78109
Unverified
Commit
b1b78109
authored
Feb 06, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
#12637
parent
70e83321
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
104 deletions
+34
-104
src/main/java/org/b3log/solo/model/Article.java
src/main/java/org/b3log/solo/model/Article.java
+1
-6
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+1
-24
src/main/java/org/b3log/solo/model/Page.java
src/main/java/org/b3log/solo/model/Page.java
+1
-6
src/main/java/org/b3log/solo/processor/PageProcessor.java
src/main/java/org/b3log/solo/processor/PageProcessor.java
+7
-11
src/main/java/org/b3log/solo/processor/api/B3ArticleReceiver.java
.../java/org/b3log/solo/processor/api/B3ArticleReceiver.java
+3
-5
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
+1
-10
src/main/java/org/b3log/solo/service/ArticleQueryService.java
...main/java/org/b3log/solo/service/ArticleQueryService.java
+19
-27
src/main/resources/repository.json
src/main/resources/repository.json
+1
-15
No files found.
src/main/java/org/b3log/solo/model/Article.java
View file @
b1b78109
...
@@ -25,7 +25,7 @@ import org.jsoup.safety.Whitelist;
...
@@ -25,7 +25,7 @@ import org.jsoup.safety.Whitelist;
* This class defines all article model relevant keys.
* This class defines all article model relevant keys.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.0.
0, Sep 16, 2018
* @version 1.2.0.
1, Feb 6, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Article
{
public
final
class
Article
{
...
@@ -155,11 +155,6 @@ public final class Article {
...
@@ -155,11 +155,6 @@ public final class Article {
*/
*/
public
static
final
String
ARTICLE_VIEW_PWD
=
"articleViewPwd"
;
public
static
final
String
ARTICLE_VIEW_PWD
=
"articleViewPwd"
;
/**
* Key of article editor type.
*/
public
static
final
String
ARTICLE_EDITOR_TYPE
=
"articleEditorType"
;
//// constants
//// constants
/**
/**
...
...
src/main/java/org/b3log/solo/model/Option.java
View file @
b1b78109
...
@@ -30,7 +30,7 @@ import java.util.Set;
...
@@ -30,7 +30,7 @@ import java.util.Set;
*
*
* @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/hzchendou">hzchendou</a>
* @author <a href="https://github.com/hzchendou">hzchendou</a>
* @version 1.5.0.
1, Jan 28
, 2019
* @version 1.5.0.
2, Feb 6
, 2019
* @since 0.6.0
* @since 0.6.0
*/
*/
public
final
class
Option
{
public
final
class
Option
{
...
@@ -266,19 +266,6 @@ public final class Option {
...
@@ -266,19 +266,6 @@ public final class Option {
*/
*/
public
static
final
String
ID_C_FEED_OUTPUT_CNT
=
"feedOutputCnt"
;
public
static
final
String
ID_C_FEED_OUTPUT_CNT
=
"feedOutputCnt"
;
/**
* Key of editor type.
* <p>
* Optional values:
* <ul>
* <li>"tinyMCE"</li>
* <li>"CodeMirror-Markdown"</li>
* <li>"KindEditor"</li>
* </ul>
* </p>
*/
public
static
final
String
ID_C_EDITOR_TYPE
=
"editorType"
;
/**
/**
* Key of skins.
* Key of skins.
*/
*/
...
@@ -555,16 +542,6 @@ public final class Option {
...
@@ -555,16 +542,6 @@ public final class Option {
*/
*/
public
static
final
int
DEFAULT_FEED_OUTPUT_CNT
=
10
;
public
static
final
int
DEFAULT_FEED_OUTPUT_CNT
=
10
;
/**
* Default editor type.
*/
public
static
final
String
DEFAULT_EDITOR_TYPE
=
"CodeMirror-Markdown"
;
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
DefaultPreference
.
class
);
static
{
static
{
final
JSONArray
signs
=
new
JSONArray
();
final
JSONArray
signs
=
new
JSONArray
();
final
int
signLength
=
4
;
final
int
signLength
=
4
;
...
...
src/main/java/org/b3log/solo/model/Page.java
View file @
b1b78109
...
@@ -21,7 +21,7 @@ package org.b3log.solo.model;
...
@@ -21,7 +21,7 @@ package org.b3log.solo.model;
* This class defines all page model relevant keys.
* This class defines all page model relevant keys.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.
0, Sep 21, 2017
* @version 1.1.0.
1, Feb 6, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Page
{
public
final
class
Page
{
...
@@ -106,11 +106,6 @@ public final class Page {
...
@@ -106,11 +106,6 @@ public final class Page {
*/
*/
public
static
final
String
PAGE_OPEN_TARGET
=
"pageOpenTarget"
;
public
static
final
String
PAGE_OPEN_TARGET
=
"pageOpenTarget"
;
/**
* Key of page editor type.
*/
public
static
final
String
PAGE_EDITOR_TYPE
=
"pageEditorType"
;
/**
/**
* Key of icon URL.
* Key of icon URL.
*/
*/
...
...
src/main/java/org/b3log/solo/processor/PageProcessor.java
View file @
b1b78109
...
@@ -48,7 +48,7 @@ import java.util.Map;
...
@@ -48,7 +48,7 @@ import java.util.Map;
* Page processor.
* Page processor.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.
9, Jan 5
, 2019
* @version 1.1.0.
10, Feb 6
, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -128,16 +128,12 @@ public class PageProcessor {
...
@@ -128,16 +128,12 @@ public class PageProcessor {
dataModel
.
put
(
Page
.
PAGE_COMMENTS_REF
,
comments
);
dataModel
.
put
(
Page
.
PAGE_COMMENTS_REF
,
comments
);
// Markdown
// Markdown
if
(
"CodeMirror-Markdown"
.
equals
(
page
.
optString
(
Page
.
PAGE_EDITOR_TYPE
)))
{
Stopwatchs
.
start
(
"Markdown Page [id="
+
page
.
optString
(
Keys
.
OBJECT_ID
)
+
"]"
);
Stopwatchs
.
start
(
"Markdown Page[id="
+
page
.
optString
(
Keys
.
OBJECT_ID
)
+
"]"
);
String
content
=
page
.
optString
(
Page
.
PAGE_CONTENT
);
String
content
=
page
.
optString
(
Page
.
PAGE_CONTENT
);
content
=
Emotions
.
convert
(
content
);
content
=
Emotions
.
convert
(
content
);
content
=
Markdowns
.
toHTML
(
content
);
content
=
Markdowns
.
toHTML
(
content
);
page
.
put
(
Page
.
PAGE_CONTENT
,
content
);
page
.
put
(
Page
.
PAGE_CONTENT
,
content
);
Stopwatchs
.
end
();
Stopwatchs
.
end
();
}
dataModelService
.
fillCommon
(
context
,
dataModel
,
preference
);
dataModelService
.
fillCommon
(
context
,
dataModel
,
preference
);
statisticMgmtService
.
incBlogViewCount
(
context
,
response
);
statisticMgmtService
.
incBlogViewCount
(
context
,
response
);
...
...
src/main/java/org/b3log/solo/processor/api/B3ArticleReceiver.java
View file @
b1b78109
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
* Receiving articles from B3log community. Visits <a href="https://hacpai.com/b3log">B3log 构思</a> for more details.
* Receiving articles from B3log community. Visits <a href="https://hacpai.com/b3log">B3log 构思</a> for more details.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.4.
3, Sep 25, 2018
* @version 1.0.4.
4, Feb 6, 2019
* @since 0.5.5
* @since 0.5.5
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -87,8 +87,7 @@ public class B3ArticleReceiver {
...
@@ -87,8 +87,7 @@ public class B3ArticleReceiver {
* "articleTitle": "",
* "articleTitle": "",
* "articleContent": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "userB3Key": ""
* "articleEditorType": ""
* }
* }
* }
* }
* </pre>
* </pre>
...
@@ -165,8 +164,7 @@ public class B3ArticleReceiver {
...
@@ -165,8 +164,7 @@ public class B3ArticleReceiver {
* "articleTitle": "",
* "articleTitle": "",
* "articleContent": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "userB3Key": ""
* "articleEditorType": ""
* }
* }
* }
* }
* </pre>
* </pre>
...
...
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
View file @
b1b78109
...
@@ -317,11 +317,6 @@ public class ArticleMgmtService {
...
@@ -317,11 +317,6 @@ public class ArticleMgmtService {
}
}
}
}
// Set editor type
if
(!
article
.
has
(
Article
.
ARTICLE_EDITOR_TYPE
))
{
article
.
put
(
Article
.
ARTICLE_EDITOR_TYPE
,
preference
.
optString
(
Option
.
ID_C_EDITOR_TYPE
));
}
final
boolean
publishNewArticle
=
!
oldArticle
.
getBoolean
(
ARTICLE_IS_PUBLISHED
)
&&
article
.
getBoolean
(
ARTICLE_IS_PUBLISHED
);
final
boolean
publishNewArticle
=
!
oldArticle
.
getBoolean
(
ARTICLE_IS_PUBLISHED
)
&&
article
.
getBoolean
(
ARTICLE_IS_PUBLISHED
);
// Update
// Update
...
@@ -381,7 +376,7 @@ public class ArticleMgmtService {
...
@@ -381,7 +376,7 @@ public class ArticleMgmtService {
* "articleSignId": "" // optional, default is "0",
* "articleSignId": "" // optional, default is "0",
* "articleCommentable": boolean,
* "articleCommentable": boolean,
* "articleViewPwd": "",
* "articleViewPwd": "",
* "articleEditorType": "", // optional
, preference specified if not exists this key
* "articleEditorType": "", // optional
* "oId": "" // optional, generate it if not exists this key
* "oId": "" // optional, generate it if not exists this key
* }
* }
* }
* }
...
@@ -460,10 +455,6 @@ public class ArticleMgmtService {
...
@@ -460,10 +455,6 @@ public class ArticleMgmtService {
final
boolean
postToCommunity
=
article
.
optBoolean
(
Common
.
POST_TO_COMMUNITY
,
true
);
final
boolean
postToCommunity
=
article
.
optBoolean
(
Common
.
POST_TO_COMMUNITY
,
true
);
article
.
remove
(
Common
.
POST_TO_COMMUNITY
);
// Do not persist this property
article
.
remove
(
Common
.
POST_TO_COMMUNITY
);
// Do not persist this property
if
(!
article
.
has
(
Article
.
ARTICLE_EDITOR_TYPE
))
{
article
.
put
(
Article
.
ARTICLE_EDITOR_TYPE
,
preference
.
optString
(
Option
.
ID_C_EDITOR_TYPE
));
}
articleRepository
.
add
(
article
);
articleRepository
.
add
(
article
);
article
.
put
(
Common
.
POST_TO_COMMUNITY
,
postToCommunity
);
// Restores the property
article
.
put
(
Common
.
POST_TO_COMMUNITY
,
postToCommunity
);
// Restores the property
...
...
src/main/java/org/b3log/solo/service/ArticleQueryService.java
View file @
b1b78109
...
@@ -53,7 +53,7 @@ import static org.b3log.solo.model.Article.*;
...
@@ -53,7 +53,7 @@ import static org.b3log.solo.model.Article.*;
* @author <a href="http://blog.sweelia.com">ArmstrongCN</a>
* @author <a href="http://blog.sweelia.com">ArmstrongCN</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.2.
8, Jan 15
, 2019
* @version 1.3.2.
9, Feb 6
, 2019
* @since 0.3.5
* @since 0.3.5
*/
*/
@Service
@Service
...
@@ -976,9 +976,8 @@ public class ArticleQueryService {
...
@@ -976,9 +976,8 @@ public class ArticleQueryService {
if
(
null
!=
context
&&
Solos
.
needViewPwd
(
context
.
getRequest
(),
context
.
getResponse
(),
article
))
{
if
(
null
!=
context
&&
Solos
.
needViewPwd
(
context
.
getRequest
(),
context
.
getResponse
(),
article
))
{
final
String
content
=
langPropsService
.
get
(
"articleContentPwd"
);
final
String
content
=
langPropsService
.
get
(
"articleContentPwd"
);
article
.
put
(
ARTICLE_CONTENT
,
content
);
article
.
put
(
ARTICLE_CONTENT
,
content
);
}
else
if
(
"CodeMirror-Markdown"
.
equals
(
article
.
optString
(
ARTICLE_EDITOR_TYPE
)))
{
}
else
{
// Markdown to HTML for content and abstract
// Markdown to HTML for content and abstract
Stopwatchs
.
start
(
"Get Article Content [Markdown]"
);
Stopwatchs
.
start
(
"Get Article Content [Markdown]"
);
String
content
=
article
.
optString
(
ARTICLE_CONTENT
);
String
content
=
article
.
optString
(
ARTICLE_CONTENT
);
...
@@ -1000,9 +999,8 @@ public class ArticleQueryService {
...
@@ -1000,9 +999,8 @@ public class ArticleQueryService {
* Converts the content and abstract for each of the specified articles to HTML if that is saved by Markdown editor.
* Converts the content and abstract for each of the specified articles to HTML if that is saved by Markdown editor.
*
*
* @param articles the specified articles
* @param articles the specified articles
* @throws Exception exception
*/
*/
public
void
markdowns
(
final
List
<
JSONObject
>
articles
)
throws
Exception
{
public
void
markdowns
(
final
List
<
JSONObject
>
articles
)
{
for
(
final
JSONObject
article
:
articles
)
{
for
(
final
JSONObject
article
:
articles
)
{
markdown
(
article
);
markdown
(
article
);
}
}
...
@@ -1012,21 +1010,16 @@ public class ArticleQueryService {
...
@@ -1012,21 +1010,16 @@ public class ArticleQueryService {
* Converts the content and abstract for the specified article to HTML if it is saved by Markdown editor.
* Converts the content and abstract for the specified article to HTML if it is saved by Markdown editor.
*
*
* @param article the specified article
* @param article the specified article
* @throws Exception exception
*/
*/
public
void
markdown
(
final
JSONObject
article
)
throws
Exception
{
public
void
markdown
(
final
JSONObject
article
)
{
if
(
"CodeMirror-Markdown"
.
equals
(
article
.
optString
(
ARTICLE_EDITOR_TYPE
)))
{
Stopwatchs
.
start
(
"Markdown Article [id="
+
article
.
optString
(
Keys
.
OBJECT_ID
)
+
"]"
);
Stopwatchs
.
start
(
"Markdown Article[id="
+
article
.
optString
(
Keys
.
OBJECT_ID
)
+
"]"
);
Stopwatchs
.
start
(
"Content"
);
String
content
=
article
.
optString
(
ARTICLE_CONTENT
);
String
content
=
article
.
optString
(
ARTICLE_CONTENT
);
content
=
Emotions
.
convert
(
content
);
content
=
Emotions
.
convert
(
content
);
content
=
Markdowns
.
toHTML
(
content
);
content
=
Markdowns
.
toHTML
(
content
);
article
.
put
(
ARTICLE_CONTENT
,
content
);
article
.
put
(
ARTICLE_CONTENT
,
content
);
Stopwatchs
.
end
();
String
abstractContent
=
article
.
optString
(
ARTICLE_ABSTRACT
);
String
abstractContent
=
article
.
optString
(
ARTICLE_ABSTRACT
);
if
(
StringUtils
.
isNotBlank
(
abstractContent
))
{
if
(
StringUtils
.
isNotBlank
(
abstractContent
))
{
Stopwatchs
.
start
(
"Abstract"
);
Stopwatchs
.
start
(
"Abstract"
);
abstractContent
=
Emotions
.
convert
(
abstractContent
);
abstractContent
=
Emotions
.
convert
(
abstractContent
);
...
@@ -1037,7 +1030,6 @@ public class ArticleQueryService {
...
@@ -1037,7 +1030,6 @@ public class ArticleQueryService {
Stopwatchs
.
end
();
Stopwatchs
.
end
();
}
}
}
/**
/**
* Removes unused properties of each article in the specified articles.
* Removes unused properties of each article in the specified articles.
...
...
src/main/resources/repository.json
View file @
b1b78109
{
{
"description"
:
"Description of repository structures, for generation of the relational database table and persistence validation."
,
"description"
:
"Description of repository structures, for generation of the relational database table and persistence validation."
,
"version"
:
"3.2.1.
2, Jan 28
, 2019"
,
"version"
:
"3.2.1.
3, Feb 6
, 2019"
,
"authors"
:
[
"authors"
:
[
"Liang Ding"
"Liang Ding"
],
],
...
@@ -280,13 +280,6 @@
...
@@ -280,13 +280,6 @@
"type"
:
"String"
,
"type"
:
"String"
,
"length"
:
255
"length"
:
255
},
},
{
"name"
:
"pageEditorType"
,
"description"
:
"页面编辑器类型,目前仅支持 CodeMirror-Markdown"
,
"type"
:
"String"
,
"length"
:
20
,
"nullable"
:
true
},
{
{
"name"
:
"pageIcon"
,
"name"
:
"pageIcon"
,
"description"
:
"页面展示用小图标"
,
"description"
:
"页面展示用小图标"
,
...
@@ -530,13 +523,6 @@
...
@@ -530,13 +523,6 @@
"description"
:
"文章浏览密码,留空为不设置访问密码"
,
"description"
:
"文章浏览密码,留空为不设置访问密码"
,
"type"
:
"String"
,
"type"
:
"String"
,
"legnth"
:
255
"legnth"
:
255
},
{
"name"
:
"articleEditorType"
,
"description"
:
"文章编辑器类型,目前仅支持 CodeMirror-Markdown"
,
"type"
:
"String"
,
"length"
:
20
,
"nullable"
:
true
}
}
]
]
},
},
...
...
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