提交 b3ca63b5 编写于 作者: J johnniang

Add theme reloading api

上级 6fcf1a69
...@@ -135,4 +135,10 @@ public class ThemeController { ...@@ -135,4 +135,10 @@ public class ThemeController {
public ThemeProperty fetchTheme(@RequestParam("uri") String uri) { public ThemeProperty fetchTheme(@RequestParam("uri") String uri) {
return themeService.fetch(uri); return themeService.fetch(uri);
} }
@PostMapping("reload")
@ApiOperation("Reloads themes")
public void reload() {
themeService.reload();
}
} }
...@@ -6,7 +6,6 @@ import run.halo.app.handler.theme.config.support.Group; ...@@ -6,7 +6,6 @@ import run.halo.app.handler.theme.config.support.Group;
import run.halo.app.handler.theme.config.support.ThemeProperty; import run.halo.app.handler.theme.config.support.ThemeProperty;
import run.halo.app.model.support.ThemeFile; import run.halo.app.model.support.ThemeFile;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.List; import java.util.List;
...@@ -233,4 +232,9 @@ public interface ThemeService { ...@@ -233,4 +232,9 @@ public interface ThemeService {
*/ */
@NonNull @NonNull
ThemeProperty fetch(@NonNull String uri); ThemeProperty fetch(@NonNull String uri);
/**
* Reloads themes
*/
void reload();
} }
...@@ -433,6 +433,11 @@ public class ThemeServiceImpl implements ThemeService { ...@@ -433,6 +433,11 @@ public class ThemeServiceImpl implements ThemeService {
} }
} }
@Override
public void reload() {
eventPublisher.publishEvent(new ThemeUpdatedEvent(this));
}
/** /**
* Clones theme from git. * Clones theme from git.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册