mirror of https://github.com/halo-dev/halo
👽 Updating Spring Boot to 2.0.1
parent
10752ea6d1
commit
18c1ed2ec5
1
pom.xml
1
pom.xml
|
@ -10,6 +10,7 @@
|
||||||
<description>
|
<description>
|
||||||
halo,一个基于SpringBoot的博客系统,最求轻快,易用,以内容为中心。
|
halo,一个基于SpringBoot的博客系统,最求轻快,易用,以内容为中心。
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<id>RYAN0UP</id>
|
<id>RYAN0UP</id>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package cc.ryanc.halo.model.dto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author : RYAN0UP
|
|
||||||
* @date : 2017/12/24
|
|
||||||
* @version : 1.0
|
|
||||||
* description:
|
|
||||||
*/
|
|
||||||
public class RespStatus {
|
|
||||||
public static final String SUCCESS = "success";
|
|
||||||
public static final String ERROR = "error";
|
|
||||||
public static final String EXISTS = "exists";
|
|
||||||
public static final String NOTEXISTS = "notExists";
|
|
||||||
}
|
|
|
@ -51,5 +51,5 @@ public interface AttachmentService {
|
||||||
* @param attachId attachId
|
* @param attachId attachId
|
||||||
* @return Attachment
|
* @return Attachment
|
||||||
*/
|
*/
|
||||||
Optional<Attachment> removeByAttachId(Long attachId);
|
Attachment removeByAttachId(Long attachId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public interface CategoryService {
|
||||||
* @param cateId 分类目录编号
|
* @param cateId 分类目录编号
|
||||||
* @return category
|
* @return category
|
||||||
*/
|
*/
|
||||||
Optional<Category> removeByCateId(Long cateId);
|
Category removeByCateId(Long cateId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改分类目录信息
|
* 修改分类目录信息
|
||||||
|
|
|
@ -55,7 +55,7 @@ public interface CommentService {
|
||||||
* @param status status
|
* @param status status
|
||||||
* @return comment
|
* @return comment
|
||||||
*/
|
*/
|
||||||
Optional<Comment> updateCommentStatus(Long commentId,Integer status);
|
Comment updateCommentStatus(Long commentId,Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据评论编号查询评论
|
* 根据评论编号查询评论
|
||||||
|
|
|
@ -28,7 +28,7 @@ public interface GalleryService {
|
||||||
*
|
*
|
||||||
* @param galleryId galleryId
|
* @param galleryId galleryId
|
||||||
*/
|
*/
|
||||||
Optional<Gallery> removeByGalleryId(Long galleryId);
|
Gallery removeByGalleryId(Long galleryId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改图片信息
|
* 修改图片信息
|
||||||
|
|
|
@ -26,7 +26,7 @@ public interface LinkService {
|
||||||
* @param linkId linkId
|
* @param linkId linkId
|
||||||
* @return Link
|
* @return Link
|
||||||
*/
|
*/
|
||||||
Optional<Link> removeByLinkId(Long linkId);
|
Link removeByLinkId(Long linkId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
|
|
|
@ -34,7 +34,7 @@ public interface MenuService {
|
||||||
* @param menuId menuId
|
* @param menuId menuId
|
||||||
* @return menu
|
* @return menu
|
||||||
*/
|
*/
|
||||||
Optional<Menu> removeByMenuId(Long menuId);
|
Menu removeByMenuId(Long menuId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改菜单
|
* 修改菜单
|
||||||
|
|
|
@ -31,7 +31,7 @@ public interface PostService {
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Optional<Post> removeByPostId(Long postId);
|
Post removeByPostId(Long postId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改文章
|
* 修改文章
|
||||||
|
|
|
@ -27,7 +27,7 @@ public interface TagService {
|
||||||
* @param tagId tagId
|
* @param tagId tagId
|
||||||
* @return Tag
|
* @return Tag
|
||||||
*/
|
*/
|
||||||
Optional<Tag> removeByTagId(Long tagId);
|
Tag removeByTagId(Long tagId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新标签
|
* 更新标签
|
||||||
|
|
|
@ -77,9 +77,9 @@ public class AttachmentServiceImpl implements AttachmentService{
|
||||||
* @return attachment
|
* @return attachment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Attachment> removeByAttachId(Long attachId) {
|
public Attachment removeByAttachId(Long attachId) {
|
||||||
Optional<Attachment> attachment = this.findByAttachId(attachId);
|
Optional<Attachment> attachment = this.findByAttachId(attachId);
|
||||||
attachmentRepository.delete(attachment.get());
|
attachmentRepository.delete(attachment.get());
|
||||||
return attachment;
|
return attachment.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class CategoryServiceImpl implements CategoryService{
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
|
@CacheEvict(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
|
||||||
@Override
|
@Override
|
||||||
public Optional<Category> removeByCateId(Long cateId) {
|
public Category removeByCateId(Long cateId) {
|
||||||
Optional<Category> category = this.findByCateId(cateId);
|
Optional<Category> category = this.findByCateId(cateId);
|
||||||
categoryRepository.delete(category.get());
|
categoryRepository.delete(category.get());
|
||||||
return category;
|
return category.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -76,10 +76,10 @@ public class CommentServiceImpl implements CommentService {
|
||||||
* @return comment
|
* @return comment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Comment> updateCommentStatus(Long commentId, Integer status) {
|
public Comment updateCommentStatus(Long commentId, Integer status) {
|
||||||
Optional<Comment> comment = findCommentById(commentId);
|
Optional<Comment> comment = findCommentById(commentId);
|
||||||
commentRepository.save(comment.get());
|
comment.get().setCommentStatus(status);
|
||||||
return comment;
|
return commentRepository.save(comment.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,10 +40,10 @@ public class GalleryServiceImpl implements GalleryService{
|
||||||
* @param galleryId galleryId
|
* @param galleryId galleryId
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Gallery> removeByGalleryId(Long galleryId) {
|
public Gallery removeByGalleryId(Long galleryId) {
|
||||||
Optional<Gallery> gallery = this.findByGalleryId(galleryId);
|
Optional<Gallery> gallery = this.findByGalleryId(galleryId);
|
||||||
galleryRepository.delete(gallery.get());
|
galleryRepository.delete(gallery.get());
|
||||||
return gallery;
|
return gallery.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class LinkServiceImpl implements LinkService {
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = LINK_CACHE_NAME,key = LINK_KEY)
|
@CacheEvict(value = LINK_CACHE_NAME,key = LINK_KEY)
|
||||||
@Override
|
@Override
|
||||||
public Optional<Link> removeByLinkId(Long linkId) {
|
public Link removeByLinkId(Long linkId) {
|
||||||
Optional<Link> link = this.findByLinkId(linkId);
|
Optional<Link> link = this.findByLinkId(linkId);
|
||||||
linkRepository.delete(link.get());
|
linkRepository.delete(link.get());
|
||||||
return link;
|
return link.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,10 +49,10 @@ public class MenuServiceImpl implements MenuService{
|
||||||
* @return menu
|
* @return menu
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Menu> removeByMenuId(Long menuId) {
|
public Menu removeByMenuId(Long menuId) {
|
||||||
Optional<Menu> menu = this.findByMenuId(menuId);
|
Optional<Menu> menu = this.findByMenuId(menuId);
|
||||||
menuRepository.delete(menu.get());
|
menuRepository.delete(menu.get());
|
||||||
return menu;
|
return menu.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,10 +54,10 @@ public class PostServiceImpl implements PostService {
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = POST_CACHE_NAME,key = POST_KEY)
|
@CacheEvict(value = POST_CACHE_NAME,key = POST_KEY)
|
||||||
@Override
|
@Override
|
||||||
public Optional<Post> removeByPostId(Long postId) {
|
public Post removeByPostId(Long postId) {
|
||||||
Optional<Post> post = this.findByPostId(postId);
|
Optional<Post> post = this.findByPostId(postId);
|
||||||
postRepository.delete(post.get());
|
postRepository.delete(post.get());
|
||||||
return post;
|
return post.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,10 +43,10 @@ public class TagServiceImpl implements TagService {
|
||||||
* @return Tag
|
* @return Tag
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Tag> removeByTagId(Long tagId) {
|
public Tag removeByTagId(Long tagId) {
|
||||||
Optional<Tag> tag = findByTagId(tagId);
|
Optional<Tag> tag = findByTagId(tagId);
|
||||||
tagRepository.delete(tag.get());
|
tagRepository.delete(tag.get());
|
||||||
return tag;
|
return tag.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class HaloUtil {
|
||||||
* @param suffix 后缀
|
* @param suffix 后缀
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static void cutCenterImage(String src,String dest,int w,int h,String suffix) throws IOException{
|
public static void cutCenterImage(String src,String dest,int w,int h,String suffix){
|
||||||
try{
|
try{
|
||||||
Iterator iterator = ImageIO.getImageReadersByFormatName(suffix);
|
Iterator iterator = ImageIO.getImageReadersByFormatName(suffix);
|
||||||
ImageReader reader = (ImageReader)iterator.next();
|
ImageReader reader = (ImageReader)iterator.next();
|
||||||
|
|
|
@ -474,7 +474,7 @@ public class IndexController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = {"sitemap","sitemap.xml"},produces = { "application/xml;charset=UTF-8" })
|
@GetMapping(value = {"sitemap","sitemap.xml"},produces = { "application/xml;charset=UTF-8" })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String sitemap(){
|
public String siteMap(){
|
||||||
//获取文章列表并根据时间排序
|
//获取文章列表并根据时间排序
|
||||||
Sort sort = new Sort(Sort.Direction.DESC,"postDate");
|
Sort sort = new Sort(Sort.Direction.DESC,"postDate");
|
||||||
Pageable pageable = new PageRequest(0,999,sort);
|
Pageable pageable = new PageRequest(0,999,sort);
|
||||||
|
@ -492,7 +492,7 @@ public class IndexController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/newComment")
|
@PostMapping(value = "/newComment")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String newComment(@ModelAttribute("comment") Comment comment,
|
public boolean newComment(@ModelAttribute("comment") Comment comment,
|
||||||
@ModelAttribute("post") Post post,
|
@ModelAttribute("post") Post post,
|
||||||
HttpServletRequest request){
|
HttpServletRequest request){
|
||||||
comment.setCommentAuthorEmail(comment.getCommentAuthorEmail().toLowerCase());
|
comment.setCommentAuthorEmail(comment.getCommentAuthorEmail().toLowerCase());
|
||||||
|
@ -515,6 +515,6 @@ public class IndexController extends BaseController{
|
||||||
log.error("邮件服务器未配置:"+e.getMessage());
|
log.error("邮件服务器未配置:"+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "success";
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -53,7 +54,18 @@ public class InstallController {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String install(){
|
public String install(Model model){
|
||||||
|
try{
|
||||||
|
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||||
|
File installFile = new File(basePath.getAbsolutePath(), "install.lock");
|
||||||
|
if(installFile.exists()){
|
||||||
|
model.addAttribute("isInstall",true);
|
||||||
|
}else{
|
||||||
|
model.addAttribute("isInstall",false);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
return "common/install";
|
return "common/install";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import cc.ryanc.halo.model.domain.Post;
|
||||||
import cc.ryanc.halo.model.domain.User;
|
import cc.ryanc.halo.model.domain.User;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.CommentService;
|
import cc.ryanc.halo.service.CommentService;
|
||||||
import cc.ryanc.halo.service.LogsService;
|
import cc.ryanc.halo.service.LogsService;
|
||||||
import cc.ryanc.halo.service.PostService;
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
@ -116,7 +115,7 @@ public class AdminController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/getLogin")
|
@PostMapping(value = "/getLogin")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String getLogin(@ModelAttribute("loginName") String loginName,
|
public boolean getLogin(@ModelAttribute("loginName") String loginName,
|
||||||
@ModelAttribute("loginPwd") String loginPwd,
|
@ModelAttribute("loginPwd") String loginPwd,
|
||||||
HttpSession session){
|
HttpSession session){
|
||||||
try {
|
try {
|
||||||
|
@ -132,14 +131,14 @@ public class AdminController extends BaseController{
|
||||||
session.setAttribute(HaloConst.USER_SESSION_KEY, users.get(0));
|
session.setAttribute(HaloConst.USER_SESSION_KEY, users.get(0));
|
||||||
log.info("用户["+ users.get(0).getUserName()+"]登录成功!");
|
log.info("用户["+ users.get(0).getUserName()+"]登录成功!");
|
||||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_SUCCESS,HaloUtil.getIpAddr(request), HaloUtil.getDate()));
|
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_SUCCESS,HaloUtil.getIpAddr(request), HaloUtil.getDate()));
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_ERROR,HaloUtil.getIpAddr(request),new Date()));
|
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_ERROR,HaloUtil.getIpAddr(request),new Date()));
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("登录失败!:"+e.getMessage());
|
log.error("登录失败!:"+e.getMessage());
|
||||||
}
|
}
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,6 @@ import cc.ryanc.halo.model.domain.Attachment;
|
||||||
import cc.ryanc.halo.model.domain.Logs;
|
import cc.ryanc.halo.model.domain.Logs;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.AttachmentService;
|
import cc.ryanc.halo.service.AttachmentService;
|
||||||
import cc.ryanc.halo.service.LogsService;
|
import cc.ryanc.halo.service.LogsService;
|
||||||
import cc.ryanc.halo.util.HaloUtil;
|
import cc.ryanc.halo.util.HaloUtil;
|
||||||
|
@ -20,9 +19,12 @@ import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.websocket.server.PathParam;
|
import javax.websocket.server.PathParam;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,15 +122,22 @@ public class AttachmentController {
|
||||||
Attachment attachment = new Attachment();
|
Attachment attachment = new Attachment();
|
||||||
attachment.setAttachName(fileName);
|
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(HaloUtil.YEAR).append("/").append(HaloUtil.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());
|
||||||
|
}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(HaloUtil.YEAR).append("/").append(HaloUtil.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);
|
||||||
|
}
|
||||||
|
|
||||||
attachment.setAttachType(file.getContentType());
|
attachment.setAttachType(file.getContentType());
|
||||||
attachment.setAttachSuffix(new StringBuffer(".").append(fileSuffix).toString());
|
attachment.setAttachSuffix(new StringBuffer(".").append(fileSuffix).toString());
|
||||||
attachment.setAttachCreated(HaloUtil.getDate());
|
attachment.setAttachCreated(HaloUtil.getDate());
|
||||||
attachmentService.saveByAttachment(attachment);
|
attachmentService.saveByAttachment(attachment);
|
||||||
|
|
||||||
//剪裁图片
|
|
||||||
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);
|
|
||||||
|
|
||||||
updateConst();
|
updateConst();
|
||||||
log.info("上传文件["+file.getOriginalFilename()+"]到["+mediaPath.getAbsolutePath()+"]成功");
|
log.info("上传文件["+file.getOriginalFilename()+"]到["+mediaPath.getAbsolutePath()+"]成功");
|
||||||
logsService.saveByLogs(
|
logsService.saveByLogs(
|
||||||
|
@ -168,7 +177,7 @@ public class AttachmentController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/remove")
|
@GetMapping(value = "/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String removeAttachment(@PathParam("attachId") Long attachId,
|
public boolean removeAttachment(@PathParam("attachId") Long attachId,
|
||||||
HttpServletRequest request){
|
HttpServletRequest request){
|
||||||
Optional<Attachment> attachment = attachmentService.findByAttachId(attachId);
|
Optional<Attachment> attachment = attachmentService.findByAttachId(attachId);
|
||||||
String delFileName = attachment.get().getAttachName();
|
String delFileName = attachment.get().getAttachName();
|
||||||
|
@ -183,8 +192,17 @@ public class AttachmentController {
|
||||||
File mediaPath = new File(basePath.getAbsolutePath(),attachment.get().getAttachPath().substring(0,attachment.get().getAttachPath().lastIndexOf('/')));
|
File mediaPath = new File(basePath.getAbsolutePath(),attachment.get().getAttachPath().substring(0,attachment.get().getAttachPath().lastIndexOf('/')));
|
||||||
File delFile = new File(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(delFileName).toString());
|
File delFile = new File(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(delFileName).toString());
|
||||||
File delSmallFile = new File(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(delSmallFileName).toString());
|
File delSmallFile = new File(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(delSmallFileName).toString());
|
||||||
|
|
||||||
|
BufferedImage sourceImg = ImageIO.read(new FileInputStream(delFile));
|
||||||
|
if(sourceImg.getWidth()>500 && sourceImg.getHeight()>500){
|
||||||
|
if(delSmallFile.exists()){
|
||||||
|
if(delSmallFile.delete()){
|
||||||
|
updateConst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(delFile.exists() && delFile.isFile()){
|
if(delFile.exists() && delFile.isFile()){
|
||||||
if(delFile.delete()&&delSmallFile.delete()){
|
if(delFile.delete()){
|
||||||
updateConst();
|
updateConst();
|
||||||
log.info("删除文件["+delFileName+"]成功!");
|
log.info("删除文件["+delFileName+"]成功!");
|
||||||
logsService.saveByLogs(
|
logsService.saveByLogs(
|
||||||
|
@ -192,13 +210,13 @@ public class AttachmentController {
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
log.error("删除附件["+delFileName+"]失败!");
|
log.error("删除附件["+delFileName+"]失败!");
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("删除附件["+delFileName+"]失败!"+e.getMessage());
|
log.error("删除附件["+delFileName+"]失败!"+e.getMessage());
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.domain.Category;
|
import cc.ryanc.halo.model.domain.Category;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.CategoryService;
|
import cc.ryanc.halo.service.CategoryService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -68,12 +67,12 @@ public class CategoryController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/checkUrl")
|
@GetMapping(value = "/checkUrl")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkCateUrlExists(@RequestParam("cateUrl") String cateUrl){
|
public boolean checkCateUrlExists(@RequestParam("cateUrl") String cateUrl){
|
||||||
Category category = categoryService.findByCateUrl(cateUrl);
|
Category category = categoryService.findByCateUrl(cateUrl);
|
||||||
if(null!=category){
|
if(null!=category){
|
||||||
return RespStatus.EXISTS;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return RespStatus.NOTEXISTS;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +85,8 @@ public class CategoryController {
|
||||||
@GetMapping(value = "/remove")
|
@GetMapping(value = "/remove")
|
||||||
public String removeCategory(@PathParam("cateId") Long cateId){
|
public String removeCategory(@PathParam("cateId") Long cateId){
|
||||||
try{
|
try{
|
||||||
Optional<Category> category = categoryService.removeByCateId(cateId);
|
Category category = categoryService.removeByCateId(cateId);
|
||||||
log.info("删除的分类目录:"+category.get());
|
log.info("删除的分类目录:"+category);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error("未知错误:"+e.getMessage());
|
log.error("未知错误:"+e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,24 +103,24 @@ public class CommentController extends BaseController{
|
||||||
public String moveToPublish(@PathParam("commentId") Long commentId,
|
public String moveToPublish(@PathParam("commentId") Long commentId,
|
||||||
@PathParam("status") Integer status,
|
@PathParam("status") Integer status,
|
||||||
HttpSession session){
|
HttpSession session){
|
||||||
Optional<Comment> comment = commentService.updateCommentStatus(commentId,0);
|
Comment comment = commentService.updateCommentStatus(commentId,0);
|
||||||
|
|
||||||
Pattern patternEmail = Pattern.compile("\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}");
|
Pattern patternEmail = Pattern.compile("\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}");
|
||||||
Matcher matcher = patternEmail.matcher(comment.get().getCommentAuthorEmail());
|
Matcher matcher = patternEmail.matcher(comment.getCommentAuthorEmail());
|
||||||
|
|
||||||
//判断是否启用邮件服务
|
//判断是否启用邮件服务
|
||||||
if("true".equals(HaloConst.OPTIONS.get("smtp_email_enable"))) {
|
if("true".equals(HaloConst.OPTIONS.get("smtp_email_enable"))) {
|
||||||
try {
|
try {
|
||||||
if (status == 1 && matcher.find()) {
|
if (status == 1 && matcher.find()) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("pageUrl", comment.get().getPost().getPostUrl());
|
map.put("pageUrl", comment.getPost().getPostUrl());
|
||||||
map.put("pageName", comment.get().getPost().getPostTitle());
|
map.put("pageName", comment.getPost().getPostTitle());
|
||||||
map.put("commentContent", comment.get().getCommentContent());
|
map.put("commentContent", comment.getCommentContent());
|
||||||
map.put("siteUrl", HaloConst.OPTIONS.get("site_url"));
|
map.put("siteUrl", HaloConst.OPTIONS.get("site_url"));
|
||||||
map.put("siteTitle", HaloConst.OPTIONS.get("site_title"));
|
map.put("siteTitle", HaloConst.OPTIONS.get("site_title"));
|
||||||
map.put("author", userService.findAllUser().get(0).getUserDisplayName());
|
map.put("author", userService.findAllUser().get(0).getUserDisplayName());
|
||||||
mailService.sendTemplateMail(
|
mailService.sendTemplateMail(
|
||||||
comment.get().getCommentAuthorEmail(),
|
comment.getCommentAuthorEmail(),
|
||||||
"您在" + HaloConst.OPTIONS.get("site_title") + "的评论已审核通过!", map, "common/mail/mail_passed.ftl");
|
"您在" + HaloConst.OPTIONS.get("site_title") + "的评论已审核通过!", map, "common/mail/mail_passed.ftl");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package cc.ryanc.halo.web.controller.admin;
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.OptionsService;
|
import cc.ryanc.halo.service.OptionsService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -43,16 +42,16 @@ public class OptionController {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String saveOptions(@RequestParam Map<String,String> options){
|
public boolean saveOptions(@RequestParam Map<String,String> options){
|
||||||
try {
|
try {
|
||||||
optionsService.saveOptions(options);
|
optionsService.saveOptions(options);
|
||||||
HaloConst.OPTIONS.clear();
|
HaloConst.OPTIONS.clear();
|
||||||
HaloConst.OPTIONS = optionsService.findAllOptions();
|
HaloConst.OPTIONS = optionsService.findAllOptions();
|
||||||
log.info("所保存的设置选项列表:"+options);
|
log.info("所保存的设置选项列表:"+options);
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:",e.getMessage());
|
log.error("未知错误:",e.getMessage());
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,8 @@ public class PageController {
|
||||||
@GetMapping(value = "/links/remove")
|
@GetMapping(value = "/links/remove")
|
||||||
public String removeLink(@PathParam("linkId") Long linkId){
|
public String removeLink(@PathParam("linkId") Long linkId){
|
||||||
try{
|
try{
|
||||||
Optional<Link> link = linkService.removeByLinkId(linkId);
|
Link link = linkService.removeByLinkId(linkId);
|
||||||
log.info("删除的友情链接:"+link.get());
|
log.info("删除的友情链接:"+link);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:"+e.getMessage());
|
log.error("未知错误:"+e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import cc.ryanc.halo.model.domain.Post;
|
||||||
import cc.ryanc.halo.model.domain.User;
|
import cc.ryanc.halo.model.domain.User;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.CategoryService;
|
import cc.ryanc.halo.service.CategoryService;
|
||||||
import cc.ryanc.halo.service.LogsService;
|
import cc.ryanc.halo.service.LogsService;
|
||||||
import cc.ryanc.halo.service.PostService;
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
@ -256,13 +255,13 @@ public class PostController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/updateSummary")
|
@GetMapping(value = "/updateSummary")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String updateSummary(@PathParam("postSummary") Integer postSummary){
|
public boolean updateSummary(@PathParam("postSummary") Integer postSummary){
|
||||||
try {
|
try {
|
||||||
postService.updateAllSummary(postSummary);
|
postService.updateAllSummary(postSummary);
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:"+e.getMessage());
|
log.error("未知错误:"+e.getMessage());
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,12 +273,12 @@ public class PostController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/checkUrl")
|
@GetMapping(value = "/checkUrl")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkUrlExists(@PathParam("postUrl") String postUrl){
|
public boolean checkUrlExists(@PathParam("postUrl") String postUrl){
|
||||||
Post post = postService.findByPostUrl(postUrl);
|
Post post = postService.findByPostUrl(postUrl);
|
||||||
if(null!=post){
|
if(null!=post){
|
||||||
return RespStatus.EXISTS;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return RespStatus.NOTEXISTS;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.domain.Tag;
|
import cc.ryanc.halo.model.domain.Tag;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.TagService;
|
import cc.ryanc.halo.service.TagService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -68,12 +67,12 @@ public class TagController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/checkUrl")
|
@GetMapping(value = "/checkUrl")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkTagUrlExists(@RequestParam("tagUrl") String tagUrl){
|
public boolean checkTagUrlExists(@RequestParam("tagUrl") String tagUrl){
|
||||||
Tag tag = tagService.findByTagUrl(tagUrl);
|
Tag tag = tagService.findByTagUrl(tagUrl);
|
||||||
if(null!=tag){
|
if(null!=tag){
|
||||||
return RespStatus.EXISTS;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return RespStatus.NOTEXISTS;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +85,8 @@ public class TagController {
|
||||||
@GetMapping(value = "/remove")
|
@GetMapping(value = "/remove")
|
||||||
public String removeTag(@PathParam("tagId") Long tagId){
|
public String removeTag(@PathParam("tagId") Long tagId){
|
||||||
try{
|
try{
|
||||||
Optional<Tag> tag = tagService.removeByTagId(tagId);
|
Tag tag = tagService.removeByTagId(tagId);
|
||||||
log.info("删除的标签:"+tag.get());
|
log.info("删除的标签:"+tag);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:"+e.getMessage());
|
log.error("未知错误:"+e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cc.ryanc.halo.web.controller.admin;
|
||||||
import cc.ryanc.halo.model.domain.Logs;
|
import cc.ryanc.halo.model.domain.Logs;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.LogsService;
|
import cc.ryanc.halo.service.LogsService;
|
||||||
import cc.ryanc.halo.service.OptionsService;
|
import cc.ryanc.halo.service.OptionsService;
|
||||||
import cc.ryanc.halo.util.HaloUtil;
|
import cc.ryanc.halo.util.HaloUtil;
|
||||||
|
@ -64,7 +63,7 @@ public class ThemeController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/set")
|
@GetMapping(value = "/set")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String activeTheme(@PathParam("siteTheme") String siteTheme,
|
public boolean activeTheme(@PathParam("siteTheme") String siteTheme,
|
||||||
HttpServletRequest request){
|
HttpServletRequest request){
|
||||||
try {
|
try {
|
||||||
//保存主题设置项在数据库
|
//保存主题设置项在数据库
|
||||||
|
@ -75,10 +74,10 @@ public class ThemeController extends BaseController{
|
||||||
logsService.saveByLogs(
|
logsService.saveByLogs(
|
||||||
new Logs(LogsRecord.CHANGE_THEME,"更换为"+siteTheme,HaloUtil.getIpAddr(request),HaloUtil.getDate())
|
new Logs(LogsRecord.CHANGE_THEME,"更换为"+siteTheme,HaloUtil.getIpAddr(request),HaloUtil.getDate())
|
||||||
);
|
);
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("主题设置失败,当前主题为:"+BaseController.THEME);
|
log.error("主题设置失败,当前主题为:"+BaseController.THEME);
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +175,6 @@ public class ThemeController extends BaseController{
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public boolean saveTpl(@RequestParam("tplName") String tplName,
|
public boolean saveTpl(@RequestParam("tplName") String tplName,
|
||||||
@RequestParam("tplContent") String tplContent){
|
@RequestParam("tplContent") String tplContent){
|
||||||
System.out.println(tplContent);
|
|
||||||
if(StringUtils.isBlank(tplContent)){
|
if(StringUtils.isBlank(tplContent)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.domain.User;
|
import cc.ryanc.halo.model.domain.User;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.RespStatus;
|
|
||||||
import cc.ryanc.halo.service.UserService;
|
import cc.ryanc.halo.service.UserService;
|
||||||
import cc.ryanc.halo.util.HaloUtil;
|
import cc.ryanc.halo.util.HaloUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -48,20 +47,20 @@ public class UserController {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "save")
|
@PostMapping(value = "save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String saveProfile(@ModelAttribute User user,HttpSession session){
|
public boolean saveProfile(@ModelAttribute User user,HttpSession session){
|
||||||
try{
|
try{
|
||||||
if(null!=user){
|
if(null!=user){
|
||||||
userService.saveByUser(user);
|
userService.saveByUser(user);
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
}else{
|
}else{
|
||||||
log.error("用户信息不能为空值");
|
log.error("用户信息不能为空值");
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:"+e.getMessage());
|
log.error("未知错误:"+e.getMessage());
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +72,7 @@ public class UserController {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "changePass")
|
@PostMapping(value = "changePass")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String changePass(@ModelAttribute("beforePass") String beforePass,
|
public boolean changePass(@ModelAttribute("beforePass") String beforePass,
|
||||||
@ModelAttribute("newPass") String newPass,
|
@ModelAttribute("newPass") String newPass,
|
||||||
@ModelAttribute("userId") Long userId,
|
@ModelAttribute("userId") Long userId,
|
||||||
HttpSession session){
|
HttpSession session){
|
||||||
|
@ -86,12 +85,12 @@ public class UserController {
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
}else{
|
}else{
|
||||||
log.error("修改密码:原密码错误!");
|
log.error("修改密码:原密码错误!");
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("修改密码:未知错误,"+e.getMessage());
|
log.error("修改密码:未知错误,"+e.getMessage());
|
||||||
return RespStatus.ERROR;
|
return false;
|
||||||
}
|
}
|
||||||
return RespStatus.SUCCESS;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class InstallInterceptor implements HandlerInterceptor {
|
||||||
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||||
File installFile = new File(basePath.getAbsolutePath(), "install.lock");
|
File installFile = new File(basePath.getAbsolutePath(), "install.lock");
|
||||||
if(installFile.exists()){
|
if(installFile.exists()){
|
||||||
|
response.sendRedirect("/");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
response.sendRedirect("/install");
|
response.sendRedirect("/install");
|
||||||
|
|
|
@ -28,6 +28,7 @@ spring:
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: update
|
ddl-auto: update
|
||||||
show-sql: false
|
show-sql: false
|
||||||
|
database-platform: org.hibernate.dialect.H2Dialect
|
||||||
|
|
||||||
# freemarker配置
|
# freemarker配置
|
||||||
freemarker:
|
freemarker:
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
##### Markdown语法教程 (Markdown syntax tutorial)
|
|
||||||
|
|
||||||
- [Markdown Syntax](http://daringfireball.net/projects/markdown/syntax/ "Markdown Syntax")
|
|
||||||
- [Mastering Markdown](https://guides.github.com/features/mastering-markdown/ "Mastering Markdown")
|
|
||||||
- [Markdown Basics](https://help.github.com/articles/markdown-basics/ "Markdown Basics")
|
|
||||||
- [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/ "GitHub Flavored Markdown")
|
|
||||||
- [Markdown 语法说明(简体中文)](http://www.markdown.cn/ "Markdown 语法说明(简体中文)")
|
|
||||||
- [Markdown 語法說明(繁體中文)](http://markdown.tw/ "Markdown 語法說明(繁體中文)")
|
|
||||||
|
|
||||||
##### 键盘快捷键 (Keyboard shortcuts)
|
|
||||||
|
|
||||||
> If Editor.md code editor is on focus, you can use keyboard shortcuts.
|
|
||||||
|
|
||||||
| Keyboard shortcuts (键盘快捷键) | 说明 | Description |
|
|
||||||
| :---------------------------------------------- |:--------------------------------- | :------------------------------------------------- |
|
|
||||||
| F9 | 切换实时预览 | Switch watch/unwatch |
|
|
||||||
| F10 | 全屏HTML预览(按 Shift + ESC 退出) | Full preview HTML (Press Shift + ESC exit) |
|
|
||||||
| F11 | 切换全屏状态 | Switch fullscreen (Press ESC exit) |
|
|
||||||
| Ctrl + 1~6 / Command + 1~6 | 插入标题1~6 | Insert heading 1~6 |
|
|
||||||
| Ctrl + A / Command + A | 全选 | Select all |
|
|
||||||
| Ctrl + B / Command + B | 插入粗体 | Insert bold |
|
|
||||||
| Ctrl + D / Command + D | 插入日期时间 | Insert datetime |
|
|
||||||
| Ctrl + E / Command + E | 插入Emoji符号 | Insert :emoji: |
|
|
||||||
| Ctrl + F / Command + F | 查找/搜索 | Start searching |
|
|
||||||
| Ctrl + G / Command + G | 切换到下一个搜索结果项 | Find next search results |
|
|
||||||
| Ctrl + H / Command + H | 插入水平线 | Insert horizontal rule |
|
|
||||||
| Ctrl + I / Command + I | 插入斜体 | Insert italic |
|
|
||||||
| Ctrl + K / Command + K | 插入行内代码 | Insert inline code |
|
|
||||||
| Ctrl + L / Command + L | 插入链接 | Insert link |
|
|
||||||
| Ctrl + U / Command + U | 插入无序列表 | Insert unordered list |
|
|
||||||
| Ctrl + Q | 代码折叠切换 | Switch code fold |
|
|
||||||
| Ctrl + Z / Command + Z | 撤销 | Undo |
|
|
||||||
| Ctrl + Y / Command + Y | 重做 | Redo |
|
|
||||||
| Ctrl + Shift + A | 插入@链接 | Insert @link |
|
|
||||||
| Ctrl + Shift + C | 插入行内代码 | Insert inline code |
|
|
||||||
| Ctrl + Shift + E | 打开插入Emoji表情对话框 | Open emoji dialog |
|
|
||||||
| Ctrl + Shift + F / Command + Option + F | 替换 | Replace |
|
|
||||||
| Ctrl + Shift + G / Shift + Command + G | 切换到上一个搜索结果项 | Find previous search results |
|
|
||||||
| Ctrl + Shift + H | 打开HTML实体字符对话框 | Open HTML Entities dialog |
|
|
||||||
| Ctrl + Shift + I | 插入图片 | Insert image ![]() |
|
|
||||||
| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol $$TeX$$ |
|
|
||||||
| Ctrl + Shift + L | 打开插入链接对话框 | Open link dialog |
|
|
||||||
| Ctrl + Shift + O | 插入有序列表 | Insert ordered list |
|
|
||||||
| Ctrl + Shift + P | 打开插入PRE对话框 | Open Preformatted text dialog |
|
|
||||||
| Ctrl + Shift + Q | 插入引用 | Insert blockquotes |
|
|
||||||
| Ctrl + Shift + R / Shift + Command + Option + F | 全部替换 | Replace all |
|
|
||||||
| Ctrl + Shift + S | 插入删除线 | Insert strikethrough |
|
|
||||||
| Ctrl + Shift + T | 打开插入表格对话框 | Open table dialog |
|
|
||||||
| Ctrl + Shift + U | 将所选文字转成大写 | Selection text convert to uppercase |
|
|
||||||
| Shift + Alt + C | 插入```代码 | Insert code blocks (```) |
|
|
||||||
| Shift + Alt + H | 打开使用帮助对话框 | Open help dialog |
|
|
||||||
| Shift + Alt + L | 将所选文本转成小写 | Selection text convert to lowercase |
|
|
||||||
| Shift + Alt + P | 插入分页符 | Insert page break |
|
|
||||||
| Alt + L | 将所选文本转成小写 | Selection text convert to lowercase |
|
|
||||||
| Shift + Alt + U | 将所选的每个单词的首字母转成大写 | Selection words first letter convert to Uppercase |
|
|
||||||
| Ctrl + Shift + Alt + C | 打开插入代码块对话框层 | Open code blocks dialog |
|
|
||||||
| Ctrl + Shift + Alt + I | 打开插入图片对话框层 | Open image dialog |
|
|
||||||
| Ctrl + Shift + Alt + U | 将所选文本的第一个首字母转成大写 | Selection text first letter convert to uppercase |
|
|
||||||
| Ctrl + Alt + G | 跳转到指定的行 | Goto line |
|
|
||||||
|
|
||||||
##### Emoji表情参考 (Emoji reference)
|
|
||||||
|
|
||||||
- [Github emoji](http://www.emoji-cheat-sheet.com/ "Github emoji")
|
|
||||||
- [Twitter Emoji \(Twemoji\)](http://twitter.github.io/twemoji/preview.html "Twitter Emoji \(Twemoji\)")
|
|
||||||
- [FontAwesome icons emoji](http://fortawesome.github.io/Font-Awesome/icons/ "FontAwesome icons emoji")
|
|
||||||
|
|
||||||
##### 流程图参考 (Flowchart reference)
|
|
||||||
|
|
||||||
[http://adrai.github.io/flowchart.js/](http://adrai.github.io/flowchart.js/)
|
|
||||||
|
|
||||||
##### 时序图参考 (SequenceDiagram reference)
|
|
||||||
|
|
||||||
[http://bramp.github.io/js-sequence-diagrams/](http://bramp.github.io/js-sequence-diagrams/)
|
|
||||||
|
|
||||||
##### TeX/LaTeX reference
|
|
||||||
|
|
||||||
[http://meta.wikimedia.org/wiki/Help:Formula](http://meta.wikimedia.org/wiki/Help:Formula)
|
|
|
@ -78,7 +78,7 @@
|
||||||
language: 'zh',
|
language: 'zh',
|
||||||
uploadUrl: '/admin/attachments/upload',
|
uploadUrl: '/admin/attachments/upload',
|
||||||
uploadAsync: true,
|
uploadAsync: true,
|
||||||
allowedFileExtensions: ['jpg','gif','png'],
|
allowedFileExtensions: ['jpg','gif','png','jpeg','svg','psd'],
|
||||||
maxFileCount: 100,
|
maxFileCount: 100,
|
||||||
enctype : 'multipart/form-data',
|
enctype : 'multipart/form-data',
|
||||||
showClose: false
|
showClose: false
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
'cateUrl' : url
|
'cateUrl' : url
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="exists"){
|
if(data==true){
|
||||||
showMsg("该路径已经存在!","info",2000);
|
showMsg("该路径已经存在!","info",2000);
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@
|
||||||
<#break >
|
<#break >
|
||||||
</#switch>
|
</#switch>
|
||||||
</td>
|
</td>
|
||||||
<td>${comment.commentDate}</td>
|
<td>${comment.commentDate?string("yyyy-MM-dd HH:mm")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</#list>
|
</#list>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
<td>${log.logTitle}</td>
|
<td>${log.logTitle}</td>
|
||||||
<td>${log.logContent}</td>
|
<td>${log.logContent}</td>
|
||||||
<td>${log.logIp}</td>
|
<td>${log.logIp}</td>
|
||||||
<td>${log.logCreated}</td>
|
<td>${log.logCreated?string("yyyy-MM-dd HH:mm")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</#list>
|
</#list>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
'loginPwd': pwd
|
'loginPwd': pwd
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="success"){
|
if(data==true){
|
||||||
$.toast({
|
$.toast({
|
||||||
text: "登录成功!",
|
text: "登录成功!",
|
||||||
heading: '提示',
|
heading: '提示',
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
'postUrl': $('#newPostUrl').val()
|
'postUrl': $('#newPostUrl').val()
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="exists"){
|
if(data==true){
|
||||||
showMsg("该路径已经存在!","info",2000);
|
showMsg("该路径已经存在!","info",2000);
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -571,7 +571,7 @@
|
||||||
postSummary : $('#postSummary').val()
|
postSummary : $('#postSummary').val()
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="success"){
|
if(data==true){
|
||||||
showMsg("所有文章摘要更新成功!","success",1000);
|
showMsg("所有文章摘要更新成功!","success",1000);
|
||||||
}else{
|
}else{
|
||||||
showMsg("更新失败!","success",2000);
|
showMsg("更新失败!","success",2000);
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
url: '/admin/profile/save',
|
url: '/admin/profile/save',
|
||||||
data: param,
|
data: param,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
if(result=="success"){
|
if(result==true){
|
||||||
$.toast({
|
$.toast({
|
||||||
text: "保存成功!",
|
text: "保存成功!",
|
||||||
heading: '提示',
|
heading: '提示',
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
url: '/admin/profile/changePass',
|
url: '/admin/profile/changePass',
|
||||||
data: param,
|
data: param,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
if(result=="success"){
|
if(result==true){
|
||||||
$.toast({
|
$.toast({
|
||||||
text: "修改密码成功!",
|
text: "修改密码成功!",
|
||||||
heading: '提示',
|
heading: '提示',
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
'tagUrl' : url
|
'tagUrl' : url
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="exists"){
|
if(data==true){
|
||||||
showMsg("该路径已经存在!","info",2000);
|
showMsg("该路径已经存在!","info",2000);
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,9 +169,8 @@
|
||||||
data: {
|
data: {
|
||||||
'siteTheme': site_theme
|
'siteTheme': site_theme
|
||||||
},
|
},
|
||||||
dataType: 'text',
|
success: function (data) {
|
||||||
success: function (result) {
|
if(data==true){
|
||||||
if(result=="success"){
|
|
||||||
$.toast({
|
$.toast({
|
||||||
text: "设置中...",
|
text: "设置中...",
|
||||||
heading: '提示',
|
heading: '提示',
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
language: 'zh',
|
language: 'zh',
|
||||||
uploadUrl: '/admin/attachments/upload',
|
uploadUrl: '/admin/attachments/upload',
|
||||||
uploadAsync: true,
|
uploadAsync: true,
|
||||||
allowedFileExtensions: ['jpg','gif','png'],
|
allowedFileExtensions: ['jpg','gif','png','jpeg','svg'],
|
||||||
maxFileCount: 10,
|
maxFileCount: 10,
|
||||||
enctype : 'multipart/form-data',
|
enctype : 'multipart/form-data',
|
||||||
showClose: false
|
showClose: false
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="native-info" style="padding-top: 5px;font-size: 12px;color: #0F192A;">
|
<div class="native-info" style="padding-top: 5px;font-size: 12px;color: #0F192A;">
|
||||||
|
<span id="native-info-total">${post.comments?size}</span>条评论
|
||||||
</div>
|
</div>
|
||||||
<ul class="native-list">
|
<ul class="native-list">
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
success: function(data){
|
success: function(data){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.native-loading').hide();
|
$('.native-loading').hide();
|
||||||
},2000);
|
},1000);
|
||||||
$.each(data,function(i,element){
|
$.each(data,function(i,element){
|
||||||
$.ua.set(element.commentAgent);
|
$.ua.set(element.commentAgent);
|
||||||
var uua = $.ua;
|
var uua = $.ua;
|
||||||
|
@ -192,7 +192,6 @@
|
||||||
var authorPic = md5(authorEmail);
|
var authorPic = md5(authorEmail);
|
||||||
$('.native-list').append("<li class=\"native-list-one\"><img class=\"native-list-one-img\" src=\"http://www.gravatar.com/avatar/"+authorPic+"?s=256&d=${options.native_comment_avatar?default('default')}\"><section><div class=\"native-list-one-head\"><a class=\"native-list-one-head-name\" rel=\"nofollow\" href=\""+authorUrl+"\" target=\"_blank\">"+author+"</a> <span class=\"ua\">"+browser+"</span> <span class=\"ua\">"+os+"</span></div><div class=\"native-list-one-content\"><p>"+content+"</p></div><div class=\"native-list-one-footer\"><span class=\"native-list-one-footer-time\">"+date+"</span> <span rid=\"5a58569744d904006a970794\" at=\"@舍的研习室\" mail=\"veganshe@163.com\" class=\"native-list-one-footer-reback\">回复</span></div></section></li>");
|
$('.native-list').append("<li class=\"native-list-one\"><img class=\"native-list-one-img\" src=\"http://www.gravatar.com/avatar/"+authorPic+"?s=256&d=${options.native_comment_avatar?default('default')}\"><section><div class=\"native-list-one-head\"><a class=\"native-list-one-head-name\" rel=\"nofollow\" href=\""+authorUrl+"\" target=\"_blank\">"+author+"</a> <span class=\"ua\">"+browser+"</span> <span class=\"ua\">"+os+"</span></div><div class=\"native-list-one-content\"><p>"+content+"</p></div><div class=\"native-list-one-footer\"><span class=\"native-list-one-footer-time\">"+date+"</span> <span rid=\"5a58569744d904006a970794\" at=\"@舍的研习室\" mail=\"veganshe@163.com\" class=\"native-list-one-footer-reback\">回复</span></div></section></li>");
|
||||||
});
|
});
|
||||||
$('.native-info').append("<span id=\"native-info-total\">${post.comments?size}</span>条评论");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -211,7 +210,7 @@
|
||||||
'commentAuthorAvatarMd5' : md5($('input[name=commentAuthorEmail]').val())
|
'commentAuthorAvatarMd5' : md5($('input[name=commentAuthorEmail]').val())
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data=="success"){
|
if(data==true){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<div class="logo animated fadeInUp">
|
<div class="logo animated fadeInUp">
|
||||||
Halo<small style="font-size: 14px;">安装向导</small>
|
Halo<small style="font-size: 14px;">安装向导</small>
|
||||||
</div>
|
</div>
|
||||||
|
<#if isInstall==false>
|
||||||
<form method="post" action="/install/do" class="form-horizontal" id="installForm">
|
<form method="post" action="/install/do" class="form-horizontal" id="installForm">
|
||||||
<div class="box box-solid animated" id="installFirst">
|
<div class="box box-solid animated" id="installFirst">
|
||||||
<div class="box-body" style="padding: 30px;">
|
<div class="box-body" style="padding: 30px;">
|
||||||
|
@ -116,6 +117,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<#else >
|
||||||
|
<div class="animated fadeInUp" style="animation-delay: 0.1s">
|
||||||
|
<h4>已经安装过了,不能重复安装的酱紫!</h4>
|
||||||
|
</div>
|
||||||
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -124,6 +130,7 @@
|
||||||
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
|
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
|
||||||
<script src="/static/plugins/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
|
<script src="/static/plugins/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
|
||||||
<script src="/static/plugins/bootstrapvalidator/js/language/zh_CN.js"></script>
|
<script src="/static/plugins/bootstrapvalidator/js/language/zh_CN.js"></script>
|
||||||
|
<#if isInstall==false>
|
||||||
<script>
|
<script>
|
||||||
var domain = window.location.host;
|
var domain = window.location.host;
|
||||||
$(function () {
|
$(function () {
|
||||||
|
@ -215,4 +222,7 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<#else>
|
||||||
|
<noscript>Not have Script!</noscript>
|
||||||
|
</#if>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue