forked from halo-dev/halo
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
93 changed files
with
5,804 additions
and
309 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
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
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
45 changes: 45 additions & 0 deletions
45
api/src/main/java/run/halo/app/theme/TemplateNameResolver.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,45 @@ | ||
package run.halo.app.theme; | ||
|
||
import org.springframework.web.server.ServerWebExchange; | ||
import reactor.core.publisher.Mono; | ||
|
||
/** | ||
* <p>The {@link TemplateNameResolver} is used to resolve template name.</p> | ||
* <code>Halo</code> has a theme mechanism, template files are provided by different themes, so | ||
* we need a method to determine whether the template file exists in the activated theme and if | ||
* it does not exist, provide a default template name. | ||
* | ||
* @author guqing | ||
* @since 2.11.0 | ||
*/ | ||
public interface TemplateNameResolver { | ||
|
||
/** | ||
* Resolve template name if exists or default template name in classpath. | ||
* | ||
* @param exchange exchange to resolve theme to use | ||
* @param name template | ||
* @return template name if exists or default template name in classpath | ||
*/ | ||
Mono<String> resolveTemplateNameOrDefault(ServerWebExchange exchange, String name); | ||
|
||
/** | ||
* Resolve template name if exists or default template given. | ||
* | ||
* @param exchange exchange to resolve theme to use | ||
* @param name template name | ||
* @param defaultName default template name to use if given template name not exists | ||
* @return template name if exists or default template name given | ||
*/ | ||
Mono<String> resolveTemplateNameOrDefault(ServerWebExchange exchange, String name, | ||
String defaultName); | ||
|
||
/** | ||
* Determine whether the template file exists in the current theme. | ||
* | ||
* @param exchange exchange to resolve theme to use | ||
* @param name template name | ||
* @return <code>true</code> if the template file exists in the current theme, false otherwise | ||
*/ | ||
Mono<Boolean> isTemplateAvailableInTheme(ServerWebExchange exchange, String name); | ||
} |
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
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,4 @@ | ||
package run.halo.app.content; | ||
|
||
public record Content(String raw, String content, String rawType) { | ||
} |
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
Oops, something went wrong.