From 15bde8eef7224c5ebdba41fc091d1d4844f8cd9d Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Fri, 18 Feb 2022 14:08:36 +0800 Subject: [PATCH] Add APIs to fetch theme info and settings according to the theme id (#1660) --- .../app/controller/content/api/ThemeController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/run/halo/app/controller/content/api/ThemeController.java b/src/main/java/run/halo/app/controller/content/api/ThemeController.java index 927ab861b..8af4d2dc1 100644 --- a/src/main/java/run/halo/app/controller/content/api/ThemeController.java +++ b/src/main/java/run/halo/app/controller/content/api/ThemeController.java @@ -3,6 +3,7 @@ package run.halo.app.controller.content.api; import io.swagger.annotations.ApiOperation; import java.util.Map; 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.RestController; import run.halo.app.handler.theme.config.support.ThemeProperty; @@ -34,9 +35,21 @@ public class ThemeController { 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") @ApiOperation("Lists activated theme settings") public Map listSettingsBy() { return themeSettingService.listAsMapBy(themeService.getActivatedThemeId()); } + + @GetMapping("{themeId:.+}/settings") + @ApiOperation("Lists theme settings by theme id") + public Map listSettingsBy(@PathVariable("themeId") String themeId) { + return themeSettingService.listAsMapBy(themeId); + } }