Skip to content

Commit

Permalink
♻️ 移除默认的黑客派导航 Fix #165
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 9, 2020
1 parent 5f3f3d3 commit c2f4435
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/main/java/org/b3log/solo/service/InitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* Solo initialization service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.46, Jul 8, 2020
* @version 1.5.2.47, Jul 9, 2020
* @since 0.4.0
*/
@Service
Expand Down Expand Up @@ -150,11 +150,9 @@ public boolean isInited() {
LOGGER.log(Level.WARN, "Solo has not been initialized, please open your browser to init Solo");
printedInitMsg = true;
}

return inited;
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Check init failed", e);

System.exit(-1);
return false;
}
Expand All @@ -173,7 +171,6 @@ public void initTables() {
}
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Check tables failed, please make sure database existed and database configuration [jdbc.*] in local.props is correct [msg=" + e.getMessage() + "]");

System.exit(-1);
}

Expand Down Expand Up @@ -214,13 +211,11 @@ public void init(final JSONObject requestJSONObject) {
initStatistic();
initOptions(requestJSONObject);
initAdmin(requestJSONObject);
initLink();
helloWorld();

transaction.commit();
} catch (final Throwable e) {
LOGGER.log(Level.ERROR, "Initializes Solo failed", e);

System.exit(-1);
} finally {
if (transaction.isActive()) {
Expand Down Expand Up @@ -351,14 +346,12 @@ private JSONArray tag(final String[] tagTitles, final JSONObject article) throws
for (String tagTitle1 : tagTitles) {
final String tagTitle = tagTitle1.trim();
final JSONObject tag = new JSONObject();

LOGGER.log(Level.TRACE, "Found a new tag[title={}] in article[title={}]", tagTitle, article.optString(Article.ARTICLE_TITLE));
tag.put(Tag.TAG_TITLE, tagTitle);
final String tagId = tagRepository.add(tag);
tag.put(Keys.OBJECT_ID, tagId);
ret.put(tag);
}

return ret;
}

Expand All @@ -377,7 +370,6 @@ private JSONArray tag(final String[] tagTitles, final JSONObject article) throws
private void initAdmin(final JSONObject requestJSONObject) throws Exception {
LOGGER.debug("Initializing admin....");
final JSONObject admin = new JSONObject();

admin.put(User.USER_NAME, requestJSONObject.getString(User.USER_NAME));
admin.put(User.USER_URL, Latkes.getServePath());
admin.put(User.USER_ROLE, Role.ADMIN_ROLE);
Expand All @@ -389,25 +381,6 @@ private void initAdmin(final JSONObject requestJSONObject) throws Exception {
LOGGER.debug("Initialized admin");
}

/**
* Initializes link.
*
* @throws Exception exception
*/
private void initLink() throws Exception {
LOGGER.debug("Initializing link....");
final JSONObject link = new JSONObject();

link.put(Link.LINK_TITLE, "黑客派");
link.put(Link.LINK_ADDRESS, "https://hacpai.com");
link.put(Link.LINK_DESCRIPTION, "黑客与画家的社区");
link.put(Link.LINK_ICON, "https://static.hacpai.com/images/favicon.png");
final int maxOrder = linkRepository.getMaxOrder();
link.put(Link.LINK_ORDER, maxOrder + 1);
linkRepository.add(link);
LOGGER.debug("Initialized link");
}

/**
* Initializes statistic.
*
Expand All @@ -416,13 +389,11 @@ private void initLink() throws Exception {
*/
private void initStatistic() throws RepositoryException, JSONException {
LOGGER.debug("Initializing statistic....");

final JSONObject statisticBlogViewCountOpt = new JSONObject();
statisticBlogViewCountOpt.put(Keys.OBJECT_ID, Option.ID_C_STATISTIC_BLOG_VIEW_COUNT);
statisticBlogViewCountOpt.put(Option.OPTION_VALUE, "0");
statisticBlogViewCountOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_STATISTIC);
optionRepository.add(statisticBlogViewCountOpt);

LOGGER.debug("Initialized statistic");
}

Expand Down

0 comments on commit c2f4435

Please # to comment.