mirror of https://github.com/halo-dev/halo
fixed: swagger-ui address redirect to 404.
parent
381341a18b
commit
020fe50be9
|
@ -92,7 +92,7 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
|
|||
.addResourceLocations(workDir + "upload/");
|
||||
registry.addResourceHandler(haloProperties.getBackupUrlPrefix() + "/**")
|
||||
.addResourceLocations(workDir + "backup/", backupDir);
|
||||
registry.addResourceHandler(haloProperties.getAdminPath() + "/**")
|
||||
registry.addResourceHandler("/halo" + haloProperties.getAdminPath() + "/**")
|
||||
.addResourceLocations(workDir + HALO_ADMIN_RELATIVE_PATH)
|
||||
.addResourceLocations("classpath:/admin/");
|
||||
|
||||
|
|
|
@ -37,22 +37,21 @@ public class MainController {
|
|||
this.haloProperties = haloProperties;
|
||||
}
|
||||
|
||||
@GetMapping("/{permlink}")
|
||||
@GetMapping("/halo/{permlink}")
|
||||
@Deprecated
|
||||
public String admin(@PathVariable(name = "permlink") String permlink) {
|
||||
// ###WARNING!!! Here will lead to redirect to swagger-ui/index.html while accessing swagger-ui.html
|
||||
return "redirect:/" + permlink + "/index.html";
|
||||
return "redirect:/halo/" + permlink + "/index.html";
|
||||
}
|
||||
|
||||
@GetMapping("/halo/version")
|
||||
@ResponseBody
|
||||
public String version() {
|
||||
return HaloConst.HALO_VERSION;
|
||||
}
|
||||
|
||||
@GetMapping("/install")
|
||||
public String installation() {
|
||||
return "redirect:" + haloProperties.getAdminPath() + "/index.html#install";
|
||||
}
|
||||
|
||||
@GetMapping("/version")
|
||||
@ResponseBody
|
||||
public String version() {
|
||||
return HaloConst.HALO_VERSION;
|
||||
return "redirect:/halo" + haloProperties.getAdminPath() + "/index.html#install";
|
||||
}
|
||||
|
||||
@GetMapping("/avatar")
|
||||
|
|
|
@ -44,7 +44,6 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
|||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationStartedEvent event) {
|
||||
// save halo version to database
|
||||
this.printStartInfo();
|
||||
this.initThemes();
|
||||
}
|
||||
|
@ -53,7 +52,7 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
|||
String blogUrl = optionService.getBlogBaseUrl();
|
||||
|
||||
log.info("Halo started at {}", blogUrl);
|
||||
log.info("Halo admin started at {}{}", blogUrl, haloProperties.getAdminPath());
|
||||
log.info("Halo admin started at {}/halo{}", blogUrl, haloProperties.getAdminPath());
|
||||
if (!haloProperties.isDocDisabled()) {
|
||||
log.debug("Halo doc was enable at {}/swagger-ui.html", blogUrl);
|
||||
}
|
||||
|
@ -65,12 +64,6 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
|||
private void initThemes() {
|
||||
// Whether the blog has initialized
|
||||
Boolean isInstalled = optionService.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
|
||||
|
||||
/*if (haloProperties.isProductionEnv() && isInstalled) {
|
||||
// Skip
|
||||
return;
|
||||
}*/
|
||||
|
||||
try {
|
||||
String themeClassPath = ResourceUtils.CLASSPATH_URL_PREFIX + ThemeService.THEME_FOLDER;
|
||||
|
||||
|
@ -94,9 +87,9 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
|||
// Fix the problem that the project cannot start after moving to a new server
|
||||
if (!haloProperties.isProductionEnv() || Files.notExists(themePath) || !isInstalled) {
|
||||
FileUtils.copyFolder(source, themePath);
|
||||
log.info("Copied theme folder from [{}] to [{}]", source, themePath);
|
||||
log.debug("Copied theme folder from [{}] to [{}]", source, themePath);
|
||||
} else {
|
||||
log.info("Skipped copying theme folder due to existence of theme folder");
|
||||
log.debug("Skipped copying theme folder due to existence of theme folder");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Initialize internal theme to user path error", e);
|
||||
|
|
Loading…
Reference in New Issue