summaryrefslogtreecommitdiff
path: root/src/main/java/eu
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostText.java5
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java4
-rw-r--r--src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java4
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());
}
}