From 0dfcd14064a1eaf55acf057e4cc65ee2e4f5ef0a Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 19 Mar 2022 13:19:20 +0100 Subject: Update dependencies. Change-Id: I94904259a5d8dd4b8011ae578632fb9cd646c93e --- src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java | 5 +++++ src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java | 4 ++-- .../java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main') 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> extends PanacheEntityBase { private static final int DESCRIPTION_CACHE_VERSION = 1; @@ -42,6 +46,7 @@ public abstract class PostText> 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()); } } -- cgit v1.2.3