Skip to content

Commit

Permalink
chore: rename variables and update schemeManager.unregister method
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiHaosen committed Jul 4, 2024
1 parent 1684320 commit 7d85ddb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/main/java/run/halo/injection/HtmlInjection.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Set;
import lombok.Data;
import lombok.EqualsAndHashCode;
import run.halo.app.extension.AbstractExtension;
Expand All @@ -13,8 +14,8 @@
@GVK(group = "theme.halo.run",
version = "v1alpha1",
kind = "HtmlInjection",
plural = "htmlInjections",
singular = "htmlInjection")
plural = "htmlinjections",
singular = "htmlinjection")
public class HtmlInjection extends AbstractExtension {

@Schema(requiredMode = REQUIRED)
Expand All @@ -28,17 +29,17 @@ public static class Spec {
@Schema(description = "The description of the code snippet", maxLength = 500)
private String description;

@Schema(description = "The content of the HTML", maxLength = 5000)
@Schema(description = "The content of the HTML")
private String fragment;

@Schema(description = "where to inject", allowableValues = {"HEADER", "FOOTER"})
private InjectionPoint injectionPoint;

@Schema(description = "The pages where the code snippet should be injected")
private String[] targetPages;
private Set<String> pageRules;

@Schema(description = "Whether the code snippet is enabled")
private boolean isEnabled;
@Schema(description = "Whether the code snippet is enabled", defaultValue = "false")
private boolean enabled;
}

public enum InjectionPoint {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/run/halo/injection/InjectionPlugin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package run.halo.injection;

import org.springframework.stereotype.Component;
import run.halo.app.extension.Scheme;
import run.halo.app.extension.SchemeManager;
import run.halo.app.plugin.BasePlugin;
import run.halo.app.plugin.PluginContext;
Expand All @@ -22,7 +23,7 @@ public void start() {

@Override
public void stop() {
schemeManager.unregister(schemeManager.get(HtmlInjection.class));
schemeManager.unregister(Scheme.buildFromType(HtmlInjection.class));
}
}

0 comments on commit 7d85ddb

Please sign in to comment.