mirror of https://github.com/halo-dev/halo
parent
7760d14acb
commit
91eca6db34
15
README.md
15
README.md
|
@ -48,7 +48,8 @@ java -jar target/dist/halo/halo-latest.jar
|
|||
|
||||
```bash
|
||||
# 安装Halo
|
||||
yum install -y wget && wget https://raw.githubusercontent.com/ruibaby/halo-cli/master/halo-cli.sh && bash halo-cli.sh -i
|
||||
yum install -y wget && wget -O halo-cli.sh https://git.io/fxHqp && bash halo-cli.sh -i
|
||||
|
||||
# 更新Halo
|
||||
bash halo-cli.sh -u
|
||||
```
|
||||
|
@ -62,6 +63,18 @@ docker pull ruibaby/halo
|
|||
docker run -d --name halo -p 8090:8090 -v ~/halo:/root/halo ruibaby/halo
|
||||
```
|
||||
|
||||
Docker Compose 部署:
|
||||
```bash
|
||||
# 获取 docker-compose.yaml 文件
|
||||
yum install -y wget && wget -O docker-compose.yaml https://git.io/fpS8N
|
||||
|
||||
# 修改 docker-compose.yaml,修改VIRTUAL_HOST,LETSENCRYPT_HOST为自己的域名,修改LETSENCRYPT_EMAIL为自己的邮箱。
|
||||
vim docker-compose.yaml
|
||||
|
||||
# 运行
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
> 注意:如使用Idea,Eclipse等IDE运行的话,需要安装Lombok插件,另外暂不支持JDK10,主题扫描和上传会有问题。
|
||||
|
||||
Let's start: http://localhost:8090
|
||||
|
|
|
@ -47,7 +47,8 @@ java -jar target/dist/halo/halo-latest.jar
|
|||
Rapid server deployment:
|
||||
```bash
|
||||
# Install Halo
|
||||
yum install -y wget && wget https://raw.githubusercontent.com/ruibaby/halo-cli/master/halo-cli.sh && bash halo-cli.sh -i
|
||||
yum install -y wget && wget -O halo-cli.sh https://git.io/fxHqp && bash halo-cli.sh -i
|
||||
|
||||
# Upgrade Halo
|
||||
bash halo-cli.sh -u
|
||||
```
|
||||
|
@ -56,10 +57,23 @@ Docker:
|
|||
```bash
|
||||
# Pull image
|
||||
docker pull ruibaby/halo
|
||||
|
||||
# run
|
||||
docker run -d --name halo -p 8090:8090 -v ~/halo:/root/halo ruibaby/halo
|
||||
```
|
||||
|
||||
Docker Compose:
|
||||
```bash
|
||||
# get docker-compose.yaml
|
||||
yum install -y wget && wget -O docker-compose.yaml https://git.io/fpS8N
|
||||
|
||||
# Modify docker-compose.yaml, modify VIRTUAL_HOST, LETSENCRYPT_HOST for your own domain name, and modify LETSENCRYPT_EMAIL for your own mailbox.
|
||||
vim docker-compose.yaml
|
||||
|
||||
# run
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
> Note: If you use Idea, Eclipse and other IDEs to run, you need to install the Lombok plugin, In addition, JDK10 is not supported at the moment, and there are problems with themes scanning and uploading.
|
||||
|
||||
Let's start: http://localhost:8090
|
||||
|
|
|
@ -47,7 +47,8 @@ java -jar target/dist/halo/halo-latest.jar
|
|||
Rapid server deploy etme:
|
||||
```bash
|
||||
# Install Halo
|
||||
yum install -y wget && wget https://raw.githubusercontent.com/ruibaby/halo-cli/master/halo-cli.sh && bash halo-cli.sh -i
|
||||
yum install -y wget && wget -O halo-cli.sh https://git.io/fxHqp && bash halo-cli.sh -i
|
||||
|
||||
# Upgrade Halo
|
||||
bash halo-cli.sh -u
|
||||
```
|
||||
|
@ -56,10 +57,23 @@ Docker:
|
|||
```bash
|
||||
# Pull image
|
||||
docker pull ruibaby/halo
|
||||
|
||||
# run
|
||||
docker run -d --name halo -p 8090:8090 -v ~/halo:/root/halo ruibaby/halo
|
||||
```
|
||||
|
||||
Docker Compose:
|
||||
```bash
|
||||
# Docker-compose.yaml dosyasını edinin
|
||||
yum install -y wget && wget -O docker-compose.yaml https://git.io/fpS8N
|
||||
|
||||
# Docker-compose.yaml dosyasını değiştirin, kendi alan adınız için VIRTUAL_HOST, LETSENCRYPT_HOST değerini değiştirin ve kendi posta kutunuz için LETSENCRYPT_EMAIL adresini değiştirin.
|
||||
vim docker-compose.yaml
|
||||
|
||||
# run
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
> Not: Eğer çalıştırmak için Idea, Eclipse ve diğer IDE leri kullanırsanız, Lombok eklentisini yüklemeniz gerekir. Ayrıca JDK 10 şu anda desteklenmiyor ve temaların taranması ve yüklenmesi ile ilgili sorunlar var.
|
||||
|
||||
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -56,12 +56,6 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
|
|
@ -34,6 +34,7 @@ public class ApiPageController {
|
|||
public JsonResult pages(@PathVariable(value = "postId") Long postId) {
|
||||
Post post = postService.findByPostId(postId, PostTypeEnum.POST_TYPE_PAGE.getDesc());
|
||||
if (null != post) {
|
||||
postService.cacheViews(post.getPostId());
|
||||
return new JsonResult(ResponseStatusEnum.SUCCESS.getCode(), ResponseStatusEnum.SUCCESS.getMsg(), post);
|
||||
} else {
|
||||
return new JsonResult(ResponseStatusEnum.NOTFOUND.getCode(), ResponseStatusEnum.NOTFOUND.getMsg());
|
||||
|
|
|
@ -16,8 +16,6 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 文章API
|
||||
|
@ -43,7 +41,7 @@ public class ApiPostController {
|
|||
@GetMapping(value = "/page/{page}")
|
||||
public JsonResult posts(@PathVariable(value = "page") Integer page) {
|
||||
Sort sort = new Sort(Sort.Direction.DESC, "postDate");
|
||||
Integer size = 10;
|
||||
int size = 10;
|
||||
if (StrUtil.isNotBlank(HaloConst.OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()))) {
|
||||
size = Integer.parseInt(HaloConst.OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()));
|
||||
}
|
||||
|
@ -55,16 +53,6 @@ public class ApiPostController {
|
|||
return new JsonResult(ResponseStatusEnum.SUCCESS.getCode(), ResponseStatusEnum.SUCCESS.getMsg(), posts);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/hot")
|
||||
public JsonResult hotPosts() {
|
||||
List<Post> posts = postService.hotPosts();
|
||||
if (null != posts && posts.size() > 0) {
|
||||
return new JsonResult(ResponseStatusEnum.SUCCESS.getCode(), ResponseStatusEnum.SUCCESS.getMsg(), posts);
|
||||
} else {
|
||||
return new JsonResult(ResponseStatusEnum.EMPTY.getCode(), ResponseStatusEnum.EMPTY.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个文章信息
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@ import cc.ryanc.halo.model.domain.*;
|
|||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||
import cc.ryanc.halo.model.enums.AllowCommentEnum;
|
||||
import cc.ryanc.halo.model.enums.AttachLocationEnum;
|
||||
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
|
||||
import cc.ryanc.halo.model.enums.TrueFalseEnum;
|
||||
import cc.ryanc.halo.service.*;
|
||||
|
@ -20,7 +21,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -156,27 +159,19 @@ public class InstallController {
|
|||
comment.setIsAdmin(0);
|
||||
commentService.save(comment);
|
||||
|
||||
optionsService.saveOption(BlogPropertiesEnum.IS_INSTALL.getProp(), TrueFalseEnum.TRUE.getDesc());
|
||||
|
||||
//语言设置
|
||||
optionsService.saveOption(BlogPropertiesEnum.BLOG_LOCALE.getProp(), blogLocale);
|
||||
//保存博客标题和博客地址设置
|
||||
optionsService.saveOption(BlogPropertiesEnum.BLOG_TITLE.getProp(), blogTitle);
|
||||
optionsService.saveOption(BlogPropertiesEnum.BLOG_URL.getProp(), blogUrl);
|
||||
|
||||
//设置默认主题
|
||||
optionsService.saveOption(BlogPropertiesEnum.THEME.getProp(), "anatole");
|
||||
|
||||
//建立网站时间
|
||||
optionsService.saveOption(BlogPropertiesEnum.BLOG_START.getProp(), DateUtil.format(DateUtil.date(), "yyyy-MM-dd"));
|
||||
|
||||
//默认不配置邮件系统
|
||||
optionsService.saveOption(BlogPropertiesEnum.SMTP_EMAIL_ENABLE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
|
||||
//新评论,审核通过,回复,默认不通知
|
||||
optionsService.saveOption(BlogPropertiesEnum.NEW_COMMENT_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
optionsService.saveOption(BlogPropertiesEnum.COMMENT_PASS_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
optionsService.saveOption(BlogPropertiesEnum.COMMENT_REPLY_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put(BlogPropertiesEnum.IS_INSTALL.getProp(), TrueFalseEnum.TRUE.getDesc());
|
||||
options.put(BlogPropertiesEnum.BLOG_LOCALE.getProp(), blogLocale);
|
||||
options.put(BlogPropertiesEnum.BLOG_TITLE.getProp(), blogTitle);
|
||||
options.put(BlogPropertiesEnum.BLOG_URL.getProp(), blogUrl);
|
||||
options.put(BlogPropertiesEnum.THEME.getProp(), "anatole");
|
||||
options.put(BlogPropertiesEnum.BLOG_START.getProp(), DateUtil.format(DateUtil.date(), "yyyy-MM-dd"));
|
||||
options.put(BlogPropertiesEnum.SMTP_EMAIL_ENABLE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
options.put(BlogPropertiesEnum.NEW_COMMENT_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
options.put(BlogPropertiesEnum.COMMENT_PASS_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
options.put(BlogPropertiesEnum.COMMENT_REPLY_NOTICE.getProp(), TrueFalseEnum.FALSE.getDesc());
|
||||
options.put(BlogPropertiesEnum.ATTACH_LOC.getProp(), AttachLocationEnum.SERVER.getDesc());
|
||||
optionsService.saveOptions(options);
|
||||
|
||||
//更新日志
|
||||
logsService.save(LogsRecord.INSTALL, "安装成功,欢迎使用Halo。", request);
|
||||
|
@ -197,8 +192,7 @@ public class InstallController {
|
|||
|
||||
HaloConst.OPTIONS.clear();
|
||||
HaloConst.OPTIONS = optionsService.findAllOptions();
|
||||
|
||||
configuration.setSharedVariable("options", optionsService.findAllOptions());
|
||||
configuration.setSharedVariable("options", HaloConst.OPTIONS);
|
||||
configuration.setSharedVariable("user", userService.findUser());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<footer class="main-footer">
|
||||
<#-- 虽然Halo使用了宽松的GPL协议,但开发不易,希望您可以保留一下版权声明。笔芯~ -->
|
||||
<div class="pull-right hidden-xs"><a target="_blank" href="https://github.com/ruibaby/halo/releases/tag/v0.1">0.1</a></div>
|
||||
<div class="pull-right hidden-xs"><a target="_blank" href="https://github.com/ruibaby/halo/releases/tag/v0.1.1">0.1.1</a></div>
|
||||
Thanks for using <strong><a data-pjax="true" href="/admin/halo">Halo</a>.</strong>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in New Issue