mirror of https://github.com/halo-dev/halo
v1.0
parent
fe1204f441
commit
42513c291a
|
@ -1,14 +1,27 @@
|
||||||
package cc.ryanc.halo.listener;
|
package cc.ryanc.halo.listener;
|
||||||
|
|
||||||
import cc.ryanc.halo.config.properties.HaloProperties;
|
import cc.ryanc.halo.config.properties.HaloProperties;
|
||||||
|
import cc.ryanc.halo.model.support.HaloConst;
|
||||||
|
import cc.ryanc.halo.model.support.Theme;
|
||||||
|
import cc.ryanc.halo.service.OptionService;
|
||||||
import cc.ryanc.halo.utils.HaloUtils;
|
import cc.ryanc.halo.utils.HaloUtils;
|
||||||
|
import cc.ryanc.halo.utils.ThemeUtils;
|
||||||
|
import cc.ryanc.halo.web.controller.content.base.BaseContentController;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import freemarker.template.TemplateModelException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -31,18 +44,54 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
||||||
@Autowired
|
@Autowired
|
||||||
private HaloProperties haloProperties;
|
private HaloProperties haloProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OptionService optionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationStartedEvent event) {
|
public void onApplicationEvent(ApplicationStartedEvent event) {
|
||||||
// save halo version to database
|
// save halo version to database
|
||||||
// TODO Complete cache option value
|
// TODO Complete cache option value
|
||||||
// TODO Complete load active theme
|
this.cacheOptions();
|
||||||
// TODO Complete load option
|
this.cacheThemes();
|
||||||
// TODO Load themes
|
this.cacheOwo();
|
||||||
// TODO Load owo
|
this.getActiveTheme();
|
||||||
|
|
||||||
this.printStartInfo();
|
this.printStartInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache options to map
|
||||||
|
*/
|
||||||
|
private void cacheOptions() {
|
||||||
|
HaloConst.OPTIONS = optionService.listOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache themes to map
|
||||||
|
*/
|
||||||
|
private void cacheThemes() {
|
||||||
|
final List<Theme> themes = ThemeUtils.getThemes();
|
||||||
|
if (null != themes) {
|
||||||
|
HaloConst.THEMES = themes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get active theme
|
||||||
|
*/
|
||||||
|
private void getActiveTheme() {
|
||||||
|
final String themeValue = optionService.getByKey("theme");
|
||||||
|
if (StrUtil.isNotEmpty(themeValue) && !StrUtil.equals(themeValue, null)) {
|
||||||
|
BaseContentController.THEME = themeValue;
|
||||||
|
} else {
|
||||||
|
BaseContentController.THEME = "anatole";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
configuration.setSharedVariable("themeName", BaseContentController.THEME);
|
||||||
|
} catch (TemplateModelException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void printStartInfo() {
|
private void printStartInfo() {
|
||||||
// Get server port
|
// Get server port
|
||||||
String serverPort = applicationContext.getEnvironment().getProperty("server.port");
|
String serverPort = applicationContext.getEnvironment().getProperty("server.port");
|
||||||
|
@ -75,4 +124,16 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
||||||
|
|
||||||
return blogUrl;
|
return blogUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Owo
|
||||||
|
*/
|
||||||
|
private void cacheOwo() {
|
||||||
|
try {
|
||||||
|
File file = new File(ResourceUtils.getURL("classpath:").getPath(), "static/halo-common/OwO/OwO.path.json");
|
||||||
|
HaloConst.OWO = JSONUtil.readJSONObject(file, Charset.forName("UTF-8"));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package cc.ryanc.halo.model.support;
|
package cc.ryanc.halo.model.support;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -21,22 +23,22 @@ public class HaloConst {
|
||||||
public static final String HALO_VERSION = "0.4.2";
|
public static final String HALO_VERSION = "0.4.2";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token key
|
* Token of header param
|
||||||
*/
|
*/
|
||||||
public static final String TOKEN_HEADER = "token";
|
public static final String TOKEN_HEADER = "token";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有设置选项(key,value)
|
* All of the options
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> OPTIONS = new HashMap<>();
|
public static Map<String, String> OPTIONS = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OwO表情
|
* All of the Owo
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> OWO = new HashMap<>();
|
public static JSONObject OWO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有主题
|
* All of the themes
|
||||||
*/
|
*/
|
||||||
public static List<Theme> THEMES = new ArrayList<>();
|
public static List<Theme> THEMES = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package cc.ryanc.halo.utils;
|
package cc.ryanc.halo.utils;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.support.Theme;
|
|
||||||
import cn.hutool.core.text.StrBuilder;
|
import cn.hutool.core.text.StrBuilder;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.qiniu.common.Zone;
|
import com.qiniu.common.Zone;
|
||||||
|
@ -8,7 +7,6 @@ import io.github.biezhi.ome.OhMyEmail;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ResourceUtils;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -23,7 +21,9 @@ import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.attribute.BasicFileAttributeView;
|
import java.nio.file.attribute.BasicFileAttributeView;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.*;
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import static cc.ryanc.halo.model.support.HaloConst.OPTIONS;
|
import static cc.ryanc.halo.model.support.HaloConst.OPTIONS;
|
||||||
|
|
||||||
|
|
|
@ -15,33 +15,35 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Markdown utils
|
||||||
|
*
|
||||||
* @author : RYAN0UP
|
* @author : RYAN0UP
|
||||||
* @date : 2018/11/14
|
* @date : 2018/11/14
|
||||||
*/
|
*/
|
||||||
public class MarkdownUtils {
|
public class MarkdownUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Front-matter 插件
|
* Front-matter extension
|
||||||
*/
|
*/
|
||||||
private static final Set<Extension> EXTENSIONS_YAML = Collections.singleton(YamlFrontMatterExtension.create());
|
private static final Set<Extension> EXTENSIONS_YAML = Collections.singleton(YamlFrontMatterExtension.create());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table 插件
|
* Table extension
|
||||||
*/
|
*/
|
||||||
private static final Set<Extension> EXTENSIONS_TABLE = Collections.singleton(TablesExtension.create());
|
private static final Set<Extension> EXTENSIONS_TABLE = Collections.singleton(TablesExtension.create());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析 Markdown 文档
|
* Parse Markdown content
|
||||||
*/
|
*/
|
||||||
private static final Parser PARSER = Parser.builder().extensions(EXTENSIONS_YAML).extensions(EXTENSIONS_TABLE).build();
|
private static final Parser PARSER = Parser.builder().extensions(EXTENSIONS_YAML).extensions(EXTENSIONS_TABLE).build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染 HTML 文档
|
* Render HTML content
|
||||||
*/
|
*/
|
||||||
private static final HtmlRenderer RENDERER = HtmlRenderer.builder().extensions(EXTENSIONS_YAML).extensions(EXTENSIONS_TABLE).build();
|
private static final HtmlRenderer RENDERER = HtmlRenderer.builder().extensions(EXTENSIONS_YAML).extensions(EXTENSIONS_TABLE).build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染 Markdown
|
* Render Markdown content
|
||||||
*
|
*
|
||||||
* @param content content
|
* @param content content
|
||||||
* @return String
|
* @return String
|
||||||
|
@ -66,7 +68,7 @@ public class MarkdownUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取元数据
|
* Get front-matter
|
||||||
*
|
*
|
||||||
* @param content content
|
* @param content content
|
||||||
* @return Map
|
* @return Map
|
||||||
|
|
|
@ -5,9 +5,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import static cc.ryanc.halo.model.support.HaloConst.OWO;
|
import static cc.ryanc.halo.model.support.HaloConst.OWO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* Owo util
|
||||||
* OwO表情工具类
|
|
||||||
* </pre>
|
|
||||||
*
|
*
|
||||||
* @author : RYAN0UP
|
* @author : RYAN0UP
|
||||||
* @date : 2017/12/22
|
* @date : 2017/12/22
|
||||||
|
@ -16,15 +14,15 @@ import static cc.ryanc.halo.model.support.HaloConst.OWO;
|
||||||
public class OwoUtil {
|
public class OwoUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将表情标志转化为图片地址
|
* Owo mark converted into a picture address
|
||||||
*
|
*
|
||||||
* @param mark 表情标志
|
* @param content content
|
||||||
* @return 表情图片地址
|
* @return picture address
|
||||||
*/
|
*/
|
||||||
public static String markToImg(String mark) {
|
public static String parseOwo(String content) {
|
||||||
for (String key : OWO.keySet()) {
|
for (String key : OWO.keySet()) {
|
||||||
mark = mark.replace(key, OWO.get(key));
|
content = content.replace(key, OWO.get(key).toString());
|
||||||
}
|
}
|
||||||
return mark;
|
return content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package cc.ryanc.halo.utils;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.support.HaloConst;
|
import cc.ryanc.halo.model.support.HaloConst;
|
||||||
import cc.ryanc.halo.model.support.Theme;
|
import cc.ryanc.halo.model.support.Theme;
|
||||||
import cc.ryanc.halo.web.controller.core.BaseContentController;
|
import cc.ryanc.halo.web.controller.content.base.BaseContentController;
|
||||||
import cn.hutool.core.text.StrBuilder;
|
import cn.hutool.core.text.StrBuilder;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import cc.ryanc.halo.service.OptionService;
|
||||||
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
import cc.ryanc.halo.utils.LocaleMessageUtil;
|
||||||
import cc.ryanc.halo.utils.ThemeUtils;
|
import cc.ryanc.halo.utils.ThemeUtils;
|
||||||
import cc.ryanc.halo.web.controller.admin.base.BaseController;
|
import cc.ryanc.halo.web.controller.admin.base.BaseController;
|
||||||
import cc.ryanc.halo.web.controller.core.BaseContentController;
|
import cc.ryanc.halo.web.controller.content.base.BaseContentController;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.file.FileReader;
|
import cn.hutool.core.io.file.FileReader;
|
||||||
import cn.hutool.core.io.file.FileWriter;
|
import cn.hutool.core.io.file.FileWriter;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.content;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blog index page controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-17
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping
|
||||||
|
public class IndexController {
|
||||||
|
}
|
|
@ -1,12 +1,10 @@
|
||||||
package cc.ryanc.halo.web.controller.core;
|
package cc.ryanc.halo.web.controller.content.base;
|
||||||
|
|
||||||
import cc.ryanc.halo.logging.Logger;
|
import cc.ryanc.halo.logging.Logger;
|
||||||
import cn.hutool.core.text.StrBuilder;
|
import cn.hutool.core.text.StrBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* Content base Controller
|
||||||
* Controller抽象类
|
|
||||||
* </pre>
|
|
||||||
*
|
*
|
||||||
* @author : RYAN0UP
|
* @author : RYAN0UP
|
||||||
* @date : 2017/12/15
|
* @date : 2017/12/15
|
||||||
|
@ -14,16 +12,17 @@ import cn.hutool.core.text.StrBuilder;
|
||||||
public abstract class BaseContentController {
|
public abstract class BaseContentController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义默认主题
|
* Default theme
|
||||||
*/
|
*/
|
||||||
public static String THEME = "anatole";
|
public static String THEME = "anatole";
|
||||||
|
|
||||||
protected Logger log = Logger.getLogger(getClass());
|
protected Logger log = Logger.getLogger(getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据模板名称渲染页面
|
* Render page by template name
|
||||||
*
|
*
|
||||||
* @param pageName pageName
|
* @param pageName pageName
|
||||||
* @return 返回拼接好的模板路径
|
* @return template path
|
||||||
*/
|
*/
|
||||||
public String render(String pageName) {
|
public String render(String pageName) {
|
||||||
final StrBuilder themeStr = new StrBuilder("themes/");
|
final StrBuilder themeStr = new StrBuilder("themes/");
|
||||||
|
@ -34,7 +33,7 @@ public abstract class BaseContentController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染404页面
|
* Redirect to 404
|
||||||
*
|
*
|
||||||
* @return redirect:/404
|
* @return redirect:/404
|
||||||
*/
|
*/
|
|
@ -4,6 +4,7 @@ import cc.ryanc.halo.logging.Logger;
|
||||||
import cc.ryanc.halo.model.entity.User;
|
import cc.ryanc.halo.model.entity.User;
|
||||||
import cc.ryanc.halo.model.support.HaloConst;
|
import cc.ryanc.halo.model.support.HaloConst;
|
||||||
import cc.ryanc.halo.utils.ThemeUtils;
|
import cc.ryanc.halo.utils.ThemeUtils;
|
||||||
|
import cc.ryanc.halo.web.controller.content.base.BaseContentController;
|
||||||
import cn.hutool.core.text.StrBuilder;
|
import cn.hutool.core.text.StrBuilder;
|
||||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -15,9 +16,7 @@ import javax.servlet.http.HttpSession;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* Error page Controller
|
||||||
* 错误页面控制器
|
|
||||||
* </pre>
|
|
||||||
*
|
*
|
||||||
* @author : RYAN0UP
|
* @author : RYAN0UP
|
||||||
* @date : 2017/12/26
|
* @date : 2017/12/26
|
||||||
|
@ -27,10 +26,16 @@ public class CommonController implements ErrorController {
|
||||||
|
|
||||||
private static final String ERROR_PATH = "/error";
|
private static final String ERROR_PATH = "/error";
|
||||||
|
|
||||||
|
private static final String NOT_FROUND_TEMPLATE = "404.ftl";
|
||||||
|
|
||||||
|
private static final String INTERNAL_ERROR_TEMPLATE = "500.ftl";
|
||||||
|
|
||||||
|
private static final String ADMIN_URL = "/admin";
|
||||||
|
|
||||||
private final Logger log = Logger.getLogger(getClass());
|
private final Logger log = Logger.getLogger(getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染404,500
|
* Handle error
|
||||||
*
|
*
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return String
|
* @return String
|
||||||
|
@ -54,14 +59,14 @@ public class CommonController implements ErrorController {
|
||||||
if (StringUtils.startsWithIgnoreCase(throwable.getMessage(), "Could not resolve view with name '")) {
|
if (StringUtils.startsWithIgnoreCase(throwable.getMessage(), "Could not resolve view with name '")) {
|
||||||
// TODO May cause unreasoned problem
|
// TODO May cause unreasoned problem
|
||||||
// if Ftl was not found then redirect to /404
|
// if Ftl was not found then redirect to /404
|
||||||
if (requestURI.contains("/admin") && null != user) {
|
if (requestURI.contains(ADMIN_URL) && null != user) {
|
||||||
return "redirect:/admin/404";
|
return "redirect:/admin/404";
|
||||||
} else {
|
} else {
|
||||||
return "redirect:/404";
|
return "redirect:/404";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (requestURI.contains("/admin") && null != user) {
|
if (requestURI.contains(ADMIN_URL) && null != user) {
|
||||||
return "redirect:/admin/500";
|
return "redirect:/admin/500";
|
||||||
} else {
|
} else {
|
||||||
return "redirect:/500";
|
return "redirect:/500";
|
||||||
|
@ -95,7 +100,7 @@ public class CommonController implements ErrorController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/404")
|
@GetMapping(value = "/404")
|
||||||
public String contentNotFround() throws FileNotFoundException {
|
public String contentNotFround() throws FileNotFoundException {
|
||||||
if(ThemeUtils.isTemplateExist("404.ftl")){
|
if (ThemeUtils.isTemplateExist(NOT_FROUND_TEMPLATE)) {
|
||||||
return "common/error/404";
|
return "common/error/404";
|
||||||
}
|
}
|
||||||
StrBuilder path = new StrBuilder("themes/");
|
StrBuilder path = new StrBuilder("themes/");
|
||||||
|
@ -111,7 +116,7 @@ public class CommonController implements ErrorController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/500")
|
@GetMapping(value = "/500")
|
||||||
public String contentInternalError() throws FileNotFoundException {
|
public String contentInternalError() throws FileNotFoundException {
|
||||||
if(ThemeUtils.isTemplateExist("500.ftl")){
|
if (ThemeUtils.isTemplateExist(INTERNAL_ERROR_TEMPLATE)) {
|
||||||
return "common/error/404";
|
return "common/error/404";
|
||||||
}
|
}
|
||||||
StrBuilder path = new StrBuilder("themes/");
|
StrBuilder path = new StrBuilder("themes/");
|
||||||
|
|
|
@ -86,8 +86,10 @@ public class InstallController {
|
||||||
* Do install
|
* Do install
|
||||||
*
|
*
|
||||||
* @param blogLocale language
|
* @param blogLocale language
|
||||||
|
* @param blogTitle blog title
|
||||||
|
* @param blogUrl blog url
|
||||||
* @param userName user name
|
* @param userName user name
|
||||||
* @param userDisplayName nickname
|
* @param nickName nick name
|
||||||
* @param userEmail user email
|
* @param userEmail user email
|
||||||
* @param userPwd user password
|
* @param userPwd user password
|
||||||
* @param request request
|
* @param request request
|
||||||
|
@ -99,7 +101,7 @@ public class InstallController {
|
||||||
@RequestParam("blogTitle") String blogTitle,
|
@RequestParam("blogTitle") String blogTitle,
|
||||||
@RequestParam("blogUrl") String blogUrl,
|
@RequestParam("blogUrl") String blogUrl,
|
||||||
@RequestParam("userName") String userName,
|
@RequestParam("userName") String userName,
|
||||||
@RequestParam("userDisplayName") String userDisplayName,
|
@RequestParam("userDisplayName") String nickName,
|
||||||
@RequestParam("userEmail") String userEmail,
|
@RequestParam("userEmail") String userEmail,
|
||||||
@RequestParam("userPwd") String userPwd,
|
@RequestParam("userPwd") String userPwd,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
|
@ -107,23 +109,20 @@ public class InstallController {
|
||||||
if (StrUtil.equals("true", OPTIONS.get("is_install"))) {
|
if (StrUtil.equals("true", OPTIONS.get("is_install"))) {
|
||||||
return new JsonResult(0, "该博客已初始化,不能再次安装!");
|
return new JsonResult(0, "该博客已初始化,不能再次安装!");
|
||||||
}
|
}
|
||||||
//创建新的用户
|
// Create new user
|
||||||
final User user = new User();
|
final User user = new User();
|
||||||
user.setUsername(userName);
|
user.setUsername(userName);
|
||||||
if (StrUtil.isBlank(userDisplayName)) {
|
user.setNickname(StrUtil.isBlank(nickName) ? userName : nickName);
|
||||||
userDisplayName = userName;
|
|
||||||
}
|
|
||||||
user.setNickname(userDisplayName);
|
|
||||||
user.setEmail(userEmail);
|
user.setEmail(userEmail);
|
||||||
user.setPassword(SecureUtil.md5(userPwd));
|
user.setPassword(SecureUtil.md5(userPwd));
|
||||||
userService.create(user);
|
userService.create(user);
|
||||||
|
|
||||||
//默认分类
|
//默认分类
|
||||||
final Category category = new Category();
|
Category category = new Category();
|
||||||
category.setName("未分类");
|
category.setName("未分类");
|
||||||
category.setSnakeName("default");
|
category.setSnakeName("default");
|
||||||
category.setDescription("未分类");
|
category.setDescription("未分类");
|
||||||
categoryService.create(category);
|
category = categoryService.create(category);
|
||||||
|
|
||||||
//第一篇文章
|
//第一篇文章
|
||||||
final Post post = new Post();
|
final Post post = new Post();
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
{
|
||||||
|
"@[勉强]": "<img src='/static/halo-common/OwO/paopao/勉强.png' alt='勉强.png' style='vertical-align: middle;'>",
|
||||||
|
"@[乖]": "<img src='/static/halo-common/OwO/paopao/乖.png' alt='乖.png' style='vertical-align: middle;'>",
|
||||||
|
"@[黑线]": "<img src='/static/halo-common/OwO/paopao/黑线.png' alt='黑线.png' style='vertical-align: middle;'>",
|
||||||
|
"@(献花)": "<img src='/static/halo-common/OwO/alu/献花.png' alt='献花.png' style='vertical-align: middle;'>",
|
||||||
|
"@(想一想)": "<img src='/static/halo-common/OwO/alu/想一想.png' alt='想一想.png' style='vertical-align: middle;'>",
|
||||||
|
"@(蜡烛)": "<img src='/static/halo-common/OwO/alu/蜡烛.png' alt='蜡烛.png' style='vertical-align: middle;'>",
|
||||||
|
"@[滑稽]": "<img src='/static/halo-common/OwO/paopao/滑稽.png' alt='滑稽.png' style='vertical-align: middle;'>",
|
||||||
|
"@(黑线)": "<img src='/static/halo-common/OwO/alu/黑线.png' alt='黑线.png' style='vertical-align: middle;'>",
|
||||||
|
"@[小乖]": "<img src='/static/halo-common/OwO/paopao/小乖.png' alt='小乖.png' style='vertical-align: middle;'>",
|
||||||
|
"@(中枪)": "<img src='/static/halo-common/OwO/alu/中枪.png' alt='中枪.png' style='vertical-align: middle;'>",
|
||||||
|
"@(长草)": "<img src='/static/halo-common/OwO/alu/长草.png' alt='长草.png' style='vertical-align: middle;'>",
|
||||||
|
"@[捂嘴笑]": "<img src='/static/halo-common/OwO/paopao/捂嘴笑.png' alt='捂嘴笑.png' style='vertical-align: middle;'>",
|
||||||
|
"@[酷]": "<img src='/static/halo-common/OwO/paopao/酷.png' alt='酷.png' style='vertical-align: middle;'>",
|
||||||
|
"@(喷血)": "<img src='/static/halo-common/OwO/alu/喷血.png' alt='喷血.png' style='vertical-align: middle;'>",
|
||||||
|
"@[彩虹]": "<img src='/static/halo-common/OwO/paopao/彩虹.png' alt='彩虹.png' style='vertical-align: middle;'>",
|
||||||
|
"@[钱]": "<img src='/static/halo-common/OwO/paopao/钱.png' alt='钱.png' style='vertical-align: middle;'>",
|
||||||
|
"@(呲牙)": "<img src='/static/halo-common/OwO/alu/呲牙.png' alt='呲牙.png' style='vertical-align: middle;'>",
|
||||||
|
"@[手纸]": "<img src='/static/halo-common/OwO/paopao/手纸.png' alt='手纸.png' style='vertical-align: middle;'>",
|
||||||
|
"@[钱币]": "<img src='/static/halo-common/OwO/paopao/钱币.png' alt='钱币.png' style='vertical-align: middle;'>",
|
||||||
|
"@[太开心]": "<img src='/static/halo-common/OwO/paopao/太开心.png' alt='太开心.png' style='vertical-align: middle;'>",
|
||||||
|
"@(抠鼻)": "<img src='/static/halo-common/OwO/alu/抠鼻.png' alt='抠鼻.png' style='vertical-align: middle;'>",
|
||||||
|
"@[你懂的]": "<img src='/static/halo-common/OwO/paopao/你懂的.png' alt='你懂的.png' style='vertical-align: middle;'>",
|
||||||
|
"@[吐舌]": "<img src='/static/halo-common/OwO/paopao/吐舌.png' alt='吐舌.png' style='vertical-align: middle;'>",
|
||||||
|
"@[茶杯]": "<img src='/static/halo-common/OwO/paopao/茶杯.png' alt='茶杯.png' style='vertical-align: middle;'>",
|
||||||
|
"@[泪]": "<img src='/static/halo-common/OwO/paopao/泪.png' alt='泪.png' style='vertical-align: middle;'>",
|
||||||
|
"@(吐)": "<img src='/static/halo-common/OwO/alu/吐.png' alt='吐.png' style='vertical-align: middle;'>",
|
||||||
|
"@(吐舌)": "<img src='/static/halo-common/OwO/alu/吐舌.png' alt='吐舌.png' style='vertical-align: middle;'>",
|
||||||
|
"@[太阳]": "<img src='/static/halo-common/OwO/paopao/太阳.png' alt='太阳.png' style='vertical-align: middle;'>",
|
||||||
|
"@(不出所料)": "<img src='/static/halo-common/OwO/alu/不出所料.png' alt='不出所料.png' style='vertical-align: middle;'>",
|
||||||
|
"@[挖鼻]": "<img src='/static/halo-common/OwO/paopao/挖鼻.png' alt='挖鼻.png' style='vertical-align: middle;'>",
|
||||||
|
"@(观察)": "<img src='/static/halo-common/OwO/alu/观察.png' alt='观察.png' style='vertical-align: middle;'>",
|
||||||
|
"@(内伤)": "<img src='/static/halo-common/OwO/alu/内伤.png' alt='内伤.png' style='vertical-align: middle;'>",
|
||||||
|
"@[灯泡]": "<img src='/static/halo-common/OwO/paopao/灯泡.png' alt='灯泡.png' style='vertical-align: middle;'>",
|
||||||
|
"@[呵呵]": "<img src='/static/halo-common/OwO/paopao/呵呵.png' alt='呵呵.png' style='vertical-align: middle;'>",
|
||||||
|
"@(尴尬)": "<img src='/static/halo-common/OwO/alu/尴尬.png' alt='尴尬.png' style='vertical-align: middle;'>",
|
||||||
|
"@(深思)": "<img src='/static/halo-common/OwO/alu/深思.png' alt='深思.png' style='vertical-align: middle;'>",
|
||||||
|
"@(小怒)": "<img src='/static/halo-common/OwO/alu/小怒.png' alt='小怒.png' style='vertical-align: middle;'>",
|
||||||
|
"@[狂汗]": "<img src='/static/halo-common/OwO/paopao/狂汗.png' alt='狂汗.png' style='vertical-align: middle;'>",
|
||||||
|
"@[what]": "<img src='/static/halo-common/OwO/paopao/what.png' alt='what.png' style='vertical-align: middle;'>",
|
||||||
|
"@(口水)": "<img src='/static/halo-common/OwO/alu/口水.png' alt='口水.png' style='vertical-align: middle;'>",
|
||||||
|
"@(大囧)": "<img src='/static/halo-common/OwO/alu/大囧.png' alt='大囧.png' style='vertical-align: middle;'>",
|
||||||
|
"@[懒得理]": "<img src='/static/halo-common/OwO/paopao/懒得理.png' alt='懒得理.png' style='vertical-align: middle;'>",
|
||||||
|
"@[真棒]": "<img src='/static/halo-common/OwO/paopao/真棒.png' alt='真棒.png' style='vertical-align: middle;'>",
|
||||||
|
"@[三道杠]": "<img src='/static/halo-common/OwO/paopao/三道杠.png' alt='三道杠.png' style='vertical-align: middle;'>",
|
||||||
|
"@[睡觉]": "<img src='/static/halo-common/OwO/paopao/睡觉.png' alt='睡觉.png' style='vertical-align: middle;'>",
|
||||||
|
"@[沙发]": "<img src='/static/halo-common/OwO/paopao/沙发.png' alt='沙发.png' style='vertical-align: middle;'>",
|
||||||
|
"@(暗地观察)": "<img src='/static/halo-common/OwO/alu/暗地观察.png' alt='暗地观察.png' style='vertical-align: middle;'>",
|
||||||
|
"@[笑尿]": "<img src='/static/halo-common/OwO/paopao/笑尿.png' alt='笑尿.png' style='vertical-align: middle;'>",
|
||||||
|
"@[生气]": "<img src='/static/halo-common/OwO/paopao/生气.png' alt='生气.png' style='vertical-align: middle;'>",
|
||||||
|
"@(肿包)": "<img src='/static/halo-common/OwO/alu/肿包.png' alt='肿包.png' style='vertical-align: middle;'>",
|
||||||
|
"@(狂汗)": "<img src='/static/halo-common/OwO/alu/狂汗.png' alt='狂汗.png' style='vertical-align: middle;'>",
|
||||||
|
"@(喷水)": "<img src='/static/halo-common/OwO/alu/喷水.png' alt='喷水.png' style='vertical-align: middle;'>",
|
||||||
|
"@(惊喜)": "<img src='/static/halo-common/OwO/alu/惊喜.png' alt='惊喜.png' style='vertical-align: middle;'>",
|
||||||
|
"@[便便]": "<img src='/static/halo-common/OwO/paopao/便便.png' alt='便便.png' style='vertical-align: middle;'>",
|
||||||
|
"@(阴暗)": "<img src='/static/halo-common/OwO/alu/阴暗.png' alt='阴暗.png' style='vertical-align: middle;'>",
|
||||||
|
"@[汗]": "<img src='/static/halo-common/OwO/paopao/汗.png' alt='汗.png' style='vertical-align: middle;'>",
|
||||||
|
"@(喜极而泣)": "<img src='/static/halo-common/OwO/alu/喜极而泣.png' alt='喜极而泣.png' style='vertical-align: middle;'>",
|
||||||
|
"@[香蕉]": "<img src='/static/halo-common/OwO/paopao/香蕉.png' alt='香蕉.png' style='vertical-align: middle;'>",
|
||||||
|
"@[大拇指]": "<img src='/static/halo-common/OwO/paopao/大拇指.png' alt='大拇指.png' style='vertical-align: middle;'>",
|
||||||
|
"@[蜡烛]": "<img src='/static/halo-common/OwO/paopao/蜡烛.png' alt='蜡烛.png' style='vertical-align: middle;'>",
|
||||||
|
"@(鼓掌)": "<img src='/static/halo-common/OwO/alu/鼓掌.png' alt='鼓掌.png' style='vertical-align: middle;'>",
|
||||||
|
"@(邪恶)": "<img src='/static/halo-common/OwO/alu/邪恶.png' alt='邪恶.png' style='vertical-align: middle;'>",
|
||||||
|
"@[惊恐]": "<img src='/static/halo-common/OwO/paopao/惊恐.png' alt='惊恐.png' style='vertical-align: middle;'>",
|
||||||
|
"@[惊哭]": "<img src='/static/halo-common/OwO/paopao/惊哭.png' alt='惊哭.png' style='vertical-align: middle;'>",
|
||||||
|
"@[嘚瑟]": "<img src='/static/halo-common/OwO/paopao/嘚瑟.png' alt='嘚瑟.png' style='vertical-align: middle;'>",
|
||||||
|
"@[药丸]": "<img src='/static/halo-common/OwO/paopao/药丸.png' alt='药丸.png' style='vertical-align: middle;'>",
|
||||||
|
"@[吐]": "<img src='/static/halo-common/OwO/paopao/吐.png' alt='吐.png' style='vertical-align: middle;'>",
|
||||||
|
"@[蛋糕]": "<img src='/static/halo-common/OwO/paopao/蛋糕.png' alt='蛋糕.png' style='vertical-align: middle;'>",
|
||||||
|
"@(愤怒)": "<img src='/static/halo-common/OwO/alu/愤怒.png' alt='愤怒.png' style='vertical-align: middle;'>",
|
||||||
|
"@(无所谓)": "<img src='/static/halo-common/OwO/alu/无所谓.png' alt='无所谓.png' style='vertical-align: middle;'>",
|
||||||
|
"@[啊]": "<img src='/static/halo-common/OwO/paopao/啊.png' alt='啊.png' style='vertical-align: middle;'>",
|
||||||
|
"@(坐等)": "<img src='/static/halo-common/OwO/alu/坐等.png' alt='坐等.png' style='vertical-align: middle;'>",
|
||||||
|
"@[nico]": "<img src='/static/halo-common/OwO/paopao/nico.png' alt='nico.png' style='vertical-align: middle;'>",
|
||||||
|
"@[弱]": "<img src='/static/halo-common/OwO/paopao/弱.png' alt='弱.png' style='vertical-align: middle;'>",
|
||||||
|
"@[小红脸]": "<img src='/static/halo-common/OwO/paopao/小红脸.png' alt='小红脸.png' style='vertical-align: middle;'>",
|
||||||
|
"@(哭泣)": "<img src='/static/halo-common/OwO/alu/哭泣.png' alt='哭泣.png' style='vertical-align: middle;'>",
|
||||||
|
"@[呼]": "<img src='/static/halo-common/OwO/paopao/呼.png' alt='呼.png' style='vertical-align: middle;'>",
|
||||||
|
"@[哈哈]": "<img src='/static/halo-common/OwO/paopao/哈哈.png' alt='哈哈.png' style='vertical-align: middle;'>",
|
||||||
|
"@[爱心]": "<img src='/static/halo-common/OwO/paopao/爱心.png' alt='爱心.png' style='vertical-align: middle;'>",
|
||||||
|
"@(不说话)": "<img src='/static/halo-common/OwO/alu/不说话.png' alt='不说话.png' style='vertical-align: middle;'>",
|
||||||
|
"@(脸红)": "<img src='/static/halo-common/OwO/alu/脸红.png' alt='脸红.png' style='vertical-align: middle;'>",
|
||||||
|
"@[惊讶]": "<img src='/static/halo-common/OwO/paopao/惊讶.png' alt='惊讶.png' style='vertical-align: middle;'>",
|
||||||
|
"@(傻笑)": "<img src='/static/halo-common/OwO/alu/傻笑.png' alt='傻笑.png' style='vertical-align: middle;'>",
|
||||||
|
"@(期待)": "<img src='/static/halo-common/OwO/alu/期待.png' alt='期待.png' style='vertical-align: middle;'>",
|
||||||
|
"@(击掌)": "<img src='/static/halo-common/OwO/alu/击掌.png' alt='击掌.png' style='vertical-align: middle;'>",
|
||||||
|
"@(抽烟)": "<img src='/static/halo-common/OwO/alu/抽烟.png' alt='抽烟.png' style='vertical-align: middle;'>",
|
||||||
|
"@[胜利]": "<img src='/static/halo-common/OwO/paopao/胜利.png' alt='胜利.png' style='vertical-align: middle;'>",
|
||||||
|
"@(害羞)": "<img src='/static/halo-common/OwO/alu/害羞.png' alt='害羞.png' style='vertical-align: middle;'>",
|
||||||
|
"@[吃翔]": "<img src='/static/halo-common/OwO/paopao/吃翔.png' alt='吃翔.png' style='vertical-align: middle;'>",
|
||||||
|
"@(便便)": "<img src='/static/halo-common/OwO/alu/便便.png' alt='便便.png' style='vertical-align: middle;'>",
|
||||||
|
"@(献黄瓜)": "<img src='/static/halo-common/OwO/alu/献黄瓜.png' alt='献黄瓜.png' style='vertical-align: middle;'>",
|
||||||
|
"@[不高兴]": "<img src='/static/halo-common/OwO/paopao/不高兴.png' alt='不高兴.png' style='vertical-align: middle;'>",
|
||||||
|
"@(皱眉)": "<img src='/static/halo-common/OwO/alu/皱眉.png' alt='皱眉.png' style='vertical-align: middle;'>",
|
||||||
|
"@(汗)": "<img src='/static/halo-common/OwO/alu/汗.png' alt='汗.png' style='vertical-align: middle;'>",
|
||||||
|
"@[吃瓜]": "<img src='/static/halo-common/OwO/paopao/吃瓜.png' alt='吃瓜.png' style='vertical-align: middle;'>",
|
||||||
|
"@[心碎]": "<img src='/static/halo-common/OwO/paopao/心碎.png' alt='心碎.png' style='vertical-align: middle;'>",
|
||||||
|
"@[玫瑰]": "<img src='/static/halo-common/OwO/paopao/玫瑰.png' alt='玫瑰.png' style='vertical-align: middle;'>",
|
||||||
|
"@(扇耳光)": "<img src='/static/halo-common/OwO/alu/扇耳光.png' alt='扇耳光.png' style='vertical-align: middle;'>",
|
||||||
|
"@[OK]": "<img src='/static/halo-common/OwO/paopao/OK.png' alt='OK.png' style='vertical-align: middle;'>",
|
||||||
|
"@[音乐]": "<img src='/static/halo-common/OwO/paopao/音乐.png' alt='音乐.png' style='vertical-align: middle;'>",
|
||||||
|
"@[阴险]": "<img src='/static/halo-common/OwO/paopao/阴险.png' alt='阴险.png' style='vertical-align: middle;'>",
|
||||||
|
"@(看热闹)": "<img src='/static/halo-common/OwO/alu/看热闹.png' alt='看热闹.png' style='vertical-align: middle;'>",
|
||||||
|
"@[星星月亮]": "<img src='/static/halo-common/OwO/paopao/星星月亮.png' alt='星星月亮.png' style='vertical-align: middle;'>",
|
||||||
|
"@[犀利]": "<img src='/static/halo-common/OwO/paopao/犀利.png' alt='犀利.png' style='vertical-align: middle;'>",
|
||||||
|
"@(高兴)": "<img src='/static/halo-common/OwO/alu/高兴.png' alt='高兴.png' style='vertical-align: middle;'>",
|
||||||
|
"@(亲亲)": "<img src='/static/halo-common/OwO/alu/亲亲.png' alt='亲亲.png' style='vertical-align: middle;'>",
|
||||||
|
"@[冷]": "<img src='/static/halo-common/OwO/paopao/冷.png' alt='冷.png' style='vertical-align: middle;'>",
|
||||||
|
"@[喷]": "<img src='/static/halo-common/OwO/paopao/喷.png' alt='喷.png' style='vertical-align: middle;'>",
|
||||||
|
"@(咽气)": "<img src='/static/halo-common/OwO/alu/咽气.png' alt='咽气.png' style='vertical-align: middle;'>",
|
||||||
|
"@[怒]": "<img src='/static/halo-common/OwO/paopao/怒.png' alt='怒.png' style='vertical-align: middle;'>",
|
||||||
|
"@(锁眉)": "<img src='/static/halo-common/OwO/alu/锁眉.png' alt='锁眉.png' style='vertical-align: middle;'>",
|
||||||
|
"@[红领巾]": "<img src='/static/halo-common/OwO/paopao/红领巾.png' alt='红领巾.png' style='vertical-align: middle;'>",
|
||||||
|
"@(中指)": "<img src='/static/halo-common/OwO/alu/中指.png' alt='中指.png' style='vertical-align: middle;'>",
|
||||||
|
"@[礼物]": "<img src='/static/halo-common/OwO/paopao/礼物.png' alt='礼物.png' style='vertical-align: middle;'>",
|
||||||
|
"@(赞一个)": "<img src='/static/halo-common/OwO/alu/赞一个.png' alt='赞一个.png' style='vertical-align: middle;'>",
|
||||||
|
"@(欢呼)": "<img src='/static/halo-common/OwO/alu/欢呼.png' alt='欢呼.png' style='vertical-align: middle;'>",
|
||||||
|
"@[花心]": "<img src='/static/halo-common/OwO/paopao/花心.png' alt='花心.png' style='vertical-align: middle;'>",
|
||||||
|
"@[鄙视]": "<img src='/static/halo-common/OwO/paopao/鄙视.png' alt='鄙视.png' style='vertical-align: middle;'>",
|
||||||
|
"@[呀咩爹]": "<img src='/static/halo-common/OwO/paopao/呀咩爹.png' alt='呀咩爹.png' style='vertical-align: middle;'>",
|
||||||
|
"@[开心]": "<img src='/static/halo-common/OwO/paopao/开心.png' alt='开心.png' style='vertical-align: middle;'>",
|
||||||
|
"@[酸爽]": "<img src='/static/halo-common/OwO/paopao/酸爽.png' alt='酸爽.png' style='vertical-align: middle;'>",
|
||||||
|
"@(得意)": "<img src='/static/halo-common/OwO/alu/得意.png' alt='得意.png' style='vertical-align: middle;'>",
|
||||||
|
"@(装大款)": "<img src='/static/halo-common/OwO/alu/装大款.png' alt='装大款.png' style='vertical-align: middle;'>",
|
||||||
|
"@[委屈]": "<img src='/static/halo-common/OwO/paopao/委屈.png' alt='委屈.png' style='vertical-align: middle;'>",
|
||||||
|
"@(中刀)": "<img src='/static/halo-common/OwO/alu/中刀.png' alt='中刀.png' style='vertical-align: middle;'>",
|
||||||
|
"@(看不见)": "<img src='/static/halo-common/OwO/alu/看不见.png' alt='看不见.png' style='vertical-align: middle;'>",
|
||||||
|
"@(小眼睛)": "<img src='/static/halo-common/OwO/alu/小眼睛.png' alt='小眼睛.png' style='vertical-align: middle;'>",
|
||||||
|
"@(无语)": "<img src='/static/halo-common/OwO/alu/无语.png' alt='无语.png' style='vertical-align: middle;'>",
|
||||||
|
"@(投降)": "<img src='/static/halo-common/OwO/alu/投降.png' alt='投降.png' style='vertical-align: middle;'>",
|
||||||
|
"@(无奈)": "<img src='/static/halo-common/OwO/alu/无奈.png' alt='无奈.png' style='vertical-align: middle;'>",
|
||||||
|
"@[咦]": "<img src='/static/halo-common/OwO/paopao/咦.png' alt='咦.png' style='vertical-align: middle;'>",
|
||||||
|
"@(不高兴)": "<img src='/static/halo-common/OwO/alu/不高兴.png' alt='不高兴.png' style='vertical-align: middle;'>",
|
||||||
|
"@[笑眼]": "<img src='/static/halo-common/OwO/paopao/笑眼.png' alt='笑眼.png' style='vertical-align: middle;'>",
|
||||||
|
"@(吐血倒地)": "<img src='/static/halo-common/OwO/alu/吐血倒地.png' alt='吐血倒地.png' style='vertical-align: middle;'>",
|
||||||
|
"@[疑问]": "<img src='/static/halo-common/OwO/paopao/疑问.png' alt='疑问.png' style='vertical-align: middle;'>"
|
||||||
|
}
|
Loading…
Reference in New Issue