mirror of https://github.com/halo-dev/halo
Add additional static location
parent
8930f9d0d2
commit
80a6cf0999
|
@ -79,7 +79,8 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
String workDir = FILE_PROTOCOL + haloProperties.getWorkDir();
|
String workDir = FILE_PROTOCOL + haloProperties.getWorkDir();
|
||||||
registry.addResourceHandler("/static/**")
|
registry.addResourceHandler("/static/**")
|
||||||
.addResourceLocations("classpath:/static/");
|
.addResourceLocations("classpath:/static/")
|
||||||
|
.addResourceLocations(workDir + "static/");
|
||||||
registry.addResourceHandler("/**")
|
registry.addResourceHandler("/**")
|
||||||
.addResourceLocations(workDir + "templates/themes/")
|
.addResourceLocations(workDir + "templates/themes/")
|
||||||
.addResourceLocations(workDir + "templates/admin/")
|
.addResourceLocations(workDir + "templates/admin/")
|
||||||
|
|
|
@ -52,38 +52,8 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
||||||
// save halo version to database
|
// save halo version to database
|
||||||
this.printStartInfo();
|
this.printStartInfo();
|
||||||
this.initThemes();
|
this.initThemes();
|
||||||
|
|
||||||
// Init user in development environment
|
|
||||||
// if (!haloProperties.isProductionEnv()) {
|
|
||||||
// initAnTestUserIfAbsent();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Initialize an test user if absent
|
|
||||||
// */
|
|
||||||
// private void initAnTestUserIfAbsent() {
|
|
||||||
// // Create an user if absent
|
|
||||||
// List<User> users = userService.listAll();
|
|
||||||
//
|
|
||||||
// if (users.isEmpty()) {
|
|
||||||
// UserParam userParam = new UserParam();
|
|
||||||
// userParam.setUsername("test");
|
|
||||||
// userParam.setNickname("developer");
|
|
||||||
// userParam.setEmail("test@test.com");
|
|
||||||
// userParam.setPassword("opentest");
|
|
||||||
//
|
|
||||||
// log.debug("Initializing a test user: [{}]", userParam);
|
|
||||||
//
|
|
||||||
// // Validate the user param
|
|
||||||
// ValidationUtils.validate(userParam, CreateCheck.class);
|
|
||||||
//
|
|
||||||
// User testUser = userService.createBy(userParam);
|
|
||||||
//
|
|
||||||
// log.debug("Initialized a test user: [{}]", testUser);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void printStartInfo() {
|
private void printStartInfo() {
|
||||||
String blogUrl = optionService.getBlogBaseUrl();
|
String blogUrl = optionService.getBlogBaseUrl();
|
||||||
|
|
||||||
|
@ -102,7 +72,7 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
||||||
// Whether the blog has initialized
|
// Whether the blog has initialized
|
||||||
Boolean isInstalled = optionService.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
|
Boolean isInstalled = optionService.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
|
||||||
|
|
||||||
if (isInstalled) {
|
if (haloProperties.isProductionEnv() && isInstalled) {
|
||||||
// Skip
|
// Skip
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue