👽 Updating Spring Boot to 2.0.1

pull/1/head
RYAN0UP_ 2018-03-21 17:56:25 +08:00
parent 10752ea6d1
commit 18c1ed2ec5
46 changed files with 140 additions and 198 deletions

View File

@ -10,6 +10,7 @@
<description>
halo一个基于SpringBoot的博客系统最求轻快易用以内容为中心。
</description>
<developers>
<developer>
<id>RYAN0UP</id>

View File

@ -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";
}

View File

@ -51,5 +51,5 @@ public interface AttachmentService {
* @param attachId attachId
* @return Attachment
*/
Optional<Attachment> removeByAttachId(Long attachId);
Attachment removeByAttachId(Long attachId);
}

View File

@ -26,7 +26,7 @@ public interface CategoryService {
* @param cateId
* @return category
*/
Optional<Category> removeByCateId(Long cateId);
Category removeByCateId(Long cateId);
/**
*

View File

@ -55,7 +55,7 @@ public interface CommentService {
* @param status status
* @return comment
*/
Optional<Comment> updateCommentStatus(Long commentId,Integer status);
Comment updateCommentStatus(Long commentId,Integer status);
/**
*

View File

@ -28,7 +28,7 @@ public interface GalleryService {
*
* @param galleryId galleryId
*/
Optional<Gallery> removeByGalleryId(Long galleryId);
Gallery removeByGalleryId(Long galleryId);
/**
*

View File

@ -26,7 +26,7 @@ public interface LinkService {
* @param linkId linkId
* @return Link
*/
Optional<Link> removeByLinkId(Long linkId);
Link removeByLinkId(Long linkId);
/**
*

View File

@ -34,7 +34,7 @@ public interface MenuService {
* @param menuId menuId
* @return menu
*/
Optional<Menu> removeByMenuId(Long menuId);
Menu removeByMenuId(Long menuId);
/**
*

View File

@ -31,7 +31,7 @@ public interface PostService {
* @param postId postId
* @return Post
*/
Optional<Post> removeByPostId(Long postId);
Post removeByPostId(Long postId);
/**
*

View File

@ -27,7 +27,7 @@ public interface TagService {
* @param tagId tagId
* @return Tag
*/
Optional<Tag> removeByTagId(Long tagId);
Tag removeByTagId(Long tagId);
/**
*

View File

@ -77,9 +77,9 @@ public class AttachmentServiceImpl implements AttachmentService{
* @return attachment
*/
@Override
public Optional<Attachment> removeByAttachId(Long attachId) {
public Attachment removeByAttachId(Long attachId) {
Optional<Attachment> attachment = this.findByAttachId(attachId);
attachmentRepository.delete(attachment.get());
return attachment;
return attachment.get();
}
}

View File

@ -48,10 +48,10 @@ public class CategoryServiceImpl implements CategoryService{
*/
@CacheEvict(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
@Override
public Optional<Category> removeByCateId(Long cateId) {
public Category removeByCateId(Long cateId) {
Optional<Category> category = this.findByCateId(cateId);
categoryRepository.delete(category.get());
return category;
return category.get();
}
/**

View File

@ -76,10 +76,10 @@ public class CommentServiceImpl implements CommentService {
* @return comment
*/
@Override
public Optional<Comment> updateCommentStatus(Long commentId, Integer status) {
public Comment updateCommentStatus(Long commentId, Integer status) {
Optional<Comment> comment = findCommentById(commentId);
commentRepository.save(comment.get());
return comment;
comment.get().setCommentStatus(status);
return commentRepository.save(comment.get());
}
/**

View File

@ -40,10 +40,10 @@ public class GalleryServiceImpl implements GalleryService{
* @param galleryId galleryId
*/
@Override
public Optional<Gallery> removeByGalleryId(Long galleryId) {
public Gallery removeByGalleryId(Long galleryId) {
Optional<Gallery> gallery = this.findByGalleryId(galleryId);
galleryRepository.delete(gallery.get());
return gallery;
return gallery.get();
}
/**

View File

@ -48,10 +48,10 @@ public class LinkServiceImpl implements LinkService {
*/
@CacheEvict(value = LINK_CACHE_NAME,key = LINK_KEY)
@Override
public Optional<Link> removeByLinkId(Long linkId) {
public Link removeByLinkId(Long linkId) {
Optional<Link> link = this.findByLinkId(linkId);
linkRepository.delete(link.get());
return link;
return link.get();
}
/**

View File

@ -49,10 +49,10 @@ public class MenuServiceImpl implements MenuService{
* @return menu
*/
@Override
public Optional<Menu> removeByMenuId(Long menuId) {
public Menu removeByMenuId(Long menuId) {
Optional<Menu> menu = this.findByMenuId(menuId);
menuRepository.delete(menu.get());
return menu;
return menu.get();
}
/**

View File

@ -54,10 +54,10 @@ public class PostServiceImpl implements PostService {
*/
@CacheEvict(value = POST_CACHE_NAME,key = POST_KEY)
@Override
public Optional<Post> removeByPostId(Long postId) {
public Post removeByPostId(Long postId) {
Optional<Post> post = this.findByPostId(postId);
postRepository.delete(post.get());
return post;
return post.get();
}
/**

View File

@ -43,10 +43,10 @@ public class TagServiceImpl implements TagService {
* @return Tag
*/
@Override
public Optional<Tag> removeByTagId(Long tagId) {
public Tag removeByTagId(Long tagId) {
Optional<Tag> tag = findByTagId(tagId);
tagRepository.delete(tag.get());
return tag;
return tag.get();
}
/**

View File

@ -160,7 +160,7 @@ public class HaloUtil {
* @param suffix
* @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{
Iterator iterator = ImageIO.getImageReadersByFormatName(suffix);
ImageReader reader = (ImageReader)iterator.next();

View File

@ -474,7 +474,7 @@ public class IndexController extends BaseController{
*/
@GetMapping(value = {"sitemap","sitemap.xml"},produces = { "application/xml;charset=UTF-8" })
@ResponseBody
public String sitemap(){
public String siteMap(){
//获取文章列表并根据时间排序
Sort sort = new Sort(Sort.Direction.DESC,"postDate");
Pageable pageable = new PageRequest(0,999,sort);
@ -492,7 +492,7 @@ public class IndexController extends BaseController{
*/
@PostMapping(value = "/newComment")
@ResponseBody
public String newComment(@ModelAttribute("comment") Comment comment,
public boolean newComment(@ModelAttribute("comment") Comment comment,
@ModelAttribute("post") Post post,
HttpServletRequest request){
comment.setCommentAuthorEmail(comment.getCommentAuthorEmail().toLowerCase());
@ -515,6 +515,6 @@ public class IndexController extends BaseController{
log.error("邮件服务器未配置:"+e.getMessage());
}
}
return "success";
return true;
}
}

View File

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
@ -53,7 +54,18 @@ public class InstallController {
* @return string
*/
@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";
}

View File

@ -6,7 +6,6 @@ import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.HaloConst;
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.LogsService;
import cc.ryanc.halo.service.PostService;
@ -116,7 +115,7 @@ public class AdminController extends BaseController{
*/
@PostMapping(value = "/getLogin")
@ResponseBody
public String getLogin(@ModelAttribute("loginName") String loginName,
public boolean getLogin(@ModelAttribute("loginName") String loginName,
@ModelAttribute("loginPwd") String loginPwd,
HttpSession session){
try {
@ -132,14 +131,14 @@ public class AdminController extends BaseController{
session.setAttribute(HaloConst.USER_SESSION_KEY, users.get(0));
log.info("用户["+ users.get(0).getUserName()+"]登录成功!");
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_SUCCESS,HaloUtil.getIpAddr(request), HaloUtil.getDate()));
return RespStatus.SUCCESS;
return true;
}else{
logsService.saveByLogs(new Logs(LogsRecord.LOGIN,LogsRecord.LOGIN_ERROR,HaloUtil.getIpAddr(request),new Date()));
}
}catch (Exception e){
log.error("登录失败!:"+e.getMessage());
}
return RespStatus.ERROR;
return false;
}
/**

View File

@ -4,7 +4,6 @@ import cc.ryanc.halo.model.domain.Attachment;
import cc.ryanc.halo.model.domain.Logs;
import cc.ryanc.halo.model.dto.HaloConst;
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.LogsService;
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.multipart.MultipartFile;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.util.Optional;
/**
@ -120,15 +122,22 @@ 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.setAttachSmallPath(new StringBuffer("/upload/").append(HaloUtil.YEAR).append("/").append(HaloUtil.MONTH).append("/").append(nameWithOutSuffix).append("_small.").append(fileSuffix).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());
//剪裁图片
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.setAttachSuffix(new StringBuffer(".").append(fileSuffix).toString());
attachment.setAttachCreated(HaloUtil.getDate());
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();
log.info("上传文件["+file.getOriginalFilename()+"]到["+mediaPath.getAbsolutePath()+"]成功");
logsService.saveByLogs(
@ -168,7 +177,7 @@ public class AttachmentController {
*/
@GetMapping(value = "/remove")
@ResponseBody
public String removeAttachment(@PathParam("attachId") Long attachId,
public boolean removeAttachment(@PathParam("attachId") Long attachId,
HttpServletRequest request){
Optional<Attachment> attachment = attachmentService.findByAttachId(attachId);
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 delFile = new File(new StringBuffer(mediaPath.getAbsolutePath()).append("/").append(delFileName).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.delete()&&delSmallFile.delete()){
if(delFile.delete()){
updateConst();
log.info("删除文件["+delFileName+"]成功!");
logsService.saveByLogs(
@ -192,13 +210,13 @@ public class AttachmentController {
);
}else{
log.error("删除附件["+delFileName+"]失败!");
return RespStatus.ERROR;
return false;
}
}
}catch (Exception e){
log.error("删除附件["+delFileName+"]失败!"+e.getMessage());
return RespStatus.ERROR;
return false;
}
return RespStatus.SUCCESS;
return true;
}
}

View File

@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Category;
import cc.ryanc.halo.model.dto.HaloConst;
import cc.ryanc.halo.model.dto.RespStatus;
import cc.ryanc.halo.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,12 +67,12 @@ public class CategoryController {
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public String checkCateUrlExists(@RequestParam("cateUrl") String cateUrl){
public boolean checkCateUrlExists(@RequestParam("cateUrl") String cateUrl){
Category category = categoryService.findByCateUrl(cateUrl);
if(null!=category){
return RespStatus.EXISTS;
return true;
}else{
return RespStatus.NOTEXISTS;
return false;
}
}
@ -86,8 +85,8 @@ public class CategoryController {
@GetMapping(value = "/remove")
public String removeCategory(@PathParam("cateId") Long cateId){
try{
Optional<Category> category = categoryService.removeByCateId(cateId);
log.info("删除的分类目录:"+category.get());
Category category = categoryService.removeByCateId(cateId);
log.info("删除的分类目录:"+category);
} catch (Exception e){
log.error("未知错误:"+e.getMessage());
}

View File

@ -103,24 +103,24 @@ public class CommentController extends BaseController{
public String moveToPublish(@PathParam("commentId") Long commentId,
@PathParam("status") Integer status,
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}");
Matcher matcher = patternEmail.matcher(comment.get().getCommentAuthorEmail());
Matcher matcher = patternEmail.matcher(comment.getCommentAuthorEmail());
//判断是否启用邮件服务
if("true".equals(HaloConst.OPTIONS.get("smtp_email_enable"))) {
try {
if (status == 1 && matcher.find()) {
Map<String, Object> map = new HashMap<>();
map.put("pageUrl", comment.get().getPost().getPostUrl());
map.put("pageName", comment.get().getPost().getPostTitle());
map.put("commentContent", comment.get().getCommentContent());
map.put("pageUrl", comment.getPost().getPostUrl());
map.put("pageName", comment.getPost().getPostTitle());
map.put("commentContent", comment.getCommentContent());
map.put("siteUrl", HaloConst.OPTIONS.get("site_url"));
map.put("siteTitle", HaloConst.OPTIONS.get("site_title"));
map.put("author", userService.findAllUser().get(0).getUserDisplayName());
mailService.sendTemplateMail(
comment.get().getCommentAuthorEmail(),
comment.getCommentAuthorEmail(),
"您在" + HaloConst.OPTIONS.get("site_title") + "的评论已审核通过!", map, "common/mail/mail_passed.ftl");
}
} catch (Exception e) {

View File

@ -1,7 +1,6 @@
package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.dto.HaloConst;
import cc.ryanc.halo.model.dto.RespStatus;
import cc.ryanc.halo.service.OptionsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,16 +42,16 @@ public class OptionController {
*/
@PostMapping(value = "/save")
@ResponseBody
public String saveOptions(@RequestParam Map<String,String> options){
public boolean saveOptions(@RequestParam Map<String,String> options){
try {
optionsService.saveOptions(options);
HaloConst.OPTIONS.clear();
HaloConst.OPTIONS = optionsService.findAllOptions();
log.info("所保存的设置选项列表:"+options);
return RespStatus.SUCCESS;
return true;
}catch (Exception e){
log.error("未知错误:",e.getMessage());
return RespStatus.ERROR;
return false;
}
}
}

View File

@ -101,8 +101,8 @@ public class PageController {
@GetMapping(value = "/links/remove")
public String removeLink(@PathParam("linkId") Long linkId){
try{
Optional<Link> link = linkService.removeByLinkId(linkId);
log.info("删除的友情链接:"+link.get());
Link link = linkService.removeByLinkId(linkId);
log.info("删除的友情链接:"+link);
}catch (Exception e){
log.error("未知错误:"+e.getMessage());
}

View File

@ -6,7 +6,6 @@ import cc.ryanc.halo.model.domain.Post;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.HaloConst;
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.LogsService;
import cc.ryanc.halo.service.PostService;
@ -256,13 +255,13 @@ public class PostController extends BaseController{
*/
@GetMapping(value = "/updateSummary")
@ResponseBody
public String updateSummary(@PathParam("postSummary") Integer postSummary){
public boolean updateSummary(@PathParam("postSummary") Integer postSummary){
try {
postService.updateAllSummary(postSummary);
return RespStatus.SUCCESS;
return true;
}catch (Exception e){
log.error("未知错误:"+e.getMessage());
return RespStatus.ERROR;
return false;
}
}
@ -274,12 +273,12 @@ public class PostController extends BaseController{
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public String checkUrlExists(@PathParam("postUrl") String postUrl){
public boolean checkUrlExists(@PathParam("postUrl") String postUrl){
Post post = postService.findByPostUrl(postUrl);
if(null!=post){
return RespStatus.EXISTS;
return true;
}else{
return RespStatus.NOTEXISTS;
return false;
}
}
}

View File

@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Tag;
import cc.ryanc.halo.model.dto.HaloConst;
import cc.ryanc.halo.model.dto.RespStatus;
import cc.ryanc.halo.service.TagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,12 +67,12 @@ public class TagController {
*/
@GetMapping(value = "/checkUrl")
@ResponseBody
public String checkTagUrlExists(@RequestParam("tagUrl") String tagUrl){
public boolean checkTagUrlExists(@RequestParam("tagUrl") String tagUrl){
Tag tag = tagService.findByTagUrl(tagUrl);
if(null!=tag){
return RespStatus.EXISTS;
return true;
}else{
return RespStatus.NOTEXISTS;
return false;
}
}
@ -86,8 +85,8 @@ public class TagController {
@GetMapping(value = "/remove")
public String removeTag(@PathParam("tagId") Long tagId){
try{
Optional<Tag> tag = tagService.removeByTagId(tagId);
log.info("删除的标签:"+tag.get());
Tag tag = tagService.removeByTagId(tagId);
log.info("删除的标签:"+tag);
}catch (Exception e){
log.error("未知错误:"+e.getMessage());
}

View File

@ -3,7 +3,6 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.Logs;
import cc.ryanc.halo.model.dto.HaloConst;
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.OptionsService;
import cc.ryanc.halo.util.HaloUtil;
@ -64,7 +63,7 @@ public class ThemeController extends BaseController{
*/
@GetMapping(value = "/set")
@ResponseBody
public String activeTheme(@PathParam("siteTheme") String siteTheme,
public boolean activeTheme(@PathParam("siteTheme") String siteTheme,
HttpServletRequest request){
try {
//保存主题设置项在数据库
@ -75,10 +74,10 @@ public class ThemeController extends BaseController{
logsService.saveByLogs(
new Logs(LogsRecord.CHANGE_THEME,"更换为"+siteTheme,HaloUtil.getIpAddr(request),HaloUtil.getDate())
);
return RespStatus.SUCCESS;
return true;
}catch (Exception e){
log.error("主题设置失败,当前主题为:"+BaseController.THEME);
return RespStatus.ERROR;
return false;
}
}
@ -176,7 +175,6 @@ public class ThemeController extends BaseController{
@ResponseBody
public boolean saveTpl(@RequestParam("tplName") String tplName,
@RequestParam("tplContent") String tplContent){
System.out.println(tplContent);
if(StringUtils.isBlank(tplContent)){
return false;
}

View File

@ -2,7 +2,6 @@ package cc.ryanc.halo.web.controller.admin;
import cc.ryanc.halo.model.domain.User;
import cc.ryanc.halo.model.dto.HaloConst;
import cc.ryanc.halo.model.dto.RespStatus;
import cc.ryanc.halo.service.UserService;
import cc.ryanc.halo.util.HaloUtil;
import lombok.extern.slf4j.Slf4j;
@ -48,20 +47,20 @@ public class UserController {
*/
@PostMapping(value = "save")
@ResponseBody
public String saveProfile(@ModelAttribute User user,HttpSession session){
public boolean saveProfile(@ModelAttribute User user,HttpSession session){
try{
if(null!=user){
userService.saveByUser(user);
session.invalidate();
}else{
log.error("用户信息不能为空值");
return RespStatus.ERROR;
return false;
}
}catch (Exception e){
log.error("未知错误:"+e.getMessage());
return RespStatus.ERROR;
return false;
}
return RespStatus.SUCCESS;
return true;
}
/**
@ -73,7 +72,7 @@ public class UserController {
*/
@PostMapping(value = "changePass")
@ResponseBody
public String changePass(@ModelAttribute("beforePass") String beforePass,
public boolean changePass(@ModelAttribute("beforePass") String beforePass,
@ModelAttribute("newPass") String newPass,
@ModelAttribute("userId") Long userId,
HttpSession session){
@ -86,12 +85,12 @@ public class UserController {
session.invalidate();
}else{
log.error("修改密码:原密码错误!");
return RespStatus.ERROR;
return false;
}
}catch (Exception e){
log.error("修改密码:未知错误,"+e.getMessage());
return RespStatus.ERROR;
return false;
}
return RespStatus.SUCCESS;
return true;
}
}

View File

@ -22,6 +22,7 @@ public class InstallInterceptor implements HandlerInterceptor {
File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
File installFile = new File(basePath.getAbsolutePath(), "install.lock");
if(installFile.exists()){
response.sendRedirect("/");
return true;
}
response.sendRedirect("/install");

View File

@ -28,6 +28,7 @@ spring:
hibernate:
ddl-auto: update
show-sql: false
database-platform: org.hibernate.dialect.H2Dialect
# freemarker配置
freemarker:

View File

@ -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 &#58;emoji&#58; |
| 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 &#64;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 &#33;[]&#40;&#41; |
| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol &#36;&#36;TeX&#36;&#36; |
| 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)

View File

@ -78,7 +78,7 @@
language: 'zh',
uploadUrl: '/admin/attachments/upload',
uploadAsync: true,
allowedFileExtensions: ['jpg','gif','png'],
allowedFileExtensions: ['jpg','gif','png','jpeg','svg','psd'],
maxFileCount: 100,
enctype : 'multipart/form-data',
showClose: false

View File

@ -135,7 +135,7 @@
'cateUrl' : url
},
success: function (data) {
if(data=="exists"){
if(data==true){
showMsg("该路径已经存在!","info",2000);
result = false;
}

View File

@ -263,7 +263,7 @@
<#break >
</#switch>
</td>
<td>${comment.commentDate}</td>
<td>${comment.commentDate?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
</tr>
@ -311,7 +311,7 @@
<td>${log.logTitle}</td>
<td>${log.logContent}</td>
<td>${log.logIp}</td>
<td>${log.logCreated}</td>
<td>${log.logCreated?string("yyyy-MM-dd HH:mm")}</td>
</tr>
</#list>
</tr>

View File

@ -63,7 +63,7 @@
'loginPwd': pwd
},
success: function (data) {
if(data=="success"){
if(data==true){
$.toast({
text: "登录成功!",
heading: '提示',

View File

@ -181,7 +181,7 @@
'postUrl': $('#newPostUrl').val()
},
success: function (data) {
if(data=="exists"){
if(data==true){
showMsg("该路径已经存在!","info",2000);
return;
}else{

View File

@ -571,7 +571,7 @@
postSummary : $('#postSummary').val()
},
success: function (data) {
if(data=="success"){
if(data==true){
showMsg("所有文章摘要更新成功!","success",1000);
}else{
showMsg("更新失败!","success",2000);

View File

@ -157,7 +157,7 @@
url: '/admin/profile/save',
data: param,
success: function (result) {
if(result=="success"){
if(result==true){
$.toast({
text: "保存成功!",
heading: '提示',
@ -198,7 +198,7 @@
url: '/admin/profile/changePass',
data: param,
success: function (result) {
if(result=="success"){
if(result==true){
$.toast({
text: "修改密码成功!",
heading: '提示',

View File

@ -128,7 +128,7 @@
'tagUrl' : url
},
success: function (data) {
if(data=="exists"){
if(data==true){
showMsg("该路径已经存在!","info",2000);
result = false;
}

View File

@ -169,9 +169,8 @@
data: {
'siteTheme': site_theme
},
dataType: 'text',
success: function (result) {
if(result=="success"){
success: function (data) {
if(data==true){
$.toast({
text: "设置中...",
heading: '提示',

View File

@ -70,7 +70,7 @@
language: 'zh',
uploadUrl: '/admin/attachments/upload',
uploadAsync: true,
allowedFileExtensions: ['jpg','gif','png'],
allowedFileExtensions: ['jpg','gif','png','jpeg','svg'],
maxFileCount: 10,
enctype : 'multipart/form-data',
showClose: false

View File

@ -155,7 +155,7 @@
</div>
</div>
<div class="native-info" style="padding-top: 5px;font-size: 12px;color: #0F192A;">
<span id="native-info-total">${post.comments?size}</span>条评论
</div>
<ul class="native-list">
@ -177,7 +177,7 @@
success: function(data){
setTimeout(function(){
$('.native-loading').hide();
},2000);
},1000);
$.each(data,function(i,element){
$.ua.set(element.commentAgent);
var uua = $.ua;
@ -192,7 +192,6 @@
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-info').append("<span id=\"native-info-total\">${post.comments?size}</span>条评论");
}
});
});
@ -211,7 +210,7 @@
'commentAuthorAvatarMd5' : md5($('input[name=commentAuthorEmail]').val())
},
success: function (data) {
if(data=="success"){
if(data==true){
window.location.reload();
}
}

View File

@ -34,6 +34,7 @@
<div class="logo animated fadeInUp">
Halo<small style="font-size: 14px;">安装向导</small>
</div>
<#if isInstall==false>
<form method="post" action="/install/do" class="form-horizontal" id="installForm">
<div class="box box-solid animated" id="installFirst">
<div class="box-body" style="padding: 30px;">
@ -116,6 +117,11 @@
</div>
</div>
</form>
<#else >
<div class="animated fadeInUp" style="animation-delay: 0.1s">
<h4>已经安装过了,不能重复安装的酱紫!</h4>
</div>
</#if>
</div>
</div>
</div>
@ -124,6 +130,7 @@
<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/language/zh_CN.js"></script>
<#if isInstall==false>
<script>
var domain = window.location.host;
$(function () {
@ -215,4 +222,7 @@
});
});
</script>
<#else>
<noscript>Not have Script!</noscript>
</#if>
</html>