mirror of https://github.com/halo-dev/halo
Beautify some details
parent
b5fd862b65
commit
327aecae18
|
@ -1,5 +1,6 @@
|
|||
package cc.ryanc.halo.config.properties;
|
||||
|
||||
import cc.ryanc.halo.model.support.HaloConst;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
|
@ -12,8 +13,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
@ConfigurationProperties("halo")
|
||||
public class HaloProperties {
|
||||
|
||||
private final static String USER_HOME = System.getProperty("user.home");
|
||||
|
||||
/**
|
||||
* Doc api disabled. (Default is true)
|
||||
*/
|
||||
|
@ -32,5 +31,5 @@ public class HaloProperties {
|
|||
/**
|
||||
* Work directory.
|
||||
*/
|
||||
private String workDir = USER_HOME + "/halo/";
|
||||
private String workDir = HaloConst.USER_HOME + "/halo/";
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ import java.util.Map;
|
|||
*/
|
||||
public class HaloConst {
|
||||
|
||||
/**
|
||||
* User home directory.
|
||||
*/
|
||||
public final static String USER_HOME = System.getProperties().getProperty("user.home");
|
||||
|
||||
/**
|
||||
* Default theme name.
|
||||
|
|
|
@ -6,6 +6,8 @@ import lombok.ToString;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Theme file.
|
||||
*
|
||||
* @author RYAN0UP
|
||||
* @date 2019/04/02
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ import lombok.ToString;
|
|||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Archive vo.
|
||||
* Month archive vo.
|
||||
*
|
||||
* @author johnniang
|
||||
* @date 4/2/19
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Archive vo.
|
||||
* Year archive vo.
|
||||
*
|
||||
* @author johnniang
|
||||
* @date 4/2/19
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.ryanc.halo.service.impl;
|
||||
|
||||
import cc.ryanc.halo.config.properties.HaloProperties;
|
||||
import cc.ryanc.halo.model.support.HaloConst;
|
||||
import cc.ryanc.halo.model.support.Theme;
|
||||
import cc.ryanc.halo.model.support.ThemeFile;
|
||||
|
@ -22,6 +23,12 @@ import java.util.List;
|
|||
@Service
|
||||
public class ThemeServiceImpl implements ThemeService {
|
||||
|
||||
private final HaloProperties haloProperties;
|
||||
|
||||
public ThemeServiceImpl(HaloProperties haloProperties) {
|
||||
this.haloProperties = haloProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all themes
|
||||
*
|
||||
|
@ -158,7 +165,7 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
*/
|
||||
@Override
|
||||
public File getThemeBasePath() {
|
||||
return new File(System.getProperties().getProperty("user.home"), "halo/templates/themes");
|
||||
return new File(haloProperties.getWorkDir(), "templates/themes");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.UUID;
|
|||
@Slf4j
|
||||
public class HaloUtils {
|
||||
|
||||
|
||||
@NonNull
|
||||
public static String timeFormat(long totalSeconds) {
|
||||
if (totalSeconds <= 0) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ThemeController {
|
|||
*
|
||||
* @return List<ThemeFile>
|
||||
*/
|
||||
@GetMapping(value = "/files")
|
||||
@GetMapping("files")
|
||||
public List<ThemeFile> listFiles() {
|
||||
return themeService.listThemeFolderBy(BaseContentController.THEME);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public abstract class BaseContentController {
|
|||
/**
|
||||
* Default theme
|
||||
*/
|
||||
@Deprecated
|
||||
public static String THEME = DEFAULT_THEME_NAME;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue