Merge remote-tracking branch 'origin/v1' into v1

pull/146/head
ruibaby 2019-04-20 19:12:47 +08:00
commit ea761fa73f
3 changed files with 2 additions and 22 deletions

View File

@ -14,7 +14,7 @@ import run.halo.app.service.ThemeService;
import java.util.Map;
/**
* Theme activated listener.
* Freemarker config aware listener.
*
* @author johnniang
* @date 19-4-20

View File

@ -16,7 +16,7 @@ public class ThemeActivatedEvent extends ApplicationEvent {
private final ThemeProperty themeProperty;
/**
* Create a new ApplicationEvent.
* Creates a new ApplicationEvent.
*
* @param source the object on which the event initially occurred (never {@code null})
* @param themeProperty theme property must not be null

View File

@ -1,11 +1,9 @@
package run.halo.app.listener;
import com.fasterxml.jackson.databind.ObjectMapper;
import freemarker.template.TemplateModelException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ResourceUtils;
@ -36,12 +34,6 @@ import java.util.Map;
@Configuration
public class StartedListener implements ApplicationListener<ApplicationStartedEvent> {
@Autowired
private freemarker.template.Configuration configuration;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private HaloProperties haloProperties;
@ -61,7 +53,6 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
public void onApplicationEvent(ApplicationStartedEvent event) {
// save halo version to database
this.cacheOwo();
// this.cacheActiveTheme();
this.printStartInfo();
this.initThemes();
@ -92,17 +83,6 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
}
}
/**
* Get active theme
*/
private void cacheActiveTheme() {
try {
configuration.setSharedVariable("theme", themeService.getActivatedTheme());
} catch (TemplateModelException e) {
log.error("", e);
}
}
private void printStartInfo() {
String blogUrl = optionService.getBlogBaseUrl();