Commit 011b3a53 authored by Liang Ding's avatar Liang Ding

🎨 #12825

parent c7c00323
...@@ -163,6 +163,7 @@ public class PreferenceConsole { ...@@ -163,6 +163,7 @@ public class PreferenceConsole {
* "feedOutputCnt": int, * "feedOutputCnt": int,
* "faviconURL": "", * "faviconURL": "",
* "syncGitHub": boolean, * "syncGitHub": boolean,
* "pullGitHub": boolean,
* "customVars" "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535 * "customVars" "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535
* } * }
* } * }
...@@ -240,6 +241,7 @@ public class PreferenceConsole { ...@@ -240,6 +241,7 @@ public class PreferenceConsole {
* "feedOutputCnt": int, * "feedOutputCnt": int,
* "faviconURL": "", * "faviconURL": "",
* "syncGitHub": boolean, * "syncGitHub": boolean,
* "pullGitHub": boolean,
* "customVars" "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535 * "customVars" "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535
* } * }
* } * }
......
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.b3log.solo.upgrade;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.ArticleRepository;
import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.util.Images;
import org.json.JSONObject;
import java.util.List;
/**
* Upgrade script from v3.6.3 to v3.6.4.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Aug 18, 2019
* @since 3.6.4
*/
public final class V363_364 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V363_364.class);
/**
* Performs upgrade from v3.6.3 to v3.6.4.
*
* @throws Exception upgrade fails
*/
public static void perform() throws Exception {
final String fromVer = "3.6.3";
final String toVer = "3.6.4";
LOGGER.log(Level.INFO, "Upgrading from version [" + fromVer + "] to version [" + toVer + "]....");
final BeanManager beanManager = BeanManager.getInstance();
final OptionRepository optionRepository = beanManager.getReference(OptionRepository.class);
try {
final Transaction transaction = optionRepository.beginTransaction();
final JSONObject versionOpt = optionRepository.get(Option.ID_C_VERSION);
versionOpt.put(Option.OPTION_VALUE, toVer);
optionRepository.update(Option.ID_C_VERSION, versionOpt);
JSONObject pullGitHubOpt = optionRepository.get(Option.ID_C_PULL_GITHUB);
if (null == pullGitHubOpt) {
pullGitHubOpt = new JSONObject();
pullGitHubOpt.put(Keys.OBJECT_ID, Option.ID_C_PULL_GITHUB);
pullGitHubOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
pullGitHubOpt.put(Option.OPTION_VALUE, Option.DefaultPreference.DEFAULT_PULL_GITHUB);
optionRepository.add(pullGitHubOpt);
}
transaction.commit();
LOGGER.log(Level.INFO, "Upgraded from version [" + fromVer + "] to version [" + toVer + "] successfully");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Upgrade failed!", e);
throw new Exception("Upgrade failed from version [" + fromVer + "] to version [" + toVer + "]");
}
}
}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# #
# Description: Solo language configurations(en_US). # Description: Solo language configurations(en_US).
# Version: 2.33.0.3, May 29, 2019 # Version: 2.34.0.0, Aug 18, 2019
# Author: Liang Ding # Author: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# Author: Dongxu Wang # Author: Dongxu Wang
...@@ -31,6 +31,7 @@ hljsThemeLabel=hljs theme: ...@@ -31,6 +31,7 @@ hljsThemeLabel=hljs theme:
tocLabel=ToC tocLabel=ToC
removeUnusedArchivesLabel=Remove Unused Archives removeUnusedArchivesLabel=Remove Unused Archives
syncGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">Allow sync GitHub repo</a>: syncGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">Allow sync GitHub repo</a>:
pullGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">Allow pull GitHub repo</a>:
queryUserFailedLabel=Query user info failed queryUserFailedLabel=Query user info failed
commentContentLabel=Content commentContentLabel=Content
cancelLabel=Cancel cancelLabel=Cancel
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# #
# Description: Solo default language configurations(zh_CN). # Description: Solo default language configurations(zh_CN).
# Version: 2.33.0.3, May 29, 2019 # Version: 2.34.0.0, Aug 18, 2019
# Author: Liang Ding # Author: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# Author: Dongxu Wang # Author: Dongxu Wang
...@@ -31,6 +31,7 @@ hljsThemeLabel=\u4EE3\u7801\u9AD8\u4EAE\u4E3B\u9898\uFF1A ...@@ -31,6 +31,7 @@ hljsThemeLabel=\u4EE3\u7801\u9AD8\u4EAE\u4E3B\u9898\uFF1A
tocLabel=\u76EE\u5F55 tocLabel=\u76EE\u5F55
removeUnusedArchivesLabel=\u79FB\u9664\u672A\u4F7F\u7528\u5B58\u6863 removeUnusedArchivesLabel=\u79FB\u9664\u672A\u4F7F\u7528\u5B58\u6863
syncGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">\u5141\u8BB8\u540C\u6B65 GitHub \u4ED3\u5E93</a>\uFF1A syncGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">\u5141\u8BB8\u540C\u6B65 GitHub \u4ED3\u5E93</a>\uFF1A
pullGitHubLabel=<a href="https://hacpai.com/article/1557238327458" target="_blank">\u5141\u8BB8\u62C9\u53D6 GitHub \u4ED3\u5E93</a>\uFF1A
queryUserFailedLabel=\u67E5\u8BE2\u7528\u6237\u4FE1\u606F\u5931\u8D25 queryUserFailedLabel=\u67E5\u8BE2\u7528\u6237\u4FE1\u606F\u5931\u8D25
commentContentLabel=\u8BC4\u8BBA\u5185\u5BB9 commentContentLabel=\u8BC4\u8BBA\u5185\u5BB9
cancelLabel=\u53D6\u6D88 cancelLabel=\u53D6\u6D88
......
...@@ -229,6 +229,12 @@ ...@@ -229,6 +229,12 @@
<input id="syncGitHub" type="checkbox" class="normalInput"/> <input id="syncGitHub" type="checkbox" class="normalInput"/>
</div> </div>
</label> </label>
<label>
<div class="fn__flex-inline">
${pullGitHubLabel}
<input id="pullGitHub" type="checkbox" class="normalInput"/>
</div>
</label>
<button class="fn__right" onclick="admin.preference.update()">${updateLabel}</button> <button class="fn__right" onclick="admin.preference.update()">${updateLabel}</button>
<div class="fn__clear"></div> <div class="fn__clear"></div>
</div> </div>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.2, Mar 19, 2019 * @version 1.3.0.3, Aug 18, 2019
*/ */
/* preference 相关操作 */ /* preference 相关操作 */
...@@ -76,6 +76,7 @@ admin.preference = { ...@@ -76,6 +76,7 @@ admin.preference = {
'true' === preference.allowVisitDraftViaPermalink ? $('#allowVisitDraftViaPermalink').attr('checked', 'checked') : $('allowVisitDraftViaPermalink').removeAttr('checked') 'true' === preference.allowVisitDraftViaPermalink ? $('#allowVisitDraftViaPermalink').attr('checked', 'checked') : $('allowVisitDraftViaPermalink').removeAttr('checked')
'true' === preference.commentable ? $('#commentable').attr('checked', 'checked') : $('commentable').removeAttr('checked') 'true' === preference.commentable ? $('#commentable').attr('checked', 'checked') : $('commentable').removeAttr('checked')
'true' === preference.syncGitHub ? $('#syncGitHub').attr('checked', 'checked') : $('syncGitHub').removeAttr('checked') 'true' === preference.syncGitHub ? $('#syncGitHub').attr('checked', 'checked') : $('syncGitHub').removeAttr('checked')
'true' === preference.pullGitHub ? $('#pullGitHub').attr('checked', 'checked') : $('pullGitHub').removeAttr('checked')
admin.preference.locale = preference.localeString admin.preference.locale = preference.localeString
...@@ -224,6 +225,7 @@ admin.preference = { ...@@ -224,6 +225,7 @@ admin.preference = {
'feedOutputCnt': $('#feedOutputCnt').val(), 'feedOutputCnt': $('#feedOutputCnt').val(),
'faviconURL': $('#faviconURL').val(), 'faviconURL': $('#faviconURL').val(),
'syncGitHub': $('#syncGitHub').prop('checked'), 'syncGitHub': $('#syncGitHub').prop('checked'),
'pullGitHub': $('#pullGitHub').prop('checked'),
'commentable': $('#commentable').prop('checked'), 'commentable': $('#commentable').prop('checked'),
'customVars': $('#customVars').val(), 'customVars': $('#customVars').val(),
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment