mirror of https://github.com/halo-dev/halo
⬆️ 升级依赖
parent
2f1fba71a8
commit
38d5d727cc
2
pom.xml
2
pom.xml
|
@ -34,7 +34,7 @@
|
|||
<oh-my-email.version>0.0.4</oh-my-email.version>
|
||||
<lombok.version>1.18.4</lombok.version>
|
||||
<ehcache.version>3.6.3</ehcache.version>
|
||||
<hutool.version>4.4.2</hutool.version>
|
||||
<hutool.version>4.5.0</hutool.version>
|
||||
<upyun-java-sdk.version>4.0.1</upyun-java-sdk.version>
|
||||
<qiniu-java-sdk.version>7.2.18</qiniu-java-sdk.version>
|
||||
<thumbnailator.version>0.4.8</thumbnailator.version>
|
||||
|
|
|
@ -95,26 +95,6 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
|
|||
.addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/halo/backup/");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 跨域
|
||||
// *
|
||||
// * @param registry registry
|
||||
// */
|
||||
// @Override
|
||||
// public void addCorsMappings(CorsRegistry registry) {
|
||||
// registry.addMapping("/api/**")
|
||||
// .allowedHeaders("*")
|
||||
// .allowedOrigins("*")
|
||||
// .allowedMethods("GET", "POST")
|
||||
// .exposedHeaders("access-control-allow-headers",
|
||||
// "access-control-allow-methods",
|
||||
// "access-control-allow-origin",
|
||||
// "access-control-max-age",
|
||||
// "X-Frame-Options",
|
||||
// "token")
|
||||
// .allowCredentials(false).maxAge(3600);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Creates a CorsFilter.
|
||||
*
|
||||
|
|
|
@ -48,8 +48,6 @@ import static cc.ryanc.halo.model.dto.HaloConst.THEMES;
|
|||
@RequestMapping(value = "/admin/themes")
|
||||
public class ThemeController extends BaseController {
|
||||
|
||||
private static final String NOT_FOUND_GIT = "-bash: git: command not found";
|
||||
|
||||
@Autowired
|
||||
private OptionsService optionsService;
|
||||
|
||||
|
@ -121,7 +119,7 @@ public class ThemeController extends BaseController {
|
|||
if (!file.isEmpty()) {
|
||||
//获取项目根路径
|
||||
final File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
final File themePath = new File(basePath.getAbsolutePath(), new StringBuffer("templates/themes/").append(file.getOriginalFilename()).toString());
|
||||
final File themePath = new File(basePath.getAbsolutePath(), new StrBuilder("templates/themes/").append(file.getOriginalFilename()).toString());
|
||||
file.transferTo(themePath);
|
||||
log.info("Upload topic success, path is " + themePath.getAbsolutePath());
|
||||
logsService.save(LogsRecord.UPLOAD_THEME, file.getOriginalFilename(), request);
|
||||
|
@ -187,10 +185,7 @@ public class ThemeController extends BaseController {
|
|||
try {
|
||||
final File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
final File themePath = new File(basePath.getAbsolutePath(), "templates/themes");
|
||||
final String cmdResult = RuntimeUtil.execForStr("git clone " + remoteAddr + " " + themePath.getAbsolutePath() + "/" + themeName);
|
||||
if (NOT_FOUND_GIT.equals(cmdResult)) {
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.no-git"));
|
||||
}
|
||||
RuntimeUtil.execForStr("git clone " + remoteAddr + " " + themePath.getAbsolutePath() + "/" + themeName);
|
||||
THEMES.clear();
|
||||
THEMES = HaloUtils.getThemes();
|
||||
} catch (FileNotFoundException e) {
|
||||
|
@ -212,10 +207,7 @@ public class ThemeController extends BaseController {
|
|||
try {
|
||||
final File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
|
||||
final File themePath = new File(basePath.getAbsolutePath(), "templates/themes");
|
||||
final String cmdResult = RuntimeUtil.execForStr("cd " + themePath.getAbsolutePath() + "/" + themeName + " && git pull");
|
||||
if (NOT_FOUND_GIT.equals(cmdResult)) {
|
||||
return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.no-git"));
|
||||
}
|
||||
RuntimeUtil.execForStr("cd " + themePath.getAbsolutePath() + "/" + themeName,"git pull");
|
||||
THEMES.clear();
|
||||
THEMES = HaloUtils.getThemes();
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue