mirror of https://github.com/halo-dev/halo
Add APIs to fetch theme info and settings according to the theme id (#1660)
parent
d961a5e8a5
commit
15bde8eef7
|
@ -3,6 +3,7 @@ package run.halo.app.controller.content.api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||||
|
@ -34,9 +35,21 @@ public class ThemeController {
|
||||||
return themeService.getThemeOfNonNullBy(themeService.getActivatedThemeId());
|
return themeService.getThemeOfNonNullBy(themeService.getActivatedThemeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("{themeId:.+}")
|
||||||
|
@ApiOperation("Gets theme property by theme id")
|
||||||
|
public ThemeProperty getBy(@PathVariable("themeId") String themeId) {
|
||||||
|
return themeService.getThemeOfNonNullBy(themeId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("activation/settings")
|
@GetMapping("activation/settings")
|
||||||
@ApiOperation("Lists activated theme settings")
|
@ApiOperation("Lists activated theme settings")
|
||||||
public Map<String, Object> listSettingsBy() {
|
public Map<String, Object> listSettingsBy() {
|
||||||
return themeSettingService.listAsMapBy(themeService.getActivatedThemeId());
|
return themeSettingService.listAsMapBy(themeService.getActivatedThemeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("{themeId:.+}/settings")
|
||||||
|
@ApiOperation("Lists theme settings by theme id")
|
||||||
|
public Map<String, Object> listSettingsBy(@PathVariable("themeId") String themeId) {
|
||||||
|
return themeSettingService.listAsMapBy(themeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue