diff --git a/build.gradle b/build.gradle index 2ceae27..b87c1a6 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - implementation platform('run.halo.tools.platform:plugin:2.5.0-SNAPSHOT') + implementation platform('run.halo.tools.platform:plugin:2.10.0-SNAPSHOT') compileOnly 'run.halo.app:api' testImplementation 'run.halo.app:api' @@ -42,4 +42,4 @@ build { halo { version = "2.12.0" -} \ No newline at end of file +} diff --git a/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java b/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java index 3fe5dbf..2c2e36b 100644 --- a/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java +++ b/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java @@ -1,7 +1,7 @@ package run.halo.search.widget; +import java.util.Properties; import lombok.RequiredArgsConstructor; -import org.pf4j.PluginWrapper; import org.springframework.stereotype.Component; import org.springframework.util.PropertyPlaceholderHelper; import org.thymeleaf.context.ITemplateContext; @@ -9,17 +9,16 @@ import org.thymeleaf.model.IModelFactory; import org.thymeleaf.processor.element.IElementModelStructureHandler; import reactor.core.publisher.Mono; +import run.halo.app.plugin.PluginContext; import run.halo.app.theme.dialect.TemplateHeadProcessor; -import java.util.Properties; - @Component @RequiredArgsConstructor public class SearchWidgetHeadProcessor implements TemplateHeadProcessor { static final PropertyPlaceholderHelper PROPERTY_PLACEHOLDER_HELPER = new PropertyPlaceholderHelper("${", "}"); - private final PluginWrapper pluginWrapper; + private final PluginContext pluginContext; @Override public Mono process(ITemplateContext context, IModel model, @@ -32,13 +31,13 @@ public Mono process(ITemplateContext context, IModel model, private String searchWidgetScript() { final Properties properties = new Properties(); - properties.setProperty("version", pluginWrapper.getDescriptor().getVersion()); + properties.setProperty("version", pluginContext.getVersion()); return PROPERTY_PLACEHOLDER_HELPER.replacePlaceholders(""" - - - - - """, properties); + + + + + """, properties); } } diff --git a/src/main/java/run/halo/search/widget/SearchWidgetPlugin.java b/src/main/java/run/halo/search/widget/SearchWidgetPlugin.java index ffa30b5..0c04625 100644 --- a/src/main/java/run/halo/search/widget/SearchWidgetPlugin.java +++ b/src/main/java/run/halo/search/widget/SearchWidgetPlugin.java @@ -1,8 +1,8 @@ package run.halo.search.widget; -import org.pf4j.PluginWrapper; import org.springframework.stereotype.Component; import run.halo.app.plugin.BasePlugin; +import run.halo.app.plugin.PluginContext; /** * @author ryanwang @@ -10,8 +10,8 @@ @Component public class SearchWidgetPlugin extends BasePlugin { - public SearchWidgetPlugin(PluginWrapper wrapper) { - super(wrapper); + public SearchWidgetPlugin(PluginContext pluginContext) { + super(pluginContext); } @Override diff --git a/src/main/resources/plugin.yaml b/src/main/resources/plugin.yaml index fb99968..61f24c0 100644 --- a/src/main/resources/plugin.yaml +++ b/src/main/resources/plugin.yaml @@ -8,7 +8,7 @@ metadata: "store.halo.run/app-id": "app-DlacW" spec: enabled: true - requires: ">=2.5.0" + requires: ">=2.10.0" author: name: Halo website: https://github.com/halo-dev