Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
47c5db4
typo fix
ShenJiahuan Oct 12, 2019
73a7f97
Merge pull request #333 from ShenJiahuan/dev
JohnNiang Oct 12, 2019
7b8fc49
Update dependencies.
ruibaby Oct 19, 2019
dd0b161
Merge branch 'dev' of github.com:halo-dev/halo into dev
ruibaby Oct 19, 2019
1c38fc6
Update ISSUE_TEMPLATE.md
ruibaby Oct 19, 2019
eb7ff71
Create list team api for menu/link.
ruibaby Oct 24, 2019
463b786
Update robots router.
ruibaby Oct 28, 2019
a276f27
Fixed problem resolving overwriting of node values with the same name…
guqing Oct 29, 2019
58b543c
Fixed problem resolving overwriting of node values with the same name…
guqing Oct 29, 2019
663b89d
merge conflicts
guqing Oct 29, 2019
fff323e
Refactor migrate api.
ruibaby Oct 29, 2019
bf1bea2
Refactor migrate api.
ruibaby Oct 29, 2019
11960e9
Update PostParam.java
weiwensangsang Oct 29, 2019
13c120b
Refactor migrate api.
ruibaby Oct 30, 2019
f57c2fa
在dev分支上解决缺省文章路径未进行URL转义的问题 (#351)
ruibaby Oct 30, 2019
c640afc
Merge pull request #1 from halo-dev/dev
weiwensangsang Oct 30, 2019
b769843
fix error when input ico
weiwensangsang Oct 30, 2019
2f847b9
fix #356
ruibaby Oct 31, 2019
3ef04cc
Merge branch 'dev' of github.com:halo-dev/halo into dev
ruibaby Oct 31, 2019
9a76088
Merge pull request #353 from weiwensangsang/dev-local-1030
ruibaby Nov 1, 2019
076e666
Update ISSUE_TEMPLATE.md
ruibaby Nov 3, 2019
9015f30
fixed #373
ruibaby Nov 12, 2019
54e17ac
solved #361
ruibaby Nov 12, 2019
eaee041
Batch export markdown backup in hexo format
wudibobi Nov 14, 2019
f1b3fa2
Merge pull request #376 from kevinBobo/dev
ruibaby Nov 14, 2019
9dd02ee
Enable ip lock while updating password
JohnNiang Nov 16, 2019
07eea75
Fix issue#381: No IP address is recorded in log
JohnNiang Nov 16, 2019
ccdb705
Change some warning log to debug level
JohnNiang Nov 16, 2019
95b3e94
Update exception throw logic
JohnNiang Nov 17, 2019
a041409
Accomplish zip utility
JohnNiang Nov 17, 2019
c7d88b1
Accomplish backup listing and deletion
JohnNiang Nov 17, 2019
079928f
Comment a warning on MainController redirection
JohnNiang Nov 17, 2019
ec5f8f9
Add updateTime property into BackupDTO
JohnNiang Nov 17, 2019
80c28ba
Try to release v1.1.3-beta.1
JohnNiang Nov 17, 2019
406ced5
Comment the war dependency in build.gradle
JohnNiang Nov 17, 2019
381341a
feat: hide admin path in robot.txt
ruibaby Nov 18, 2019
020fe50
fixed: swagger-ui address redirect to 404.
ruibaby Nov 18, 2019
cd2c3a1
feat: unified formatted slug.
ruibaby Nov 18, 2019
dbf12f7
Update OptionServiceImpl.java
ruibaby Nov 18, 2019
4b59b9e
feat: support set protocol for cloud storage.
ruibaby Nov 18, 2019
c95aee1
Update PostServiceImpl.java
ruibaby Nov 18, 2019
a182dc7
feat: support get backup file size.
ruibaby Nov 19, 2019
53f4545
Replace downloadUrl into downloadLink of BackupDTO
JohnNiang Nov 19, 2019
627b15f
Try to resolve Too many open files error
JohnNiang Nov 19, 2019
dbfa77e
feat:(add customize resttempalte timeout.)
NGLSL Nov 19, 2019
3f4843a
Merge pull request #389 from NGLSL/dev
JohnNiang Nov 19, 2019
9860360
Create gradle.yml
JohnNiang Nov 20, 2019
b7cf557
Merge pull request #390 from halo-dev/JohnNiang-patch-1
JohnNiang Nov 20, 2019
35ab840
Fix file list bug
JohnNiang Nov 21, 2019
b28eeb2
Remove redundant try clause
JohnNiang Nov 21, 2019
b914e6b
feat: add tree view and list view comments data api for post and sheet.
ruibaby Nov 22, 2019
ede2332
Merge branch 'dev' of github.com:halo-dev/halo into dev
ruibaby Nov 22, 2019
c129243
feat: remove halo prefix for admin path.
ruibaby Nov 22, 2019
4f229d3
feat: support developer mode.
ruibaby Nov 23, 2019
6ce4441
feat: modify actuator base path.
ruibaby Nov 24, 2019
c61e8be
增加toc支持的标题层级,目前不支持h4级标题以上(包括)
xzhuz Nov 25, 2019
c946876
Merge pull request #398 from xebcxc/dev
ruibaby Nov 25, 2019
dc497c3
feat: support set style rule for tencent cos.
ruibaby Nov 25, 2019
ce458d2
Merge branch 'dev' of github.com:halo-dev/halo into dev
ruibaby Nov 25, 2019
7faa96b
style: change some class name.
ruibaby Nov 25, 2019
61a98b8
style: change some class name.
ruibaby Nov 25, 2019
426bbf6
feat(jvm): change jvm to openj9 to reduce memory
ijkzen Nov 26, 2019
54e4e02
Merge pull request #401 from ijkzen/patch-2
JohnNiang Nov 27, 2019
ee6e5d5
release: 1.1.3-beta.2.
ruibaby Nov 27, 2019
537d28b
style: Change AttachmentType enum.
ruibaby Nov 29, 2019
192890b
feat: refactor PostTagDirective.
ruibaby Nov 29, 2019
f7057db
style: change freemarker package.
ruibaby Nov 29, 2019
8463a3f
Allow customization of admin path
JohnNiang Nov 29, 2019
2153998
Secure backup file downloading
JohnNiang Nov 29, 2019
5a0eac4
Change version to 1.1.3-beta.3
JohnNiang Nov 29, 2019
60cac13
Fix backup download error and add temp token support
JohnNiang Nov 29, 2019
a3bffe6
Throw forbidden exception while temporary token expired
JohnNiang Nov 30, 2019
c643e20
feat: add treeByTeam tag for menu.
ruibaby Nov 30, 2019
0c1b32e
Remove redundant code of http servlet request fetching globally
JohnNiang Nov 30, 2019
6214f14
Correct third person call
JohnNiang Nov 30, 2019
7cc3c78
feat: support post metas
guqing Dec 1, 2019
73d1985
Merge branch 'dev' of https://github.com/halo-dev/halo into dev
guqing Dec 1, 2019
5819fd7
style: add author for some class.
ruibaby Dec 1, 2019
b2a6d06
feat: add convert meta list to map method.
ruibaby Dec 1, 2019
47ea992
fix: can not delete post meta.
ruibaby Dec 1, 2019
f1944c5
fix: markdownImportTest error.
ruibaby Dec 1, 2019
9217694
feat: create ISSUE_TEMPLATE.
ruibaby Dec 1, 2019
30656f5
feat: support flywaydb.
ruibaby Dec 2, 2019
b08dd8a
feat: complete V1__migrate_*_to_1.1.3.sql.
ruibaby Dec 2, 2019
316e618
feat: add description field for theme setting.
ruibaby Dec 2, 2019
3676a77
feat: create list_view for option api.
ruibaby Dec 2, 2019
2ebea69
Add api: delete attachments permanently in batch
JohnNiang Dec 2, 2019
bc06a49
feat: add some api for option.
ruibaby Dec 3, 2019
a3e866f
Merge branch 'dev' of github.com:halo-dev/halo into dev
ruibaby Dec 3, 2019
f0b94a6
Overload the constructor of Option entity
JohnNiang Dec 3, 2019
a64b7ad
feat support restart application api.
ruibaby Dec 3, 2019
ddef7e0
feat: #412
ruibaby Dec 6, 2019
0400911
feat: support preset post meta field.
ruibaby Dec 7, 2019
304ad0e
Fix null error while unset page or size
JohnNiang Dec 9, 2019
267e184
fix: #416
ruibaby Dec 10, 2019
bc41148
feat: support sheet meta.
ruibaby Dec 10, 2019
8dac1a1
Fix visit event ingore
JohnNiang Dec 10, 2019
d7a8723
Resolve conflict
JohnNiang Dec 10, 2019
f3e81b9
Clear cache before application id destroyed
JohnNiang Dec 10, 2019
afdf94b
Add draft content updation and enhance page list api
JohnNiang Dec 11, 2019
bd2eebf
Add base post services
JohnNiang Dec 11, 2019
a55b469
feat: support remove in batch api for post.
ruibaby Dec 11, 2019
2a077fe
Update .travis.yml
ruibaby Dec 11, 2019
f36f8ae
feat: support remove in batch api for comment.
ruibaby Dec 12, 2019
6851298
feat: add update status in batch api for post.
ruibaby Dec 12, 2019
30eacdb
feat: add update status in batch api for comment.
ruibaby Dec 12, 2019
6c677c9
feat: #424
ruibaby Dec 12, 2019
7d17d6c
Fix lombok error
JohnNiang Dec 12, 2019
4ec90d2
Refactor post status update api
JohnNiang Dec 12, 2019
3ba40b3
refactor: comment status update api.
ruibaby Dec 12, 2019
5a5e841
feat: update halo admin.
ruibaby Dec 12, 2019
d59877a
Fix directory traversal vulnerability
JohnNiang Dec 12, 2019
2056f52
Fix vulnerability while deleting backup file
JohnNiang Dec 12, 2019
568e487
Fix xml external entity vulnerability
JohnNiang Dec 12, 2019
dc3a73e
Config freemarker with safer resolver
JohnNiang Dec 12, 2019
ac0905b
feat: support mermaid.
ruibaby Dec 13, 2019
26da4bd
fix: sm.ms upload handler.
ruibaby Dec 16, 2019
f1dbeef
feat: add blog statistics api.
ruibaby Dec 16, 2019
0d622d3
feat: update migrate sql script.
ruibaby Dec 18, 2019
2b75762
feat: completed static storage api.
ruibaby Dec 18, 2019
faa9b28
test: test travis ci.
ruibaby Dec 18, 2019
016ce48
test: test travis ci.
ruibaby Dec 18, 2019
514dfcf
release: 1.2.0-beta.1
ruibaby Dec 18, 2019
e6497f9
feat: create get logfile content api.
ruibaby Dec 19, 2019
f5d957e
refactor: refactor post preview and private post view.
ruibaby Dec 19, 2019
5c6d2ab
refactor: markdown parse emoji type.
ruibaby Dec 19, 2019
999b72a
fix: edit wrap issues.
ruibaby Dec 19, 2019
6aa31fb
fix: markdown table rendering issues.
ruibaby Dec 19, 2019
a0d4c74
feat: log reset password code if didn't config smtp.
ruibaby Dec 19, 2019
0c189ee
feat: support post custom template.
ruibaby Dec 20, 2019
f60938e
feat: support cdn for post content image.
ruibaby Dec 20, 2019
6941cd4
feat: support markdown for journal.
ruibaby Dec 20, 2019
19862b0
feat: create get attahcment types api.
ruibaby Dec 20, 2019
5e91fc4
feat: #433
ruibaby Dec 21, 2019
6264517
Update AdminServiceImpl.java
refeccd Dec 21, 2019
f082c90
Update AdminServiceImpl.java
refeccd Dec 21, 2019
0fe4f95
fix: post count tag.
ruibaby Dec 22, 2019
281d49b
Fix a bug when building tokens (#435)
ruibaby Dec 22, 2019
32701ab
feat: remove spaces and newlines in post summary.
ruibaby Dec 23, 2019
ed734a6
feat: generate summary for sheet.
ruibaby Dec 23, 2019
66e9c98
feat: performance optimization.
ruibaby Dec 23, 2019
308aefa
release: 1.2.0-beta.2.
ruibaby Dec 23, 2019
90757f6
release: 1.2.0-beta.3.
ruibaby Dec 23, 2019
03eea67
pref: remove flexmark anchor link extension.
ruibaby Dec 24, 2019
c758c76
pref: remove flexmark anchor link extension.
ruibaby Dec 24, 2019
4cdfc22
fix: migrate database error.
ruibaby Dec 24, 2019
fe03847
pref: uncomment text stage in .travis.yml.
ruibaby Dec 25, 2019
a246dc6
fix: admin redirect incorrectly
JohnNiang Dec 25, 2019
f99daee
pref: remove useless code.
ruibaby Dec 25, 2019
04512db
refactor: content api.
ruibaby Dec 27, 2019
b9e64cb
pref: remove cdn_domain option.
ruibaby Dec 27, 2019
86e6103
release: 1.2.0-beta.4.
ruibaby Dec 28, 2019
b9c2daa
fix: child comments could not be deleted.
ruibaby Dec 29, 2019
b7ac3f5
feat: support set file source for ali oss.
ruibaby Dec 31, 2019
2701146
feat: support set file source for tencent cos.
ruibaby Dec 31, 2019
9ac31d0
feat: support set file source for qiniu oss.
ruibaby Dec 31, 2019
79e66cd
style: add some comment.
ruibaby Jan 1, 2020
013fa1f
fix: the problem that meta is not deleted when the sheet is deleted.
ruibaby Jan 1, 2020
e13c014
style: remove useless code.
ruibaby Jan 1, 2020
d3ef9c4
pref: remove useless code.
ruibaby Jan 1, 2020
6c7968c
feat: add archive freemarker custom tag.
ruibaby Jan 2, 2020
0ce3800
fix:repeated updates of visits and private article visits abnorm… (#463)
evanwangace Jan 2, 2020
ad4da63
feat: support set summary for sheet.
ruibaby Jan 4, 2020
28b4d38
release: 1.2.0-beta.5.
ruibaby Jan 4, 2020
f24c90b
fix: content api token name error.
ruibaby Jan 4, 2020
a1e8b2f
doc: update readme.
ruibaby Jan 5, 2020
202cf59
release: 1.2.0.
guqing Jan 5, 2020
753a3bc
release: 1.2.0.
ruibaby Jan 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Bug Report
about: 事情不像预期的那样工作吗?
title: ''
labels: 'bug'
assignees: ''

---

<!--
你好!感谢你正在考虑为 Halo 提交一个 bug。请花一点点时间尽量详细地回答以下基础问题。

谢谢!
-->

<!--
请确认你已经做了下面这些事情,若 bug 还是未解决,那么请尽可详细地描述你的问题。

- 我已经安装了最新版的 Halo
- 我已经搜索了已有的 Issues 列表中有关的信息
- 我已经搜索了论坛中有关的信息:https://bbs.halo.run
- 我已经阅读了 Halo 的 FAQ:https://halo.run/guide/faq.html
-->

## 我的环境

<!--
请登录到博客后台,进入菜单 `系统->关于` 点击 `环境信息` 旁边的按钮即可复制环境信息。
-->

---

## 错误日志

<!--
请登录到博客后台,点击菜单栏中的 `Halo Dashboard` 10 次即可开启 `开发者选项`。进入开发者选项中的 `实时日志`。
你可以选择查找具体的错误日志,或者直接下载日志文件复制到下面即可。(注意:日志堆栈信息请用 Markdown 的代码块语法,以方便查看。)
-->

---

## 期望行为

<!--
你期望会发生什么?
-->

## 当前行为

<!--
描述 bug 细节,确认出现此问题的复现步骤,例如点击了哪里,发生了什么情况?

你可以粘贴截图或附件。
-->
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Feature Request
about: 想让我们为 Halo 增加什么功能吗?
title: 'feat: '
labels: 'Feature Request'
assignees: ''

---

<!--
你好!感谢你愿意考虑希望 Halo 增加某个新功能。请花一点点时间尽量详细地回答以下基础问题。

谢谢!
-->

## 概述

<!--
对这个新功能的一段描述
-->

## 动机

<!--
为什么你希望在 Halo 中使用这个功能?
-->

## 详细解释

<!--
详细描述这个新功能。

如果这是一个小功能,你可以忽略这部分。
-->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Question
about: 对 Halo 有任何问题吗?
title: ''
labels: 'question'
assignees: ''

---

<!--
如果你有任何问题也可以通过此渠道来向我们反馈。

谢谢!
-->
17 changes: 17 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM openjdk:8-jre-alpine

FROM adoptopenjdk/openjdk8-openj9
VOLUME /tmp

ARG JAR_FILE=build/libs/halo.jar
Expand All @@ -13,4 +12,4 @@ COPY ${JAR_FILE} halo.jar

EXPOSE ${PORT}

ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -server -jar halo.jar
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -server -jar halo.jar
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

> Halo 是一款现代化的个人独立博客系统,给习惯写博客的同学多一个选择。



<p align="center">
<a href="#"><img alt="JDK" src="https://img.shields.io/badge/JDK-1.8-yellow.svg?style=flat-square"/></a>
<a href="https://github.com/halo-dev/halo/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/halo-dev/halo.svg?style=flat-square"/></a>
Expand All @@ -21,20 +19,24 @@

轻快,简洁,功能强大,使用 Java 开发的博客系统。

> [官方社区](https://bbs.halo.run) | [QQ 交流群](https://jq.qq.com/?_wv=1027&k=5tnr930) | [Telegram 交流群](https://t.me/HaloBlog) | [Telegram 频道](https://t.me/halo_dev) | [WeHalo 小程序](https://github.com/aquanlerou/WeHalo)。
> [官网](https://halo.run) | [社区](https://bbs.halo.run) | [QQ 交流群](https://jq.qq.com/?_wv=1027&k=5tnr930) | [Telegram 交流群](https://t.me/HaloBlog) | [Telegram 频道](https://t.me/halo_dev)

## 声明

> 本项目旨在创造一个好的产品以供人们使用(虽然现在并不是太好),并非一个所谓提供学习的项目。所以,不提供任何学习代码的帮助。所以,请不要在讨论群,issues,论坛发起任何有关代码学习的问题。当然,如果你是要参与代码贡献,我们非常欢迎。

## 快速开始

### 下载最新的 Halo 安装包

```bash
curl -L https://github.com/halo-dev/halo/releases/download/v1.1.1/halo-1.1.1.jar --output halo-latest.jar
curl -L https://github.com/halo-dev/halo/releases/download/v1.2.0/halo-1.2.0.jar --output halo-latest.jar
```

或者

```bash
wget https://github.com/halo-dev/halo/releases/download/v1.1.1/halo-1.1.1.jar -O halo-latest.jar
wget https://github.com/halo-dev/halo/releases/download/v1.2.0/halo-1.2.0.jar -O halo-latest.jar
```

### 启动 Halo
Expand All @@ -55,12 +57,13 @@ java -jar halo-latest.jar
- 独立评论模块(halo-comment):<https://github.com/halo-dev/halo-comment>
- 管理 APP(halo-app):<https://github.com/halo-dev/halo-app>
- 主题仓库:<https://halo.run/theme>
- WeHalo 小程序:<https://github.com/aquanlerou/WeHalo>

## 许可证

[![license](https://img.shields.io/github/license/halo-dev/halo.svg?style=flat-square)](https://github.com/halo-dev/halo/blob/master/LICENSE)

> Halo 使用 GPL-v3.0 协议开源,请尽量遵守开源协议,即便是在中国
> Halo 使用 GPL-v3.0 协议开源,请尽量遵守开源协议。

## 贡献
参考 [CONTRIBUTING](./CONTRIBUTING.md)。
Expand All @@ -81,8 +84,6 @@ java -jar halo-latest.jar

![theme-icarus.png](https://i.loli.net/2019/09/11/4lO2wNCLiqyIJmR.png)

![theme-destiny.png](https://i.loli.net/2019/09/11/q4t86cCPUEwlGMn.png)

![install.png](https://i.loli.net/2019/09/11/Iu1eMzZDg6frw97.png)

![admin-login.png](https://i.loli.net/2019/09/11/3CahVJAvXngwiQu.png)
Expand Down
17 changes: 12 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'org.springframework.boot' version '2.2.1.RELEASE'
id "io.freefair.lombok" version "3.6.6"
// id 'war'
id 'java'
Expand All @@ -9,7 +9,7 @@ apply plugin: 'io.spring.dependency-management'

group = 'run.halo.app'
archivesBaseName = 'halo'
version = '1.1.1'
version = '1.2.0'
sourceCompatibility = '1.8'
description = 'Halo, personal blog system developed in Java.'

Expand Down Expand Up @@ -43,7 +43,7 @@ bootJar {

ext {
ohMyEmailVersion = '0.0.4'
hutoolVersion = '4.6.3'
hutoolVersion = '5.0.3'
upyunSdkVersion = '4.0.1'
qiniuSdkVersion = '7.2.18'
aliyunSdkVersion = '3.4.2'
Expand All @@ -56,6 +56,9 @@ ext {
jgitVersion = '5.3.0.201903130848-r'
flexmarkVersion = '0.42.12'
thumbnailatorVersion = '0.4.8'
image4jVersion = '0.7zensight1'
flywayVersion = '6.1.0'
h2Version = '1.4.196'
}

dependencies {
Expand Down Expand Up @@ -93,17 +96,21 @@ dependencies {
implementation "com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-toc:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gitlab:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-html-parser:$flexmarkVersion"

implementation "net.coobird:thumbnailator:$thumbnailatorVersion"
implementation "net.sf.image4j:image4j:$image4jVersion"
implementation "org.flywaydb:flyway-core:$flywayVersion"

runtimeOnly 'com.h2database:h2'
runtimeOnly "com.h2database:h2:$h2Version"
runtimeOnly 'mysql:mysql-connector-java'


compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'

developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
}
27 changes: 22 additions & 5 deletions src/main/java/run/halo/app/Application.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package run.halo.app;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import run.halo.app.repository.base.BaseRepositoryImpl;

/**
* <pre>
* Halo run!
* </pre>
* Halo main class.
*
* @author ryanwang
* @date : 2017/11/14
* @date 2017-11-14
*/
@SpringBootApplication
@EnableJpaAuditing
Expand All @@ -25,12 +25,29 @@
@EnableJpaRepositories(basePackages = "run.halo.app.repository", repositoryBaseClass = BaseRepositoryImpl.class)
public class Application extends SpringBootServletInitializer {

private static ConfigurableApplicationContext context;

public static void main(String[] args) {
// Customize the spring config location
System.setProperty("spring.config.additional-location", "file:${user.home}/.halo/,file:${user.home}/halo-dev/");

// Run application
SpringApplication.run(Application.class, args);
context = SpringApplication.run(Application.class, args);
}

/**
* Restart Application.
*/
public static void restart() {
ApplicationArguments args = context.getBean(ApplicationArguments.class);

Thread thread = new Thread(() -> {
context.close();
context = SpringApplication.run(Application.class, args.getSourceArgs());
});

thread.setDaemon(false);
thread.start();
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/run/halo/app/cache/InMemoryCacheStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ Boolean putInternalIfAbsent(String key, CacheWrapper<String> cacheWrapper) {

log.debug("Preparing to put key: [{}], value: [{}]", key, cacheWrapper);

lock.lock();
try {
lock.lock();
// Get the value before
Optional<String> valueOptional = get(key);

Expand Down Expand Up @@ -98,6 +98,11 @@ public void delete(String key) {
public void preDestroy() {
log.debug("Cancelling all timer tasks");
timer.cancel();
clear();
}

private void clear() {
CACHE_CONTAINER.clear();
}

/**
Expand Down
Loading