mirror of https://github.com/halo-dev/halo
👽 细节修改
parent
e406219701
commit
41c987583e
29
README.md
29
README.md
|
@ -13,21 +13,20 @@
|
|||
- [Introduction 简介](#introduction-简介)
|
||||
- [Quickstart 快速开始](#quickstart-快速开始)
|
||||
- [Demo 演示](#demo-演示)
|
||||
- [Download 下载](#download-下载)
|
||||
- [Download 下载部署](#download-下载部署)
|
||||
- [Docs 文档](#docs-文档)
|
||||
- [Themes 主题](#themes-主题)
|
||||
- [License 许可证](#license-许可证)
|
||||
- [Todo 后续功能](#todo-后续功能)
|
||||
- [Thanks 感谢](#thanks-感谢)
|
||||
|
||||
## Introduction 简介
|
||||
|
||||
**Halo** [ˈheɪloʊ]<br>
|
||||
Fast,simple,powerful blog system powered by Java.
|
||||
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。
|
||||
|
||||
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。<br>
|
||||
轻快,简洁,功能强大,使用Java开发的博客系统。
|
||||
|
||||
**Halo交流群:** 162747721
|
||||
> **Halo交流群:** 162747721
|
||||
|
||||
## Quickstart 快速开始
|
||||
|
||||
|
@ -38,6 +37,8 @@ mvn clean package -Pprod
|
|||
java -jar target/dist/halo/halo-xxx.jar
|
||||
```
|
||||
|
||||
> **注意:如使用Idea,Eclipse等IDE运行的话,需要安装Lombok插件。**
|
||||
|
||||
Let's start: http://localhost:8090
|
||||
|
||||
## Demo 演示
|
||||
|
@ -50,20 +51,31 @@ Let's start: http://localhost:8090
|
|||
|
||||
[宋浩志博客](http://songhaozhi.com)
|
||||
|
||||
## Download 下载
|
||||
## Download 下载部署
|
||||
|
||||
[Download](https://github.com/ruibaby/halo/releases)
|
||||
[下载](https://github.com/ruibaby/halo/releases)最新的压缩包,解压之后进入根目录执行`java -jar halo-xxx.jar`即可运行。
|
||||
|
||||
> **如需部署到服务器,请参考[Halo部署教程](https://ryanc.cc/archives/halo-run)。**
|
||||
|
||||
## Docs 文档
|
||||
|
||||
[Halo Document](https://halo-doc.ryanc.cc)
|
||||
|
||||
>文档正在整理中。
|
||||
> **文档正在不断完善中。**
|
||||
|
||||
## Themes 主题
|
||||
|
||||
除了内置的[Anatole](https://github.com/hi-caicai/farbox-theme-Anatole)和[Material](https://github.com/viosey/hexo-theme-material),还有下列主题没有集成在项目里,如有需要,请自行下载之后通过后台上传上去使用。
|
||||
|
||||
- [Vno](https://github.com/ruibaby/vno-halo) - 来自Jekyll的一款主题,作者[Wei Wang](https://onevcat.com/)。
|
||||
- [Hux](https://github.com/ruibaby/hux-halo) - 来自Jekyll的一款主题,作者[Xuan Huang](https://huangxuan.me/)。
|
||||
|
||||
## License 许可证
|
||||
|
||||
[](https://github.com/ruibaby/halo/blob/master/LICENSE)
|
||||
|
||||
> **Halo使用GPL-v3.0协议开源,请尽量遵守开源协议,即便是在中国。**
|
||||
|
||||
## Todo 后续功能
|
||||
|
||||
- [ ] 文章阅读统计
|
||||
|
@ -95,3 +107,4 @@ Halo的诞生离不开下面这些项目:
|
|||
- [Layer](https://github.com/sentsin/layer.git):个人认为最实用最好看的弹出层组件,没有之一
|
||||
- [Jquery-Toast](https://github.com/kamranahmedse/jquery-toast-plugin):消息提示组件
|
||||
- [Pjax](https://github.com/defunkt/jquery-pjax.git):pushState + ajax = pjax
|
||||
|
||||
|
|
20
pom.xml
20
pom.xml
|
@ -131,6 +131,13 @@
|
|||
<artifactId>guava</artifactId>
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
<scope>true</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<!-- 生产环境打包配置 -->
|
||||
|
@ -213,11 +220,14 @@
|
|||
<id>dev</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
|
|
@ -5,9 +5,10 @@ import cc.ryanc.halo.model.dto.HaloConst;
|
|||
import cc.ryanc.halo.model.dto.Theme;
|
||||
import cc.ryanc.halo.service.AttachmentService;
|
||||
import cc.ryanc.halo.service.OptionsService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -45,7 +46,7 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
|
|||
private void loadActiveTheme(){
|
||||
try {
|
||||
String themeValue = optionsService.findOneOption("theme");
|
||||
if(HaloUtil.isNotNull(themeValue)){
|
||||
if(StringUtils.isNotEmpty("themeValue")){
|
||||
BaseController.THEME = themeValue;
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
@ -87,7 +88,7 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
|
|||
private void loadThemes(){
|
||||
try{
|
||||
HaloConst.THEMES.clear();
|
||||
List<Theme> themes = HaloUtil.getThemes();
|
||||
List<Theme> themes = HaloUtils.getThemes();
|
||||
if(null!=themes){
|
||||
HaloConst.THEMES = themes;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package cc.ryanc.halo.service.impl;
|
|||
|
||||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.service.MailService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import freemarker.template.Template;
|
||||
import io.github.biezhi.ome.OhMyEmail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -33,7 +33,7 @@ public class MailServiceImpl implements MailService {
|
|||
@Override
|
||||
public void sendMail(String to, String subject, String content) {
|
||||
//配置邮件服务器
|
||||
HaloUtil.configMail(
|
||||
HaloUtils.configMail(
|
||||
HaloConst.OPTIONS.get("mail_smtp_host"),
|
||||
HaloConst.OPTIONS.get("mail_smtp_username"),
|
||||
HaloConst.OPTIONS.get("mail_smtp_password"));
|
||||
|
@ -59,7 +59,7 @@ public class MailServiceImpl implements MailService {
|
|||
@Override
|
||||
public void sendTemplateMail(String to, String subject, Map<String, Object> content, String templateName) {
|
||||
//配置邮件服务器
|
||||
HaloUtil.configMail(
|
||||
HaloUtils.configMail(
|
||||
HaloConst.OPTIONS.get("mail_smtp_host"),
|
||||
HaloConst.OPTIONS.get("mail_smtp_username"),
|
||||
HaloConst.OPTIONS.get("mail_smtp_password"));
|
||||
|
|
|
@ -7,7 +7,7 @@ import cc.ryanc.halo.model.dto.Archive;
|
|||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.repository.PostRepository;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
@ -76,10 +76,10 @@ public class PostServiceImpl implements PostService {
|
|||
public void updateAllSummary(Integer postSummary) {
|
||||
List<Post> posts = this.findAllPosts(HaloConst.POST_TYPE_POST);
|
||||
for (Post post : posts) {
|
||||
if (!(HaloUtil.htmlToText(post.getPostContent()).length() < postSummary)) {
|
||||
post.setPostSummary(HaloUtil.getSummary(post.getPostContent(), postSummary));
|
||||
if (!(HaloUtils.htmlToText(post.getPostContent()).length() < postSummary)) {
|
||||
post.setPostSummary(HaloUtils.getSummary(post.getPostContent(), postSummary));
|
||||
} else {
|
||||
post.setPostSummary(HaloUtil.htmlToText(post.getPostContent()));
|
||||
post.setPostSummary(HaloUtils.htmlToText(post.getPostContent()));
|
||||
}
|
||||
postRepository.save(post);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ public class PostServiceImpl implements PostService {
|
|||
public String buildRss(List<Post> posts) {
|
||||
String rss = "";
|
||||
try {
|
||||
rss = HaloUtil.getRss(posts);
|
||||
rss = HaloUtils.getRss(posts);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -339,6 +339,6 @@ public class PostServiceImpl implements PostService {
|
|||
*/
|
||||
@Override
|
||||
public String buildSiteMap(List<Post> posts) {
|
||||
return HaloUtil.getSiteMap(posts);
|
||||
return HaloUtils.getSiteMap(posts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cc.ryanc.halo.util;
|
||||
package cc.ryanc.halo.utils;
|
||||
|
||||
import cc.ryanc.halo.model.domain.Post;
|
||||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
|
@ -30,9 +30,6 @@ import java.time.ZoneId;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
@ -41,7 +38,7 @@ import java.util.zip.ZipOutputStream;
|
|||
* description:常用的方法
|
||||
*/
|
||||
@Slf4j
|
||||
public class HaloUtil {
|
||||
public class HaloUtils {
|
||||
|
||||
private final static Calendar NOW = Calendar.getInstance();
|
||||
|
||||
|
@ -51,113 +48,9 @@ public class HaloUtil {
|
|||
|
||||
private static ArrayList<String> FILE_LIST = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 验证字符串是否为空
|
||||
* @param str str
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isNotNull(String str){
|
||||
return null !=str && ! "".equals(str.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压Zip文件
|
||||
* @param zipFilePath 压缩文件的路径
|
||||
* @param descDir 解压的路径
|
||||
*/
|
||||
public static void unZip(String zipFilePath,String descDir){
|
||||
File zipFile=new File(zipFilePath);
|
||||
File pathFile=new File(descDir);
|
||||
if(!pathFile.exists()){
|
||||
pathFile.mkdirs();
|
||||
}
|
||||
ZipFile zip=null;
|
||||
InputStream in=null;
|
||||
OutputStream out=null;
|
||||
try {
|
||||
zip=new ZipFile(zipFile);
|
||||
Enumeration<?> entries=zip.entries();
|
||||
while(entries.hasMoreElements()){
|
||||
ZipEntry entry=(ZipEntry) entries.nextElement();
|
||||
String zipEntryName=entry.getName();
|
||||
in=zip.getInputStream(entry);
|
||||
|
||||
String outPath=(descDir+"/"+zipEntryName).replace("\\*", "/");
|
||||
File file=new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||
if(!file.exists()){
|
||||
file.mkdirs();
|
||||
}
|
||||
if(new File(outPath).isDirectory()){
|
||||
continue;
|
||||
}
|
||||
out=new FileOutputStream(outPath);
|
||||
byte[] buf=new byte[4*1024];
|
||||
int len;
|
||||
while((len=in.read(buf))>=0){
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解压失败:{0}",e.getMessage());
|
||||
}finally{
|
||||
try {
|
||||
if(zip!=null)
|
||||
zip.close();
|
||||
if(in!=null)
|
||||
in.close();
|
||||
if(out!=null)
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
log.error("未知错误:{0}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void zipFolder(String folder,String outPutFile){
|
||||
ZipOutputStream zip = null;
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(outPutFile);
|
||||
zip = new ZipOutputStream(fileOutputStream);
|
||||
addFolderToZip("", folder, zip);
|
||||
zip.flush();
|
||||
zip.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addFileToZip(String path,String srcFile,ZipOutputStream zip) throws Exception{
|
||||
File folder = new File(srcFile);
|
||||
if (folder.isDirectory()) {
|
||||
addFolderToZip(path, srcFile, zip);
|
||||
} else {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
FileInputStream in = new FileInputStream(srcFile);
|
||||
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
zip.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws Exception {
|
||||
File folder = new File(srcFolder);
|
||||
if (null != path && folder.isDirectory()) {
|
||||
for (String fileName : folder.list()) {
|
||||
if ("".equals(path)) {
|
||||
addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip);
|
||||
} else {
|
||||
addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取图片
|
||||
*
|
||||
* @param src 输入路径
|
||||
* @param dest 输出路径
|
||||
* @param w 宽度
|
||||
|
@ -185,6 +78,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取所有附件
|
||||
*
|
||||
* @param filePath filePath
|
||||
* @return Map
|
||||
*/
|
||||
|
@ -212,6 +106,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取所有主题
|
||||
*
|
||||
* @return list
|
||||
*/
|
||||
public static List<Theme> getThemes(){
|
||||
|
@ -246,6 +141,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取主题下的模板文件名
|
||||
*
|
||||
* @param theme theme
|
||||
* @return list
|
||||
*/
|
||||
|
@ -281,6 +177,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param filePath filePath
|
||||
* @return string
|
||||
*/
|
||||
|
@ -301,6 +198,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 移除文件
|
||||
*
|
||||
* @param fileName fileName
|
||||
* @return true or false
|
||||
*/
|
||||
|
@ -314,6 +212,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 移除非空文件夹
|
||||
*
|
||||
* @param dir dir
|
||||
* @return boolean
|
||||
*/
|
||||
|
@ -333,6 +232,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取当前时间
|
||||
*
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String getStringDate(String format) {
|
||||
|
@ -346,17 +246,9 @@ public class HaloUtil {
|
|||
return Instant.ofEpochSecond(unixTime).atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern(format));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
* @return 日期类型
|
||||
*/
|
||||
public static Date getDate() {
|
||||
Date date = new Date();
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取html中的文字
|
||||
*
|
||||
* @param html html
|
||||
* @return string
|
||||
*/
|
||||
|
@ -369,6 +261,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 提取文章摘要
|
||||
*
|
||||
* @param html html
|
||||
* @param summary summary
|
||||
* @return string
|
||||
|
@ -379,6 +272,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* md5加密字符串
|
||||
*
|
||||
* @param str str
|
||||
* @return MD5
|
||||
*/
|
||||
|
@ -398,6 +292,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 2进制转16进制
|
||||
*
|
||||
* @param bytes bytes
|
||||
* @return string
|
||||
*/
|
||||
|
@ -419,6 +314,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取客户端ip地址
|
||||
*
|
||||
* @param request request
|
||||
* @return string
|
||||
*/
|
||||
|
@ -438,6 +334,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 备份数据库
|
||||
*
|
||||
* @param hostIp ip
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
|
@ -507,6 +404,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 生成rss
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
* @throws FeedException
|
||||
|
@ -557,6 +455,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 获取sitemap
|
||||
*
|
||||
* @param posts posts
|
||||
* @return string
|
||||
*/
|
||||
|
@ -574,6 +473,7 @@ public class HaloUtil {
|
|||
|
||||
/**
|
||||
* 配置邮件
|
||||
*
|
||||
* @param smtpHost smtpHost
|
||||
* @param userName 邮件地址
|
||||
* @param password 密码
|
||||
|
@ -584,33 +484,11 @@ public class HaloUtil {
|
|||
OhMyEmail.config(properties,userName,password);
|
||||
}
|
||||
|
||||
// public static String importMarkdowns(String filePath) throws Exception{
|
||||
// File file = new File(filePath);
|
||||
// FileReader reader = new FileReader(file);
|
||||
// BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
// StringBuffer stringBuffer = new StringBuffer();
|
||||
// String s = "";
|
||||
// while ((s = bufferedReader.readLine())!=null){
|
||||
// stringBuffer.append(s+"\n");
|
||||
// }
|
||||
// bufferedReader.close();
|
||||
// String str = stringBuffer.toString();
|
||||
// return str;
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) throws Exception{
|
||||
// String content = importMarkdowns("/Users/ryan0up/Desktop/hello-hexo.md");
|
||||
// String matter = StringUtils.substringBetween(content,"---","---");
|
||||
// String[] strs = matter.split("\n");
|
||||
// for(String str:strs){
|
||||
// System.out.println(StringUtils.substringBetween("title","\n","\n"));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 访问路径获取json数据
|
||||
* @param url
|
||||
* @return
|
||||
*
|
||||
* @param enterUrl 路径
|
||||
* @return string
|
||||
*/
|
||||
public static String getHttpResponse(String enterUrl) {
|
||||
BufferedReader in = null;
|
||||
|
@ -645,7 +523,7 @@ public class HaloUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 百度实时推送
|
||||
* 百度主动推送
|
||||
*
|
||||
* @param blogUrl 博客地址
|
||||
* @param token 百度推送token
|
|
@ -0,0 +1,167 @@
|
|||
package cc.ryanc.halo.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/5/11
|
||||
* Zip压缩工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class ZipUtils {
|
||||
|
||||
/**
|
||||
* 解压Zip文件到指定目录
|
||||
*
|
||||
* @param zipFilePath 压缩文件的路径
|
||||
* @param descDir 解压的路径
|
||||
*/
|
||||
public static void unZip(String zipFilePath,String descDir){
|
||||
File zipFile=new File(zipFilePath);
|
||||
File pathFile=new File(descDir);
|
||||
if(!pathFile.exists()){
|
||||
pathFile.mkdirs();
|
||||
}
|
||||
ZipFile zip=null;
|
||||
InputStream in=null;
|
||||
OutputStream out=null;
|
||||
try {
|
||||
zip=new ZipFile(zipFile);
|
||||
Enumeration<?> entries=zip.entries();
|
||||
while(entries.hasMoreElements()){
|
||||
ZipEntry entry=(ZipEntry) entries.nextElement();
|
||||
String zipEntryName=entry.getName();
|
||||
in=zip.getInputStream(entry);
|
||||
|
||||
String outPath=(descDir+"/"+zipEntryName).replace("\\*", "/");
|
||||
File file=new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||
if(!file.exists()){
|
||||
file.mkdirs();
|
||||
}
|
||||
if(new File(outPath).isDirectory()){
|
||||
continue;
|
||||
}
|
||||
out=new FileOutputStream(outPath);
|
||||
byte[] buf=new byte[4*1024];
|
||||
int len;
|
||||
while((len=in.read(buf))>=0){
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解压失败:{0}",e.getMessage());
|
||||
}finally{
|
||||
try {
|
||||
if(zip!=null)
|
||||
zip.close();
|
||||
if(in!=null)
|
||||
in.close();
|
||||
if(out!=null)
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
log.error("未知错误:{0}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩目录
|
||||
* https://github.com/otale/tale/blob/master/src/main/java/com/tale/utils/ZipUtils.java
|
||||
*
|
||||
* @param srcFolder 目录路径
|
||||
* @param destZipFile 输出路径
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void zipFolder(String srcFolder, String destZipFile) throws Exception {
|
||||
ZipOutputStream zip = null;
|
||||
FileOutputStream fileWriter = null;
|
||||
|
||||
fileWriter = new FileOutputStream(destZipFile);
|
||||
zip = new ZipOutputStream(fileWriter);
|
||||
|
||||
addFolderToZip("", srcFolder, zip);
|
||||
zip.flush();
|
||||
zip.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩文件
|
||||
* https://github.com/otale/tale/blob/master/src/main/java/com/tale/utils/ZipUtils.java
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param zipPath 输出路径
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void zipFile(String filePath, String zipPath) throws Exception{
|
||||
byte[] buffer = new byte[1024];
|
||||
FileOutputStream fos = new FileOutputStream(zipPath);
|
||||
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||
ZipEntry ze= new ZipEntry("spy.log");
|
||||
zos.putNextEntry(ze);
|
||||
FileInputStream in = new FileInputStream(filePath);
|
||||
int len;
|
||||
while ((len = in.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, len);
|
||||
}
|
||||
in.close();
|
||||
zos.closeEntry();
|
||||
//remember close it
|
||||
zos.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文件到Zip压缩文件
|
||||
* https://github.com/otale/tale/blob/master/src/main/java/com/tale/utils/ZipUtils.java
|
||||
*
|
||||
* @param path path
|
||||
* @param srcFile srcFile
|
||||
* @param zip zip
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void addFileToZip(String path, String srcFile, ZipOutputStream zip)
|
||||
throws Exception {
|
||||
|
||||
File folder = new File(srcFile);
|
||||
if (folder.isDirectory()) {
|
||||
addFolderToZip(path, srcFile, zip);
|
||||
} else {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
FileInputStream in = new FileInputStream(srcFile);
|
||||
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
zip.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加目录到zip压缩文件
|
||||
* https://github.com/otale/tale/blob/master/src/main/java/com/tale/utils/ZipUtils.java
|
||||
*
|
||||
* @param path path
|
||||
* @param srcFolder srcFolder
|
||||
* @param zip zip
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws Exception {
|
||||
File folder = new File(srcFolder);
|
||||
if (null != path && folder.isDirectory()) {
|
||||
for (String fileName : folder.list()) {
|
||||
if ("".equals(path)) {
|
||||
addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip);
|
||||
} else {
|
||||
addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ import cc.ryanc.halo.service.CommentService;
|
|||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -129,16 +129,16 @@ public class AdminController extends BaseController {
|
|||
Pattern patternEmail = Pattern.compile("\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}");
|
||||
Matcher matcher = patternEmail.matcher(loginName);
|
||||
if (matcher.find()) {
|
||||
user = userService.userLoginByEmail(loginName, HaloUtil.getMD5(loginPwd)).get(0);
|
||||
user = userService.userLoginByEmail(loginName, HaloUtils.getMD5(loginPwd)).get(0);
|
||||
} else {
|
||||
user = userService.userLoginByName(loginName, HaloUtil.getMD5(loginPwd)).get(0);
|
||||
user = userService.userLoginByName(loginName, HaloUtils.getMD5(loginPwd)).get(0);
|
||||
}
|
||||
if (aUser == user) {
|
||||
session.setAttribute(HaloConst.USER_SESSION_KEY, user);
|
||||
//重置用户的登录状态为正常
|
||||
userService.updateUserNormal();
|
||||
userService.updateUserLoginLast(new Date());
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN, LogsRecord.LOGIN_SUCCESS, HaloUtil.getIpAddr(request), HaloUtil.getDate()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN, LogsRecord.LOGIN_SUCCESS, HaloUtils.getIpAddr(request), new Date()));
|
||||
status = "true";
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class AdminController extends BaseController {
|
|||
userService.updateUserLoginEnable("false");
|
||||
}
|
||||
userService.updateUserLoginLast(new Date());
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN, LogsRecord.LOGIN_ERROR + "[" + loginName + "," + loginPwd + "]", HaloUtil.getIpAddr(request), new Date()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN, LogsRecord.LOGIN_ERROR + "[" + loginName + "," + loginPwd + "]", HaloUtils.getIpAddr(request), new Date()));
|
||||
log.error("登录失败!:{0}", e.getMessage());
|
||||
}
|
||||
return status;
|
||||
|
@ -163,7 +163,7 @@ public class AdminController extends BaseController {
|
|||
@GetMapping(value = "/logOut")
|
||||
public String logOut(HttpSession session) {
|
||||
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGOUT, user.getUserName(), HaloUtil.getIpAddr(request), HaloUtil.getDate()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.LOGOUT, user.getUserName(), HaloUtils.getIpAddr(request), new Date()));
|
||||
session.invalidate();
|
||||
log.info("用户[" + user.getUserName() + "]退出登录");
|
||||
return "redirect:/admin/login";
|
||||
|
|
|
@ -6,7 +6,7 @@ import cc.ryanc.halo.model.dto.HaloConst;
|
|||
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||
import cc.ryanc.halo.service.AttachmentService;
|
||||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
@ -25,6 +25,7 @@ import javax.websocket.server.PathParam;
|
|||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -133,7 +134,7 @@ public class AttachmentController {
|
|||
try {
|
||||
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
StringBuffer sbMedia = new StringBuffer("upload/");
|
||||
sbMedia.append(HaloUtil.YEAR).append("/").append(HaloUtil.MONTH).append("/");
|
||||
sbMedia.append(HaloUtils.YEAR).append("/").append(HaloUtils.MONTH).append("/");
|
||||
File mediaPath = new File(basePath.getAbsolutePath(), sbMedia.toString());
|
||||
if (!mediaPath.exists()) {
|
||||
mediaPath.mkdirs();
|
||||
|
@ -146,27 +147,27 @@ public class AttachmentController {
|
|||
//保存在数据库
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setAttachName(fileName);
|
||||
attachment.setAttachPath(new StringBuffer("/upload/").append(HaloUtil.YEAR).append("/").append(HaloUtil.MONTH).append("/").append(fileName).toString());
|
||||
attachment.setAttachPath(new StringBuffer("/upload/").append(HaloUtils.YEAR).append("/").append(HaloUtils.MONTH).append("/").append(fileName).toString());
|
||||
System.out.println(mediaPath.getAbsolutePath() + "/" + fileName);
|
||||
//判断图片大小,如果长宽都小于500,则保存原始图片路径
|
||||
BufferedImage sourceImg = ImageIO.read(new FileInputStream(mediaPath.getPath() + "/" + fileName));
|
||||
if (sourceImg.getWidth() < 500 || sourceImg.getHeight() < 500) {
|
||||
attachment.setAttachSmallPath(new StringBuffer("/upload/").append(HaloUtil.YEAR).append("/").append(HaloUtil.MONTH).append("/").append(fileName).toString());
|
||||
attachment.setAttachSmallPath(new StringBuffer("/upload/").append(HaloUtils.YEAR).append("/").append(HaloUtils.MONTH).append("/").append(fileName).toString());
|
||||
} else {
|
||||
attachment.setAttachSmallPath(new StringBuffer("/upload/").append(HaloUtil.YEAR).append("/").append(HaloUtil.MONTH).append("/").append(nameWithOutSuffix).append("_small.").append(fileSuffix).toString());
|
||||
attachment.setAttachSmallPath(new StringBuffer("/upload/").append(HaloUtils.YEAR).append("/").append(HaloUtils.MONTH).append("/").append(nameWithOutSuffix).append("_small.").append(fileSuffix).toString());
|
||||
//剪裁图片
|
||||
HaloUtil.cutCenterImage(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(fileName).toString(), new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(nameWithOutSuffix).append("_small.").append(fileSuffix).toString(), 500, 500, fileSuffix);
|
||||
HaloUtils.cutCenterImage(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(fileName).toString(), new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(nameWithOutSuffix).append("_small.").append(fileSuffix).toString(), 500, 500, fileSuffix);
|
||||
}
|
||||
|
||||
attachment.setAttachType(file.getContentType());
|
||||
attachment.setAttachSuffix(new StringBuffer(".").append(fileSuffix).toString());
|
||||
attachment.setAttachCreated(HaloUtil.getDate());
|
||||
attachment.setAttachCreated(new Date());
|
||||
attachmentService.saveByAttachment(attachment);
|
||||
|
||||
updateConst();
|
||||
log.info("上传文件[" + file.getOriginalFilename() + "]到[" + mediaPath.getAbsolutePath() + "]成功");
|
||||
logsService.saveByLogs(
|
||||
new Logs(LogsRecord.UPLOAD_FILE, file.getOriginalFilename(), HaloUtil.getIpAddr(request), HaloUtil.getDate())
|
||||
new Logs(LogsRecord.UPLOAD_FILE, file.getOriginalFilename(), HaloUtils.getIpAddr(request), new Date())
|
||||
);
|
||||
|
||||
result.put("success", 1);
|
||||
|
@ -238,7 +239,7 @@ public class AttachmentController {
|
|||
updateConst();
|
||||
log.info("删除文件[" + delFileName + "]成功!");
|
||||
logsService.saveByLogs(
|
||||
new Logs(LogsRecord.REMOVE_FILE, delFileName, HaloUtil.getIpAddr(request), HaloUtil.getDate())
|
||||
new Logs(LogsRecord.REMOVE_FILE, delFileName, HaloUtils.getIpAddr(request), new Date())
|
||||
);
|
||||
} else {
|
||||
log.error("删除附件[" + delFileName + "]失败!");
|
||||
|
|
|
@ -3,7 +3,7 @@ package cc.ryanc.halo.web.controller.admin;
|
|||
import cc.ryanc.halo.model.domain.Post;
|
||||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -46,11 +46,11 @@ public class BackupController {
|
|||
*/
|
||||
@GetMapping(value = "/backupDb")
|
||||
public String backupDatabase() {
|
||||
String fileName = "db_backup_" + HaloUtil.getStringDate("yyyy_MM_dd_HH_mm_ss") + ".sql";
|
||||
String fileName = "db_backup_" + HaloUtils.getStringDate("yyyy_MM_dd_HH_mm_ss") + ".sql";
|
||||
try {
|
||||
File path = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
String savePath = path.getAbsolutePath() + "/backup/database";
|
||||
HaloUtil.exportDatabase("localhost", "root", "123456", savePath, fileName, "testdb");
|
||||
HaloUtils.exportDatabase("localhost", "root", "123456", savePath, fileName, "testdb");
|
||||
} catch (Exception e) {
|
||||
log.error("未知错误:{0}", e.getMessage());
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ public class BackupController {
|
|||
List<Post> posts = postService.findAllPosts(HaloConst.POST_TYPE_POST);
|
||||
try {
|
||||
File path = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
String savePath = path.getAbsolutePath() + "/backup/posts/posts_backup_" + HaloUtil.getStringDate("yyyy_MM_dd_HH_mm_ss");
|
||||
String savePath = path.getAbsolutePath() + "/backup/posts/posts_backup_" + HaloUtils.getStringDate("yyyy_MM_dd_HH_mm_ss");
|
||||
for (Post post : posts) {
|
||||
HaloUtil.dbToFile(post.getPostContentMd(), savePath, post.getPostTitle() + ".md");
|
||||
HaloUtils.dbToFile(post.getPostContentMd(), savePath, post.getPostTitle() + ".md");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -28,12 +28,10 @@ public class CategoryController {
|
|||
/**
|
||||
* 查询所有分类并渲染category页面
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_category
|
||||
*/
|
||||
@GetMapping
|
||||
public String categories(Model model) {
|
||||
model.addAttribute("statusName", "添加");
|
||||
public String categories() {
|
||||
return "admin/admin_category";
|
||||
}
|
||||
|
||||
|
@ -94,7 +92,6 @@ public class CategoryController {
|
|||
public String toEditCategory(Model model, @PathParam("cateId") Long cateId) {
|
||||
Optional<Category> category = categoryService.findByCateId(cateId);
|
||||
model.addAttribute("updateCategory", category.get());
|
||||
model.addAttribute("statusName", "修改");
|
||||
return "admin/admin_category";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import cc.ryanc.halo.service.CommentService;
|
|||
import cc.ryanc.halo.service.MailService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -191,8 +191,8 @@ public class CommentController extends BaseController{
|
|||
comment.setCommentAuthor(user.getUserDisplayName());
|
||||
comment.setCommentAuthorEmail(user.getUserEmail());
|
||||
comment.setCommentAuthorUrl(HaloConst.OPTIONS.get("blog_url"));
|
||||
comment.setCommentAuthorIp(HaloUtil.getIpAddr(request));
|
||||
comment.setCommentAuthorAvatarMd5(HaloUtil.getMD5(userService.findUser().getUserEmail()));
|
||||
comment.setCommentAuthorIp(HaloUtils.getIpAddr(request));
|
||||
comment.setCommentAuthorAvatarMd5(HaloUtils.getMD5(userService.findUser().getUserEmail()));
|
||||
comment.setCommentDate(new Date());
|
||||
String lastContent = " //<a href='#comment-id-"+lastComment.getCommentId()+"'>@"+lastComment.getCommentAuthor()+"</a>:"+lastComment.getCommentContent();
|
||||
comment.setCommentContent(commentContent+lastContent);
|
||||
|
|
|
@ -7,7 +7,7 @@ import cc.ryanc.halo.service.GalleryService;
|
|||
import cc.ryanc.halo.service.LinkService;
|
||||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -67,14 +68,10 @@ public class PageController {
|
|||
/**
|
||||
* 获取友情链接列表并渲染页面
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_page_link
|
||||
*/
|
||||
@GetMapping(value = "/links")
|
||||
public String links(Model model) {
|
||||
List<Link> links = linkService.findAllLinks();
|
||||
model.addAttribute("links", links);
|
||||
model.addAttribute("statusName", "添加");
|
||||
public String links() {
|
||||
return "admin/admin_page_link";
|
||||
}
|
||||
|
||||
|
@ -87,11 +84,8 @@ public class PageController {
|
|||
*/
|
||||
@GetMapping("/links/edit")
|
||||
public String toEditLink(Model model, @PathParam("linkId") Long linkId) {
|
||||
List<Link> links = linkService.findAllLinks();
|
||||
Optional<Link> link = linkService.findByLinkId(linkId);
|
||||
model.addAttribute("updateLink", link.get());
|
||||
model.addAttribute("statusName", "修改");
|
||||
model.addAttribute("links", links);
|
||||
return "admin/admin_page_link";
|
||||
}
|
||||
|
||||
|
@ -206,7 +200,7 @@ public class PageController {
|
|||
* @return 模板路径admin/admin_page_md_editor
|
||||
*/
|
||||
@GetMapping(value = "/new")
|
||||
public String newPage(Model model) {
|
||||
public String newPage() {
|
||||
return "admin/admin_page_md_editor";
|
||||
}
|
||||
|
||||
|
@ -220,13 +214,13 @@ public class PageController {
|
|||
@ResponseBody
|
||||
public void pushPage(@ModelAttribute Post post, HttpSession session) {
|
||||
try {
|
||||
post.setPostDate(HaloUtil.getDate());
|
||||
post.setPostDate(new Date());
|
||||
//发表用户
|
||||
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
||||
post.setUser(user);
|
||||
post.setPostType(HaloConst.POST_TYPE_PAGE);
|
||||
postService.saveByPost(post);
|
||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST, post.getPostTitle(), HaloUtil.getIpAddr(request), HaloUtil.getDate()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST, post.getPostTitle(), HaloUtils.getIpAddr(request), new Date()));
|
||||
} catch (Exception e) {
|
||||
log.error("未知错误:{0}", e.getMessage());
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import cc.ryanc.halo.service.CategoryService;
|
|||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.TagService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -118,15 +119,10 @@ public class PostController extends BaseController{
|
|||
/**
|
||||
* 处理跳转到新建文章页面
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_editor
|
||||
*/
|
||||
@GetMapping(value = "/new")
|
||||
public String newPost(Model model){
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
List<Tag> tags = tagService.findAllTags();
|
||||
model.addAttribute("categories",categories);
|
||||
model.addAttribute("tags",tags);
|
||||
public String newPost(){
|
||||
return "admin/admin_post_md_editor";
|
||||
}
|
||||
|
||||
|
@ -161,22 +157,22 @@ public class PostController extends BaseController{
|
|||
try{
|
||||
//提取摘要
|
||||
int postSummary = 50;
|
||||
if(HaloUtil.isNotNull(HaloConst.OPTIONS.get("post_summary"))){
|
||||
if(StringUtils.isNotEmpty(HaloConst.OPTIONS.get("post_summary"))){
|
||||
postSummary = Integer.parseInt(HaloConst.OPTIONS.get("post_summary"));
|
||||
}
|
||||
String summaryText = HaloUtil.htmlToText(post.getPostContent());
|
||||
String summaryText = HaloUtils.htmlToText(post.getPostContent());
|
||||
if(summaryText.length()>postSummary){
|
||||
String summary = HaloUtil.getSummary(post.getPostContent(), postSummary);
|
||||
String summary = HaloUtils.getSummary(post.getPostContent(), postSummary);
|
||||
post.setPostSummary(summary);
|
||||
}else{
|
||||
post.setPostSummary(summaryText);
|
||||
}
|
||||
if(null!=post.getPostId()){
|
||||
post.setPostDate(postService.findByPostId(post.getPostId()).get().getPostDate());
|
||||
post.setPostUpdate(HaloUtil.getDate());
|
||||
post.setPostUpdate(new Date());
|
||||
}else{
|
||||
post.setPostDate(HaloUtil.getDate());
|
||||
post.setPostUpdate(HaloUtil.getDate());
|
||||
post.setPostDate(new Date());
|
||||
post.setPostUpdate(new Date());
|
||||
}
|
||||
post.setUser(user);
|
||||
List<Category> categories = categoryService.strListToCateList(cateList);
|
||||
|
@ -187,7 +183,7 @@ public class PostController extends BaseController{
|
|||
}
|
||||
post.setPostUrl(urlFilter(post.getPostUrl()));
|
||||
postService.saveByPost(post);
|
||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST,post.getPostTitle(),HaloUtil.getIpAddr(request),HaloUtil.getDate()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST,post.getPostTitle(),HaloUtils.getIpAddr(request),new Date()));
|
||||
}catch (Exception e){
|
||||
log.error("未知错误:", e.getMessage());
|
||||
}
|
||||
|
@ -240,7 +236,7 @@ public class PostController extends BaseController{
|
|||
try{
|
||||
Optional<Post> post = postService.findByPostId(postId);
|
||||
postService.removeByPostId(postId);
|
||||
logsService.saveByLogs(new Logs(LogsRecord.REMOVE_POST,post.get().getPostTitle(),HaloUtil.getIpAddr(request),HaloUtil.getDate()));
|
||||
logsService.saveByLogs(new Logs(LogsRecord.REMOVE_POST,post.get().getPostTitle(),HaloUtils.getIpAddr(request),new Date()));
|
||||
}catch (Exception e){
|
||||
log.error("未知错误:{0}",e.getMessage());
|
||||
}
|
||||
|
@ -261,8 +257,6 @@ public class PostController extends BaseController{
|
|||
public String editPost(@PathParam("postId") Long postId, Model model){
|
||||
Optional<Post> post = postService.findByPostId(postId);
|
||||
model.addAttribute("post",post.get());
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
model.addAttribute("categories",categories);
|
||||
return "admin/admin_post_md_editor";
|
||||
}
|
||||
|
||||
|
@ -319,7 +313,7 @@ public class PostController extends BaseController{
|
|||
urls.append(post.getPostUrl());
|
||||
urls.append("\n");
|
||||
}
|
||||
String result = HaloUtil.baiduPost(blogUrl, baiduToken, urls.toString());
|
||||
String result = HaloUtils.baiduPost(blogUrl, baiduToken, urls.toString());
|
||||
if (StringUtils.isEmpty(result)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.springframework.ui.Model;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
|
@ -28,14 +27,10 @@ public class TagController {
|
|||
/**
|
||||
* 渲染标签管理页面
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径admin/admin_tag
|
||||
*/
|
||||
@GetMapping
|
||||
public String tags(Model model) {
|
||||
List<Tag> tags = tagService.findAllTags();
|
||||
model.addAttribute("tags", tags);
|
||||
model.addAttribute("statusName", "新增");
|
||||
public String tags() {
|
||||
return "admin/admin_tag";
|
||||
}
|
||||
|
||||
|
@ -94,11 +89,8 @@ public class TagController {
|
|||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String toEditTag(Model model, @PathParam("tagId") Long tagId) {
|
||||
List<Tag> tags = tagService.findAllTags();
|
||||
Tag tag = tagService.findByTagId(tagId).get();
|
||||
model.addAttribute("statusName", "修改");
|
||||
model.addAttribute("updateTag", tag);
|
||||
model.addAttribute("tags", tags);
|
||||
return "admin/admin_tag";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import cc.ryanc.halo.model.dto.HaloConst;
|
|||
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||
import cc.ryanc.halo.service.LogsService;
|
||||
import cc.ryanc.halo.service.OptionsService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import cc.ryanc.halo.utils.ZipUtils;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
|
||||
|
@ -21,6 +22,7 @@ import javax.websocket.server.PathParam;
|
|||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -73,7 +75,7 @@ public class ThemeController extends BaseController {
|
|||
BaseController.THEME = siteTheme;
|
||||
log.info("已将主题改变为:" + siteTheme);
|
||||
logsService.saveByLogs(
|
||||
new Logs(LogsRecord.CHANGE_THEME, "更换为" + siteTheme, HaloUtil.getIpAddr(request), HaloUtil.getDate())
|
||||
new Logs(LogsRecord.CHANGE_THEME, "更换为" + siteTheme, HaloUtils.getIpAddr(request), new Date())
|
||||
);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
@ -101,12 +103,12 @@ public class ThemeController extends BaseController {
|
|||
file.transferTo(themePath);
|
||||
log.info("上传主题成功,路径:" + themePath.getAbsolutePath());
|
||||
logsService.saveByLogs(
|
||||
new Logs(LogsRecord.UPLOAD_THEME, file.getOriginalFilename(), HaloUtil.getIpAddr(request), HaloUtil.getDate())
|
||||
new Logs(LogsRecord.UPLOAD_THEME, file.getOriginalFilename(), HaloUtils.getIpAddr(request), new Date())
|
||||
);
|
||||
HaloUtil.unZip(themePath.getAbsolutePath(), new File(basePath.getAbsolutePath(), "templates/themes/").getAbsolutePath());
|
||||
HaloUtil.removeFile(themePath.getAbsolutePath());
|
||||
ZipUtils.unZip(themePath.getAbsolutePath(), new File(basePath.getAbsolutePath(), "templates/themes/").getAbsolutePath());
|
||||
HaloUtils.removeFile(themePath.getAbsolutePath());
|
||||
HaloConst.THEMES.clear();
|
||||
HaloConst.THEMES = HaloUtil.getThemes();
|
||||
HaloConst.THEMES = HaloUtils.getThemes();
|
||||
return true;
|
||||
} else {
|
||||
log.error("上传主题失败,没有选择文件");
|
||||
|
@ -128,9 +130,9 @@ public class ThemeController extends BaseController {
|
|||
try {
|
||||
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
File themePath = new File(basePath.getAbsolutePath(), "templates/themes/" + themeName);
|
||||
HaloUtil.removeDir(themePath);
|
||||
HaloUtils.removeDir(themePath);
|
||||
HaloConst.THEMES.clear();
|
||||
HaloConst.THEMES = HaloUtil.getThemes();
|
||||
HaloConst.THEMES = HaloUtils.getThemes();
|
||||
} catch (Exception e) {
|
||||
log.error("删除主题失败:{0}", e.getMessage());
|
||||
}
|
||||
|
@ -156,7 +158,7 @@ public class ThemeController extends BaseController {
|
|||
*/
|
||||
@GetMapping(value = "/editor")
|
||||
public String editor(Model model) {
|
||||
List<String> tpls = HaloUtil.getTplName(BaseController.THEME);
|
||||
List<String> tpls = HaloUtils.getTplName(BaseController.THEME);
|
||||
model.addAttribute("tpls", tpls);
|
||||
return "admin/admin_theme-editor";
|
||||
}
|
||||
|
@ -176,7 +178,7 @@ public class ThemeController extends BaseController {
|
|||
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
//获取主题路径
|
||||
File themesPath = new File(basePath.getAbsolutePath(), new StringBuffer("templates/themes/").append(BaseController.THEME).append("/").append(tplName).toString());
|
||||
tplContent = HaloUtil.getFileContent(themesPath.getAbsolutePath());
|
||||
tplContent = HaloUtils.getFileContent(themesPath.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
log.error("获取模板文件错误:{0}", e.getMessage());
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package cc.ryanc.halo.web.controller.admin;
|
|||
|
||||
import cc.ryanc.halo.model.domain.User;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import freemarker.template.Configuration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -79,9 +79,9 @@ public class UserController {
|
|||
@ModelAttribute("userId") Long userId,
|
||||
HttpSession session) {
|
||||
try {
|
||||
User user = userService.findByUserIdAndUserPass(userId, HaloUtil.getMD5(beforePass));
|
||||
User user = userService.findByUserIdAndUserPass(userId, HaloUtils.getMD5(beforePass));
|
||||
if (null != user) {
|
||||
user.setUserPass(HaloUtil.getMD5(newPass));
|
||||
user.setUserPass(HaloUtils.getMD5(newPass));
|
||||
userService.saveByUser(user);
|
||||
session.invalidate();
|
||||
} else {
|
||||
|
|
|
@ -4,7 +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.service.*;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import freemarker.template.Configuration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -106,7 +106,7 @@ public class InstallController {
|
|||
}
|
||||
user.setUserDisplayName(userDisplayName);
|
||||
user.setUserEmail(userEmail);
|
||||
user.setUserPass(HaloUtil.getMD5(userPwd));
|
||||
user.setUserPass(HaloUtils.getMD5(userPwd));
|
||||
userService.saveByUser(user);
|
||||
|
||||
//默认分类
|
||||
|
@ -157,7 +157,7 @@ public class InstallController {
|
|||
optionsService.saveOption("theme", "anatole");
|
||||
|
||||
//建立网站时间
|
||||
optionsService.saveOption("blog_start", HaloUtil.getStringDate("yyyy-MM-dd"));
|
||||
optionsService.saveOption("blog_start", HaloUtils.getStringDate("yyyy-MM-dd"));
|
||||
|
||||
//默认评论系统
|
||||
optionsService.saveOption("comment_system", "native");
|
||||
|
@ -175,8 +175,8 @@ public class InstallController {
|
|||
new Logs(
|
||||
LogsRecord.INSTALL,
|
||||
"安装成功,欢迎使用Halo。",
|
||||
HaloUtil.getIpAddr(request),
|
||||
HaloUtil.getDate()
|
||||
HaloUtils.getIpAddr(request),
|
||||
new Date()
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import cc.ryanc.halo.service.CommentService;
|
|||
import cc.ryanc.halo.service.MailService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import cc.ryanc.halo.util.HaloUtil;
|
||||
import cc.ryanc.halo.utils.HaloUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -74,13 +74,14 @@ public class FrontCommentController {
|
|||
public boolean newComment(@ModelAttribute("comment") Comment comment,
|
||||
@ModelAttribute("post") Post post,
|
||||
HttpServletRequest request) {
|
||||
post = postService.findByPostId(post.getPostId()).get();
|
||||
if (StringUtils.isBlank(comment.getCommentAuthor())) {
|
||||
comment.setCommentAuthor("小猪佩琪");
|
||||
}
|
||||
comment.setCommentAuthorEmail(comment.getCommentAuthorEmail().toLowerCase());
|
||||
comment.setPost(post);
|
||||
comment.setCommentDate(new Date());
|
||||
comment.setCommentAuthorIp(HaloUtil.getIpAddr(request));
|
||||
comment.setCommentAuthorIp(HaloUtils.getIpAddr(request));
|
||||
comment.setIsAdmin(0);
|
||||
commentService.saveByComment(comment);
|
||||
|
||||
|
@ -89,7 +90,7 @@ public class FrontCommentController {
|
|||
//发送邮件到博主
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("author", userService.findUser().getUserDisplayName());
|
||||
map.put("pageName", postService.findByPostId(post.getPostId()).get().getPostTitle());
|
||||
map.put("pageName", post.getPostTitle());
|
||||
map.put("pageUrl", HaloConst.OPTIONS.get("blog_url")+"/archives/"+post.getPostUrl()+"#comment-id-"+comment.getCommentId());
|
||||
map.put("visitor", comment.getCommentAuthor());
|
||||
map.put("commentContent", comment.getCommentContent());
|
||||
|
|
|
@ -2,12 +2,10 @@ package cc.ryanc.halo.web.controller.front;
|
|||
|
||||
import cc.ryanc.halo.model.domain.Comment;
|
||||
import cc.ryanc.halo.model.domain.Gallery;
|
||||
import cc.ryanc.halo.model.domain.Link;
|
||||
import cc.ryanc.halo.model.domain.Post;
|
||||
import cc.ryanc.halo.model.dto.HaloConst;
|
||||
import cc.ryanc.halo.service.CommentService;
|
||||
import cc.ryanc.halo.service.GalleryService;
|
||||
import cc.ryanc.halo.service.LinkService;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -36,9 +34,6 @@ public class FrontPageController extends BaseController {
|
|||
@Autowired
|
||||
private PostService postService;
|
||||
|
||||
@Autowired
|
||||
private LinkService linkService;
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
|
||||
|
@ -57,14 +52,10 @@ public class FrontPageController extends BaseController {
|
|||
/**
|
||||
* 友情链接
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径/themes/{theme}/links
|
||||
*/
|
||||
@GetMapping(value = "/links")
|
||||
public String links(Model model) {
|
||||
//所有友情链接
|
||||
List<Link> links = linkService.findAllLinks();
|
||||
model.addAttribute("links", links);
|
||||
public String links() {
|
||||
return this.render("links");
|
||||
}
|
||||
|
||||
|
|
|
@ -38,14 +38,10 @@ public class FrontTagController extends BaseController {
|
|||
/**
|
||||
* 标签
|
||||
*
|
||||
* @param model model
|
||||
* @return 模板路径/themes/{theme}/tags
|
||||
*/
|
||||
@GetMapping
|
||||
public String tags(Model model) {
|
||||
//所有标签
|
||||
List<Tag> tags = tagService.findAllTags();
|
||||
model.addAttribute("tags", tags);
|
||||
public String tags() {
|
||||
return this.render("tags");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ spring:
|
|||
settings:
|
||||
web-allow-others: true
|
||||
path: /h2-console
|
||||
enabled: true
|
||||
enabled: false
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<#list attachments.content as attachment>
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-6 div-thumbnail" onclick="openDetail(${attachment.attachId})">
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-6 div-thumbnail" onclick="openDetail(${attachment.attachId?c})">
|
||||
<a href="#" class="thumbnail">
|
||||
<img src="${attachment.attachSmallPath?if_exists}" class="img-responsive">
|
||||
</a>
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">${statusName}分类目录<#if updateCategory??>[${updateCategory.cateName}]</#if></h3>
|
||||
</div>
|
||||
<#if updateCategory??>
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">修改分类目录<#if updateCategory??>[${updateCategory.cateName}]</#if></h3>
|
||||
</div>
|
||||
<form action="/admin/category/save" method="post" role="form" id="cateAddForm">
|
||||
<input type="hidden" name="cateId" value="${updateCategory.cateId}">
|
||||
<input type="hidden" name="cateId" value="${updateCategory.cateId?c}">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">名称</label>
|
||||
|
@ -49,11 +49,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定修改</button>
|
||||
<a data-pjax="true" href="/admin/category" class="btn btn-info btn-sm ">返回添加</a>
|
||||
</div>
|
||||
</form>
|
||||
<#else >
|
||||
<#else >
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">添加分类目录</h3>
|
||||
</div>
|
||||
<form action="/admin/category/save" method="post" role="form" id="cateAddForm" onsubmit="return checkCate()">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
|
@ -73,7 +76,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定添加</button>
|
||||
</div>
|
||||
</form>
|
||||
</#if>
|
||||
|
@ -97,22 +100,24 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<@commonTag method="categories">
|
||||
<#list categories as cate>
|
||||
<tr>
|
||||
<td>${cate.cateName}</td>
|
||||
<td>${cate.cateUrl}</td>
|
||||
<td>${(cate.cateDesc)!}</td>
|
||||
<td>2</td>
|
||||
<td>
|
||||
<#if updateCategory?? && updateCategory.cateId==cate.cateId>
|
||||
<a href="#" class="btn btn-primary btn-xs " disabled>正在修改</a>
|
||||
<#else >
|
||||
<a data-pjax="true" href="/admin/category/edit?cateId=${cate.cateId}" class="btn btn-primary btn-xs ">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/category/remove?cateId=${cate.cateId}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#if categories?? && categories?size gt 0>
|
||||
<#list categories as cate>
|
||||
<tr>
|
||||
<td>${cate.cateName}</td>
|
||||
<td>${cate.cateUrl}</td>
|
||||
<td>${(cate.cateDesc)!}</td>
|
||||
<td>${cate.posts?size}</td>
|
||||
<td>
|
||||
<#if updateCategory?? && updateCategory.cateId?c==cate.cateId?c>
|
||||
<a href="#" class="btn btn-primary btn-xs " disabled>正在修改</a>
|
||||
<#else >
|
||||
<a data-pjax="true" href="/admin/category/edit?cateId=${cate.cateId?c}" class="btn btn-primary btn-xs ">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/category/remove?cateId=${cate.cateId?c}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -57,17 +57,17 @@
|
|||
<td>
|
||||
<#switch comment.commentStatus>
|
||||
<#case 0>
|
||||
<button class="btn btn-primary btn-xs " onclick="replyShow('${comment.commentId}','${comment.post.postId}')" <#if comment.isAdmin==1>disabled</#if>>回复</button>
|
||||
<button class="btn btn-primary btn-xs " onclick="replyShow('${comment.commentId?c}','${comment.post.postId?c}')" <#if comment.isAdmin==1>disabled</#if>>回复</button>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId}&status=1','确定移动到回收站?')">丢弃</button>
|
||||
<#break >
|
||||
<#case 1>
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId}&status=1">通过</a>
|
||||
<button class="btn btn-info btn-xs " onclick="replyShow('${comment.commentId}','${comment.post.postId}')">通过并回复</button>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId}&status=1','确定移动到回收站?')">丢弃</button>
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId?c}&status=1">通过</a>
|
||||
<button class="btn btn-info btn-xs " onclick="replyShow('${comment.commentId?c}','${comment.post.postId?c}')">通过并回复</button>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId?c}&status=1','确定移动到回收站?')">丢弃</button>
|
||||
<#break >
|
||||
<#case 2>
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId}&status=2">还原</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/remove?commentId=${comment.commentId}&status=2','确定要永久删除?')">删除</button>
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs " href="/admin/comments/revert?commentId=${comment.commentId?c}&status=2">还原</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/comments/remove?commentId=${comment.commentId?c}&status=2','确定要永久删除?')">删除</button>
|
||||
<#break >
|
||||
</#switch>
|
||||
</td>
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">${statusName}菜单<#if updateMenu??>[${updateMenu.menuName}]</#if></h3>
|
||||
</div>
|
||||
<form action="/admin/menus/save" method="post" role="form" id="menuAddForm">
|
||||
<#if updateMenu??>
|
||||
<input type="hidden" name="menuId" value="${updateMenu.menuId}">
|
||||
<#if updateMenu??>
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">修改菜单<#if updateMenu??>[${updateMenu.menuName}]</#if></h3>
|
||||
</div>
|
||||
<form action="/admin/menus/save" method="post" role="form" id="menuAddForm">
|
||||
<input type="hidden" name="menuId" value="${updateMenu.menuId?c}">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="menuName">名称</label>
|
||||
|
@ -54,7 +54,16 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<#else >
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定修改</button>
|
||||
<a data-pjax="true" href="/admin/menus" class="btn btn-info btn-sm ">返回添加</a>
|
||||
</div>
|
||||
</form>
|
||||
<#else >
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">添加菜单</h3>
|
||||
</div>
|
||||
<form action="/admin/menus/save" method="post" role="form" id="menuAddForm">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="menuName">名称</label>
|
||||
|
@ -83,14 +92,11 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</#if>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<#if updateMenu??>
|
||||
<a data-pjax="true" href="/admin/menus" class="btn btn-info btn-sm ">返回添加</a>
|
||||
</#if>
|
||||
</div>
|
||||
</form>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定添加</button>
|
||||
</div>
|
||||
</form>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
|
@ -111,22 +117,24 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<@commonTag method="menus">
|
||||
<#list menus as menu>
|
||||
<tr>
|
||||
<td>${menu.menuName}</td>
|
||||
<td>${menu.menuUrl}</td>
|
||||
<td>${(menu.menuSort)!}</td>
|
||||
<td>${menu.menuIcon}</td>
|
||||
<td>
|
||||
<#if updateMenu?? && menu.menuId==updateMenu.menuId>
|
||||
<a href="#" class="btn btn-primary btn-xs " disabled="">正在修改</a>
|
||||
<#else>
|
||||
<a data-pjax="true" href="/admin/menus/edit?menuId=${menu.menuId}" class="btn btn-primary btn-xs ">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/menus/remove?menuId=${menu.menuId}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#if menus?? && menus?size gt 0>
|
||||
<#list menus as menu>
|
||||
<tr>
|
||||
<td>${menu.menuName}</td>
|
||||
<td>${menu.menuUrl}</td>
|
||||
<td>${(menu.menuSort)!}</td>
|
||||
<td>${menu.menuIcon}</td>
|
||||
<td>
|
||||
<#if updateMenu?? && menu.menuId?c==updateMenu.menuId?c>
|
||||
<a href="#" class="btn btn-primary btn-xs " disabled="">正在修改</a>
|
||||
<#else>
|
||||
<a data-pjax="true" href="/admin/menus/edit?menuId=${menu.menuId?c}" class="btn btn-primary btn-xs ">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/menus/remove?menuId=${menu.menuId?c}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -91,8 +91,8 @@
|
|||
<td>${page.postDate?string("yyyy-MM-dd HH:mm")}</td>
|
||||
<td>
|
||||
<a href="/p/${page.postUrl}" class="btn btn-info btn-xs " target="_blank">预览</a>
|
||||
<a href="/admin/page/edit?pageId=${page.postId}" class="btn btn-primary btn-xs ">编辑</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/remove?postId=${page.postId}&postType=${page.postType}','确定永久删除?(不可逆)')">永久删除</button>
|
||||
<a href="/admin/page/edit?pageId=${page.postId?c}" class="btn btn-primary btn-xs ">编辑</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/remove?postId=${page.postId?c}&postType=${page.postType}','确定永久删除?(不可逆)')">永久删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<#list galleries.content as gallery>
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-6 div-thumbnail" onclick="openDetail(${gallery.galleryId})">
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-6 div-thumbnail" onclick="openDetail(${gallery.galleryId?c})">
|
||||
<a href="#" class="thumbnail">
|
||||
<img src="${gallery.galleryThumbnailUrl?if_exists}" class="img-responsive">
|
||||
</a>
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border"><h3 class="box-title">${statusName}友情链接</h3></div>
|
||||
<#if updateLink??>
|
||||
<div class="box-header with-border"><h3 class="box-title">修改友情链接</h3></div>
|
||||
<form action="/admin/page/links/save" method="post" role="form" onsubmit="return isNull()">
|
||||
<input type="hidden" name="linkId" value="${updateLink.linkId}">
|
||||
<input type="hidden" name="linkId" value="${updateLink.linkId?c}">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">网站名称</label>
|
||||
|
@ -47,11 +47,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定修改</button>
|
||||
<a data-pjax="true" href="/admin/page/links" class="btn btn-info btn-sm ">返回添加</a>
|
||||
</div>
|
||||
</form>
|
||||
<#else>
|
||||
<div class="box-header with-border"><h3 class="box-title">添加友情链接</h3></div>
|
||||
<form action="/admin/page/links/save" method="post" role="form" onsubmit="return isNull()">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
|
@ -76,7 +77,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定添加</button>
|
||||
</div>
|
||||
</form>
|
||||
</#if>
|
||||
|
@ -91,21 +92,25 @@
|
|||
<tr><th>名称</th><th>网址</th><th>描述</th><th>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#list links as link>
|
||||
<tr>
|
||||
<td>${link.linkName}</td>
|
||||
<td>${link.linkUrl}</td>
|
||||
<td width="30%">${link.linkDesc}</td>
|
||||
<td>
|
||||
<#if updateLink?? && updateLink.linkId==link.linkId>
|
||||
<a class="btn btn-primary btn-xs" href="#" disabled>正在修改</a>
|
||||
<#else >
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs" href="/admin/page/links/edit?linkId=${link.linkId}">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs" onclick="modelShow('/admin/page/links/remove?linkId=${link.linkId}')">删除</>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
<@commonTag method="links">
|
||||
<#if links?? && links?size gt 0>
|
||||
<#list links as link>
|
||||
<tr>
|
||||
<td>${link.linkName}</td>
|
||||
<td>${link.linkUrl}</td>
|
||||
<td width="30%">${link.linkDesc}</td>
|
||||
<td>
|
||||
<#if updateLink?? && updateLink.linkId?c==link.linkId?c>
|
||||
<a class="btn btn-primary btn-xs" href="#" disabled>正在修改</a>
|
||||
<#else >
|
||||
<a data-pjax="true" class="btn btn-primary btn-xs" href="/admin/page/links/edit?linkId=${link.linkId?c}">修改</a>
|
||||
</#if>
|
||||
<button class="btn btn-danger btn-xs" onclick="modelShow('/admin/page/links/remove?linkId=${link.linkId?c}')">删除</>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<#if post??>
|
||||
<input type="hidden" id="postId" name="postId" value="${post.postId}">
|
||||
<input type="hidden" id="postId" name="postId" value="${post.postId?c}">
|
||||
</#if>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<input type="text" class="form-control input-lg" id="post_title" name="post_title" placeholder="请输入页面标题" value="<#if post??>${post.postTitle}</#if>">
|
||||
|
@ -129,7 +129,8 @@
|
|||
saveHTMLToTextarea: true,
|
||||
imageUpload : true,
|
||||
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
|
||||
imageUploadURL : "/admin/attachments/upload/editor"
|
||||
imageUploadURL : "/admin/attachments/upload/editor",
|
||||
htmlDecode: "script"
|
||||
// toolbarIcons : function () {
|
||||
// return editormd.toolbarModes["simple"];
|
||||
// }
|
||||
|
@ -206,7 +207,7 @@
|
|||
'postUrl' : $('#postUrl').html().toString(),
|
||||
'postContentMd': editor.getMarkdown(),
|
||||
'postContent': editor.getTextareaSavedHTML(),
|
||||
'postThumbnail': $('#selectImg')[0].src
|
||||
'postThumbnail': $('#selectImg')[0].src,
|
||||
},
|
||||
success: function (data) {
|
||||
$.toast({
|
||||
|
|
|
@ -87,17 +87,17 @@
|
|||
<#switch post.postStatus>
|
||||
<#case 0>
|
||||
<a href="/archives/${post.postUrl}" class="btn btn-primary btn-xs " target="_blank">查看</a>
|
||||
<a href="/admin/posts/edit?postId=${post.postId}" class="btn btn-info btn-xs ">修改</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId}','确定移到回收站?')">丢弃</button>
|
||||
<a href="/admin/posts/edit?postId=${post.postId?c}" class="btn btn-info btn-xs ">修改</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId?c}','确定移到回收站?')">丢弃</button>
|
||||
<#break >
|
||||
<#case 1>
|
||||
<a href="/admin/posts/view?postId=${post.postId}" class="btn btn-primary btn-xs " target="_blank">预览</a>
|
||||
<a href="/admin/posts/edit?postId=${post.postId}" class="btn btn-info btn-xs ">修改</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/revert?postId=${post.postId}&status=1','确定发布该文章?')">发布</button>
|
||||
<a href="/admin/posts/view?postId=${post.postId?c}" class="btn btn-primary btn-xs " target="_blank">预览</a>
|
||||
<a href="/admin/posts/edit?postId=${post.postId?c}" class="btn btn-info btn-xs ">修改</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/revert?postId=${post.postId?c}&status=1','确定发布该文章?')">发布</button>
|
||||
<#break >
|
||||
<#case 2>
|
||||
<a href="/admin/posts/revert?postId=${post.postId}&status=2" class="btn btn-primary btn-xs ">还原</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/remove?postId=${post.postId}&postType=${post.postType}','确定永久删除?(不可逆)')">永久删除</button>
|
||||
<a href="/admin/posts/revert?postId=${post.postId?c}&status=2" class="btn btn-primary btn-xs ">还原</a>
|
||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/remove?postId=${post.postId?c}&postType=${post.postType}','确定永久删除?(不可逆)')">永久删除</button>
|
||||
<#break >
|
||||
</#switch>
|
||||
</td>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<#if post??>
|
||||
<input type="hidden" id="postId" name="postId" value="${post.postId}">
|
||||
<input type="hidden" id="postId" name="postId" value="${post.postId?c}">
|
||||
</#if>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<input type="text" class="form-control input-lg" id="post_title" name="post_title" placeholder="请输入文章标题" value="<#if post??>${post.postTitle}</#if>">
|
||||
|
@ -91,13 +91,15 @@
|
|||
<div class="box-body" style="display: block">
|
||||
<div class="form-group">
|
||||
<ul style="list-style: none;padding: 0px;margin: 0px;">
|
||||
<#list categories as cate>
|
||||
<li style="padding: 0;margin: 0px;list-style: none">
|
||||
<label>
|
||||
<input name="categories" id="categories" type="checkbox" class="minimal" value="${cate.cateId}"> ${cate.cateName}
|
||||
</label>
|
||||
</li>
|
||||
</#list>
|
||||
<@commonTag method="categories">
|
||||
<#list categories as cate>
|
||||
<li style="padding: 0;margin: 0px;list-style: none">
|
||||
<label>
|
||||
<input name="categories" id="categories" type="checkbox" class="minimal" value="${cate.cateId}"> ${cate.cateName}
|
||||
</label>
|
||||
</li>
|
||||
</#list>
|
||||
</@commonTag>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -114,14 +116,16 @@
|
|||
<div class="box-body">
|
||||
<input type="text" class="form-control input-lg" id="tagList" name=""/><br>
|
||||
<select class="form-control" id="chooseTag" name="chooseTag">
|
||||
<#if tags??>
|
||||
<option value="">选择添加</option>
|
||||
<#list tags as tag>
|
||||
<option value="${tag.tagName}">${tag.tagName}(${tag.posts?size})</option>
|
||||
</#list>
|
||||
<#else>
|
||||
<option>暂无标签</option>
|
||||
</#if>
|
||||
<@commonTag method="tags">
|
||||
<#if tags??>
|
||||
<option value="">选择添加</option>
|
||||
<#list tags as tag>
|
||||
<option value="${tag.tagName}">${tag.tagName}(${tag.posts?size})</option>
|
||||
</#list>
|
||||
<#else>
|
||||
<option>暂无标签</option>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -196,7 +200,8 @@
|
|||
saveHTMLToTextarea: true,
|
||||
imageUpload : true,
|
||||
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
|
||||
imageUploadURL : "/admin/attachments/upload/editor"
|
||||
imageUploadURL : "/admin/attachments/upload/editor",
|
||||
htmlDecode: "script"
|
||||
// toolbarIcons : function () {
|
||||
// return editormd.toolbarModes["simple"];
|
||||
// }
|
||||
|
@ -273,7 +278,7 @@
|
|||
'postTitle': Title,
|
||||
'postUrl' : $('#postUrl').html().toString(),
|
||||
'postContentMd': editor.getMarkdown(),
|
||||
'postContent': editor.getTextareaSavedHTML(),
|
||||
'postContent': editor.getHTML(),
|
||||
'postThumbnail': $('#selectImg')[0].src,
|
||||
'cateList' : cateList.toString(),
|
||||
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString()
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
</div>
|
||||
<div class="tab-pane" id="pass">
|
||||
<form method="post" class="form-horizontal" id="passForm">
|
||||
<input type="hidden" name="userId" value="${user.userId}">
|
||||
<input type="hidden" name="userId" value="${user.userId?c}">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="beforePass" class="col-sm-2 control-label">原密码:</label>
|
||||
|
|
|
@ -154,12 +154,12 @@
|
|||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">${statusName}标签<#if tag??>[${updateTag.tagName}]</#if></h3>
|
||||
</div>
|
||||
<#if updateTag??>
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">修改标签<#if tag??>[${updateTag.tagName}]</#if></h3>
|
||||
</div>
|
||||
<form action="/admin/tag/save" method="post" role="form">
|
||||
<input type="hidden" name="tagId" value="${updateTag.tagId}">
|
||||
<input type="hidden" name="tagId" value="${updateTag.tagId?c}">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label for="tagName">名称</label>
|
||||
|
@ -173,14 +173,17 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定修改</button>
|
||||
<a data-pjax="true" href="/admin/tag" class="btn btn-info btn-sm ">返回添加</a>
|
||||
<#if updateTag.posts?size = 0>
|
||||
<a data-pjax="true" href="/admin/tag/remove?tagId=${updateTag.tagId}" class="btn btn-danger btn-sm pull-right">删除</a>
|
||||
<a data-pjax="true" href="/admin/tag/remove?tagId=${updateTag.tagId?c}" class="btn btn-danger btn-sm pull-right">删除</a>
|
||||
</#if>
|
||||
</div>
|
||||
</form>
|
||||
<#else >
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">添加标签</h3>
|
||||
</div>
|
||||
<form action="/admin/tag/save" method="post" role="form" onsubmit="return checkTag()">
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
|
@ -195,7 +198,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定${statusName}</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm ">确定添加</button>
|
||||
</div>
|
||||
</form>
|
||||
</#if>
|
||||
|
@ -208,14 +211,18 @@
|
|||
</div>
|
||||
<div class="box-body table-responsive">
|
||||
<ul class="tags blue">
|
||||
<#list tags as tag>
|
||||
<li>
|
||||
<a data-pjax="true" href="/admin/tag/edit?tagId=${tag.tagId}">
|
||||
${tag.tagName}
|
||||
<span>${tag.posts?size}</span>
|
||||
</a>
|
||||
</li>
|
||||
</#list>
|
||||
<@commonTag method="tags">
|
||||
<#if tags?? && tags?size gt 0>
|
||||
<#list tags as tag>
|
||||
<li>
|
||||
<a data-pjax="true" href="/admin/tag/edit?tagId=${tag.tagId?c}">
|
||||
${tag.tagName}
|
||||
<span>${tag.posts?size}</span>
|
||||
</a>
|
||||
</li>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs"><a target="_blank" href="https://github.com/ruibaby/halo">1.0 Beta</a></div>
|
||||
<div class="pull-right hidden-xs"><a target="_blank" href="https://github.com/ruibaby/halo">0.0.2</a></div>
|
||||
Thanks for using <strong><a data-pjax="true" href="/admin/halo">Halo</a>.</strong>
|
||||
</footer>
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<form action="/admin/page/gallery/save" method="post" class="form-horizontal" id="galleryForm">
|
||||
<div class="box-body">
|
||||
<input type="hidden" value="${gallery.galleryId}" name="galleryId">
|
||||
<input type="hidden" value="${gallery.galleryId?c}" name="galleryId">
|
||||
<div class="form-group">
|
||||
<label for="galleryName" class="col-sm-2 control-label">图片名称:</label>
|
||||
<div class="col-sm-10">
|
||||
|
|
|
@ -11,9 +11,13 @@
|
|||
<h3><a>links</a></h3>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<#list links as link>
|
||||
<p><a href="${link.linkUrl}" target="_blank" rel="external">${link.linkName}</a> – ${link.linkDesc}</p>
|
||||
</#list>
|
||||
<@commonTag method="links">
|
||||
<#if links?? && links?size gt 0>
|
||||
<#list links as link>
|
||||
<p><a href="${link.linkUrl}" target="_blank" rel="external">${link.linkName}</a> – ${link.linkDesc}</p>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 360 KiB After Width: | Height: | Size: 193 KiB |
|
@ -1,9 +1,5 @@
|
|||
<#include "module/macro.ftl">
|
||||
<#if tag??>
|
||||
<@head title="${tag.tagName} · ${options.blog_title?default('Anatole')}" keywords="${options.seo_keywords?default('Anatole')}" description="${options.seo_desc?default('Anatole')}"></@head>
|
||||
<#else>
|
||||
<@head title="${options.blog_title?default('Anatole')}" keywords="${options.seo_keywords?default('Anatole')}" description="${options.seo_desc?default('Anatole')}"></@head>
|
||||
</#if>
|
||||
<@head title="${tag.tagName} · ${options.blog_title?default('Anatole')}" keywords="${options.seo_keywords?default('Anatole')}" description="${options.seo_desc?default('Anatole')}"></@head>
|
||||
<#include "module/sidebar.ftl">
|
||||
<div class="main">
|
||||
<#include "module/page-top.ftl">
|
||||
|
@ -16,17 +12,17 @@
|
|||
<#if posts.hasPrevious()>
|
||||
<#if posts.number == 1>
|
||||
<li class="pre pagbuttons">
|
||||
<a class="btn" role="navigation" href="/">上一页</a>
|
||||
<a class="btn" role="navigation" href="/tags/${tag.tagUrl}">上一页</a>
|
||||
</li>
|
||||
<#else >
|
||||
<li class="pre pagbuttons">
|
||||
<a class="btn" role="navigation" href="/page/${posts.number}">上一页</a>
|
||||
<a class="btn" role="navigation" href="/tags/${tag.tagUrl}/page/${posts.number}">上一页</a>
|
||||
</li>
|
||||
</#if>
|
||||
</#if>
|
||||
<#if posts.hasNext()>
|
||||
<li class="next pagbuttons">
|
||||
<a class="btn" role="navigation" href="/page/${posts.number+2}">下一页</a>
|
||||
<a class="btn" role="navigation" href="/tags/${tag.tagUrl}/page/${posts.number+2}">下一页</a>
|
||||
</li>
|
||||
</#if>
|
||||
</ul>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<#if post.categories??>
|
||||
<#list post.categories as cate>
|
||||
<span class="post_entry-category">
|
||||
<a class="post_category-link" href="/categories/学习笔记/">${cate.cateName}</a>
|
||||
<a class="post_category-link" href="/categories/${cate.cateUrl}/">${cate.cateName}</a>
|
||||
</span>
|
||||
</#list>
|
||||
</#if>
|
||||
|
|
|
@ -29,11 +29,13 @@
|
|||
|
||||
<div class=" material-tagscloud">
|
||||
<div class="material-post mdl-grid">
|
||||
<#if tags??>
|
||||
<#list tags as tag>
|
||||
<a href="/tags/${tag.tagUrl}/" style="font-size: 22.33px; color: #757575">${tag.tagName}</a>
|
||||
</#list>
|
||||
</#if>
|
||||
<@commonTag method="tags">
|
||||
<#if tags?? && tags?size gt 0>
|
||||
<#list tags as tag>
|
||||
<a href="/tags/${tag.tagUrl}/" style="font-size: 22.33px; color: #757575">${tag.tagName}</a>
|
||||
</#list>
|
||||
</#if>
|
||||
</@commonTag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<#include "_partial/Isolation-post_entry.ftl">
|
||||
</#if>
|
||||
<#include "_partial/index-nav.ftl">
|
||||
<@nav url="/"></@nav>
|
||||
<@nav url="/categories/${category.cateUrl}/"></@nav>
|
||||
<#if options.theme_material_scheme?default('Paradox') == "Paradox">
|
||||
<#include "_partial/Paradox-post_entry-thumbnail.ftl">
|
||||
</#if>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 539 KiB |
|
@ -14,7 +14,7 @@
|
|||
<#include "_partial/Isolation-post_entry.ftl">
|
||||
</#if>
|
||||
<#include "_partial/index-nav.ftl">
|
||||
<@nav url="/"></@nav>
|
||||
<@nav url="/tags/${tag.tagUrl}/"></@nav>
|
||||
<#if options.theme_material_scheme?default('Paradox') == "Paradox">
|
||||
<#include "_partial/Paradox-post_entry-thumbnail.ftl">
|
||||
</#if>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cc.ryanc.halo.util;
|
||||
package cc.ryanc.halo.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -12,6 +12,6 @@ public class DemoUtilTest {
|
|||
|
||||
@Test
|
||||
public void testZip(){
|
||||
HaloUtil.unZip("/Users/ryan0up/Desktop/adminlog.html.zip","/Users/ryan0up/Desktop/");
|
||||
ZipUtils.unZip("/Users/ryan0up/Desktop/adminlog.html.zip","/Users/ryan0up/Desktop/");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue