mirror of https://github.com/halo-dev/halo
Add theme reloading api
parent
6fcf1a6952
commit
b3ca63b528
|
@ -135,4 +135,10 @@ public class ThemeController {
|
|||
public ThemeProperty fetchTheme(@RequestParam("uri") String 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;
|
|||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||
import run.halo.app.model.support.ThemeFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
@ -233,4 +232,9 @@ public interface ThemeService {
|
|||
*/
|
||||
@NonNull
|
||||
ThemeProperty fetch(@NonNull String uri);
|
||||
|
||||
/**
|
||||
* Reloads themes
|
||||
*/
|
||||
void reload();
|
||||
}
|
||||
|
|
|
@ -433,6 +433,11 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
eventPublisher.publishEvent(new ThemeUpdatedEvent(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones theme from git.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue