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
9909b1c1
Commit
9909b1c1
authored
May 02, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'refs/remotes/origin/2.1.0-dev'
parents
8772454d
aeb7d1cf
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
143 deletions
+98
-143
README.md
README.md
+1
-3
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+71
-117
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+7
-13
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+17
-10
src/main/webapp/admin-preference.ftl
src/main/webapp/admin-preference.ftl
+2
-0
No files found.
README.md
View file @
9909b1c1
...
...
@@ -27,7 +27,7 @@
Solo 沉淀至今的
**每一个功能你应该都会用到**
。我们不会将只有“20%”用户使用的功能添加进来,只有这样才能保持博客系统本该有的纯净,足够轻量才能带来简约的使用体验。
*
Markdown /
TinyMCE / KindEditor /
Emoji
*
Markdown / Emoji
*
[
聚合分类
](
https://github.com/b3log/solo/issues/12256
)
/ 标签
*
自定义导航(页面、链接)
*
草稿夹
...
...
@@ -111,8 +111,6 @@ Solo 的诞生离不开以下开源项目:
*
[
jQuery
](
https://github.com/jquery/jquery
)
:使用最广泛的 JavaScript 工具库
*
[
CodeMirror
](
https://github.com/codemirror/CodeMirror
)
:Markdown 编辑器内核
*
[
KindEditor
](
https://github.com/kindsoft/kindeditor
)
:一个富文本编辑器
*
[
TinyMCE
](
https://github.com/tinymce/tinymce
)
:又一个富文本编辑器
*
[
SyntaxHighlighter
](
https://github.com/syntaxhighlighter/syntaxhighlighter
)
:一个代码高亮库
*
[
Highlight.js
](
https://github.com/isagalaev/highlight.js
)
:又一个代码高亮库
*
[
emojify.js
](
https://github.com/Ranks/emojify.js
)
:前端 Emoji 处理库
...
...
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
9909b1c1
This diff is collapsed.
Click to expand it.
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
9909b1c1
...
...
@@ -48,7 +48,7 @@ import static org.b3log.solo.util.Skins.setDirectoryForTemplateLoading;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.2.1
1, Feb 18
, 2017
* @version 1.3.2.1
2, May 2
, 2017
* @since 0.4.0
*/
@Service
...
...
@@ -57,7 +57,7 @@ public class PreferenceMgmtService {
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PreferenceMgmtService
.
class
.
getName
()
);
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PreferenceMgmtService
.
class
);
/**
* Preference query service.
...
...
@@ -79,7 +79,6 @@ public class PreferenceMgmtService {
/**
* Loads skins for the specified preference and initializes templates loading.
*
* <p>
* If the skins directory has been changed, persists the change into preference.
* </p>
...
...
@@ -120,14 +119,13 @@ public class PreferenceMgmtService {
if
(!
skinDirNames
.
contains
(
currentSkinDirName
))
{
LOGGER
.
log
(
Level
.
WARN
,
"Configred skin[dirName={0}] can not find, try to use "
+
"default skin[dirName="
+
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
+
"] instead."
,
currentSkinDirName
);
+
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
+
"] instead."
,
currentSkinDirName
);
if
(!
skinDirNames
.
contains
(
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
))
{
LOGGER
.
log
(
Level
.
ERROR
,
"Can not find skin[dirName="
+
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
+
"]"
);
throw
new
IllegalStateException
(
"Can not find default skin[dirName="
+
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
+
"], please redeploy your Solo and make sure contains this default skin!"
);
+
"], please redeploy your Solo and make sure contains this default skin!"
);
}
preference
.
put
(
SKIN_DIR_NAME
,
Option
.
DefaultPreference
.
DEFAULT_SKIN_DIR_NAME
);
...
...
@@ -137,7 +135,6 @@ public class PreferenceMgmtService {
}
final
String
skinsString
=
skinArray
.
toString
();
if
(!
skinsString
.
equals
(
preference
.
getString
(
SKINS
)))
{
LOGGER
.
debug
(
"The skins directory has been changed, persists the change into preference"
);
preference
.
put
(
SKINS
,
skinsString
);
...
...
@@ -147,7 +144,6 @@ public class PreferenceMgmtService {
setDirectoryForTemplateLoading
(
preference
.
getString
(
SKIN_DIR_NAME
));
final
String
localeString
=
preference
.
getString
(
Option
.
ID_C_LOCALE_STRING
);
if
(
"zh_CN"
.
equals
(
localeString
))
{
TimeZones
.
setTimeZone
(
"Asia/Shanghai"
);
}
...
...
@@ -193,9 +189,7 @@ public class PreferenceMgmtService {
* @throws ServiceException service exception
*/
public
void
updatePreference
(
final
JSONObject
preference
)
throws
ServiceException
{
@SuppressWarnings
(
"unchecked"
)
final
Iterator
<
String
>
keys
=
preference
.
keys
();
while
(
keys
.
hasNext
())
{
final
String
key
=
keys
.
next
();
...
...
@@ -216,11 +210,9 @@ public class PreferenceMgmtService {
for
(
final
String
dirName
:
skinDirNames
)
{
final
JSONObject
skin
=
new
JSONObject
();
skinArray
.
put
(
skin
);
final
String
name
=
Latkes
.
getSkinName
(
dirName
);
skin
.
put
(
Skin
.
SKIN_NAME
,
name
);
skin
.
put
(
Skin
.
SKIN_DIR_NAME
,
dirName
);
}
...
...
@@ -280,7 +272,9 @@ public class PreferenceMgmtService {
optionRepository
.
update
(
Option
.
ID_C_COMMENTABLE
,
commentableOpt
);
final
JSONObject
editorTypeOpt
=
optionRepository
.
get
(
Option
.
ID_C_EDITOR_TYPE
);
editorTypeOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_EDITOR_TYPE
));
// https://github.com/b3log/solo/issues/12285
// editorTypeOpt.put(Option.OPTION_VALUE, preference.optString(Option.ID_C_EDITOR_TYPE));
editorTypeOpt
.
put
(
Option
.
OPTION_VALUE
,
Option
.
DefaultPreference
.
DEFAULT_EDITOR_TYPE
);
optionRepository
.
update
(
Option
.
ID_C_EDITOR_TYPE
,
editorTypeOpt
);
final
JSONObject
enableArticleUpdateHintOpt
=
optionRepository
.
get
(
Option
.
ID_C_ENABLE_ARTICLE_UPDATE_HINT
);
...
...
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
9909b1c1
...
...
@@ -51,7 +51,7 @@ import java.sql.Statement;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</a>
* @version 1.2.0.1
1, Apr 10
, 2017
* @version 1.2.0.1
2, May 2
, 2017
* @since 1.2.0
*/
@Service
...
...
@@ -61,51 +61,62 @@ public class UpgradeService {
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
UpgradeService
.
class
);
/**
* Step for article updating.
*/
private
static
final
int
STEP
=
50
;
/**
* Mail Service.
*/
private
static
final
MailService
MAIL_SVC
=
MailServiceFactory
.
getMailService
();
/**
* Old version.
*/
private
static
final
String
FROM_VER
=
"1.9.0"
;
/**
* New version.
*/
private
static
final
String
TO_VER
=
SoloServletListener
.
VERSION
;
/**
* Whether the email has been sent.
*/
private
static
boolean
sent
=
false
;
/**
* Article repository.
*/
@Inject
private
ArticleRepository
articleRepository
;
/**
* Comment repository.
*/
@Inject
private
CommentRepository
commentRepository
;
/**
* User repository.
*/
@Inject
private
UserRepository
userRepository
;
/**
* Option repository.
*/
@Inject
private
OptionRepository
optionRepository
;
/**
* Preference Query Service.
*/
@Inject
private
PreferenceQueryService
preferenceQueryService
;
/**
* Language service.
*/
...
...
@@ -137,7 +148,6 @@ public class UpgradeService {
if
(!
sent
)
{
notifyUserByEmail
();
sent
=
true
;
}
}
catch
(
final
Exception
e
)
{
...
...
@@ -158,7 +168,6 @@ public class UpgradeService {
LOGGER
.
log
(
Level
.
INFO
,
"Upgrading from version [{0}] to version [{1}]...."
,
FROM_VER
,
TO_VER
);
Transaction
transaction
=
null
;
try
{
final
Connection
connection
=
Connections
.
getConnection
();
final
Statement
statement
=
connection
.
createStatement
();
...
...
@@ -189,6 +198,11 @@ public class UpgradeService {
versionOpt
.
put
(
Option
.
OPTION_VALUE
,
TO_VER
);
optionRepository
.
update
(
Option
.
ID_C_VERSION
,
versionOpt
);
// https://github.com/b3log/solo/issues/12285
// final JSONObject editorTypeOpt = optionRepository.get(Option.ID_C_EDITOR_TYPE);
// editorTypeOpt.put(Option.OPTION_VALUE, Option.DefaultPreference.DEFAULT_EDITOR_TYPE);
// optionRepository.update(Option.ID_C_EDITOR_TYPE, editorTypeOpt);
transaction
.
commit
();
LOGGER
.
log
(
Level
.
INFO
,
"Updated preference"
);
...
...
@@ -218,11 +232,9 @@ public class UpgradeService {
for
(
int
i
=
0
;
i
<
users
.
length
();
i
++)
{
final
JSONObject
user
=
users
.
getJSONObject
(
i
);
final
String
email
=
user
.
optString
(
User
.
USER_EMAIL
);
user
.
put
(
UserExt
.
USER_AVATAR
,
Thumbnails
.
getGravatarURL
(
email
,
"128"
));
userRepository
.
update
(
user
.
optString
(
Keys
.
OBJECT_ID
),
user
);
LOGGER
.
log
(
Level
.
INFO
,
"Updated user[email={0}]"
,
email
);
}
}
...
...
@@ -236,14 +248,12 @@ public class UpgradeService {
LOGGER
.
log
(
Level
.
INFO
,
"Adds a property [articleEditorType] to each of articles"
);
final
JSONArray
articles
=
articleRepository
.
get
(
new
Query
()).
getJSONArray
(
Keys
.
RESULTS
);
if
(
articles
.
length
()
<=
0
)
{
LOGGER
.
log
(
Level
.
TRACE
,
"No articles"
);
return
;
}
Transaction
transaction
=
null
;
try
{
for
(
int
i
=
0
;
i
<
articles
.
length
();
i
++)
{
if
(
0
==
i
%
STEP
||
!
transaction
.
isActive
())
{
...
...
@@ -251,9 +261,7 @@ public class UpgradeService {
}
final
JSONObject
article
=
articles
.
getJSONObject
(
i
);
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
LOGGER
.
log
(
Level
.
INFO
,
"Found an article[id={0}]"
,
articleId
);
article
.
put
(
Article
.
ARTICLE_EDITOR_TYPE
,
"tinyMCE"
);
...
...
@@ -296,7 +304,6 @@ public class UpgradeService {
message
.
setHtmlBody
(
langPropsService
.
get
(
"skipVersionMailBody"
));
MAIL_SVC
.
send
(
message
);
LOGGER
.
info
(
"Send an email to the user who upgrades Solo with a discontinuous version."
);
}
}
src/main/webapp/admin-preference.ftl
View file @
9909b1c1
...
...
@@ -161,6 +161,7 @@
</select>
</td>
</tr>
<#-- https://github.com/b3log/solo/issues/12285
<tr>
<th>
<label for="editorType">${editType1Label}</label>
...
...
@@ -173,6 +174,7 @@
</select>
</td>
</tr>
-->
<tr>
<th>
<label for="articleListDisplay">${articleListDisplay1Label}</label>
...
...
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