diff --git a/pom.xml b/pom.xml index c9b5c8231..edf9660db 100755 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 0.0.4 1.18.4 3.6.3 - 4.4.2 + 4.5.0 4.0.1 7.2.18 0.4.8 diff --git a/src/main/java/cc/ryanc/halo/config/WebMvcAutoConfiguration.java b/src/main/java/cc/ryanc/halo/config/WebMvcAutoConfiguration.java index 52c5f3b94..02980fc59 100644 --- a/src/main/java/cc/ryanc/halo/config/WebMvcAutoConfiguration.java +++ b/src/main/java/cc/ryanc/halo/config/WebMvcAutoConfiguration.java @@ -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. * diff --git a/src/main/java/cc/ryanc/halo/web/controller/admin/ThemeController.java b/src/main/java/cc/ryanc/halo/web/controller/admin/ThemeController.java index ee3b6faa7..4cf3264e8 100755 --- a/src/main/java/cc/ryanc/halo/web/controller/admin/ThemeController.java +++ b/src/main/java/cc/ryanc/halo/web/controller/admin/ThemeController.java @@ -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) {