-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize default theme when Halo starts up for the first time (#2704)
#### What type of PR is this? /kind feature /area core /milestone 2.0 #### What this PR does / why we need it: 1. Initialize default theme when we detect the theme root has no themes here. This process won't stop Halo starting up if error occurs. 2. Refactor ThemeEndpoint with ThemeService to make it reusable. Default theme configuration is as following: ```yaml halo: theme: initializer: disabled: false location: classpath:themes/theme-earth.zip ``` #### Which issue(s) this PR fixes: Fixes #2700 #### Special notes for your reviewer: Steps to test: 1. Delete all themes at console if installed 2. Restart Halo and check the log 4. Check the theme root folder `~/halo-next/themes` 5. Try to access index page and you will see the default theme #### Does this PR introduce a user-facing change? ```release-note 在首次启动 Halo 时初始化默认主题 ```
- Loading branch information
Showing
22 changed files
with
654 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/run/halo/app/core/extension/theme/ThemeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package run.halo.app.core.extension.theme; | ||
|
||
import java.io.InputStream; | ||
import reactor.core.publisher.Mono; | ||
import run.halo.app.core.extension.Theme; | ||
|
||
public interface ThemeService { | ||
|
||
Mono<Theme> install(InputStream is); | ||
|
||
Mono<Theme> upgrade(String themeName, InputStream is); | ||
|
||
// TODO Migrate other useful methods in ThemeEndpoint in the future. | ||
|
||
} |
Oops, something went wrong.