diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-03-19 13:19:20 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-03-19 13:27:07 +0100 |
commit | 0dfcd14064a1eaf55acf057e4cc65ee2e4f5ef0a (patch) | |
tree | fe66da40015d00da72491d72ab864052bd686dbc /src/main | |
parent | a3661f16dd1c6ff8b1c5cce79f0ac948990c190c (diff) |
Update dependencies.
Change-Id: I94904259a5d8dd4b8011ae578632fb9cd646c93e
Diffstat (limited to 'src/main')
3 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java index 25955bd..11ac98a 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java @@ -1,5 +1,6 @@ package eu.mulk.mulkcms2.benki.posts; +import com.vladmihalcea.hibernate.type.search.PostgreSQLTSVectorType; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.annotation.CheckForNull; import javax.json.bind.annotation.JsonbTransient; @@ -15,11 +16,14 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; +import org.hibernate.annotations.Type; +import org.hibernate.annotations.TypeDef; @Entity @Table(name = "post_texts", schema = "benki") @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @IdClass(PostTextPK.class) +@TypeDef(name = "tsvector", typeClass = PostgreSQLTSVectorType.class) public abstract class PostText<OwningPost extends Post<?>> extends PanacheEntityBase { private static final int DESCRIPTION_CACHE_VERSION = 1; @@ -42,6 +46,7 @@ public abstract class PostText<OwningPost extends Post<?>> extends PanacheEntity @Column(name = "search_terms") @Generated(GenerationTime.ALWAYS) + @Type(type = "tsvector") public String searchTerms; @ManyToOne(fetch = FetchType.LAZY, targetEntity = Post.class) diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java index 1622334..edf9c72 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java @@ -32,7 +32,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; import org.jsoup.Jsoup; -import org.jsoup.safety.Whitelist; +import org.jsoup.safety.Safelist; @Path("/wiki") public class WikiResource { @@ -94,7 +94,7 @@ public class WikiResource { if (title != null) { // Remove markup. Reject whitespace. - title = Jsoup.clean(title, Whitelist.none()); + title = Jsoup.clean(title, Safelist.none()); if (!title.matches("\\w+")) { throw new BadRequestException("title does not match \"\\w+\""); } diff --git a/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java b/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java index cd75afe..0200514 100644 --- a/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java +++ b/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java @@ -12,7 +12,7 @@ import com.vladsch.flexmark.util.data.MutableDataSet; import java.util.Arrays; import javax.enterprise.context.ApplicationScoped; import org.jsoup.Jsoup; -import org.jsoup.safety.Whitelist; +import org.jsoup.safety.Safelist; @ApplicationScoped public class MarkdownConverter { @@ -44,6 +44,6 @@ public class MarkdownConverter { public String htmlify(String markdown) { var parsedDocument = parser.parse(markdown); var unsanitizedHtml = renderer.render(parsedDocument); - return Jsoup.clean(unsanitizedHtml, Whitelist.relaxed()); + return Jsoup.clean(unsanitizedHtml, Safelist.relaxed()); } } |