diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac53dcb..93a3f08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ stages: - test - package - release + - deploy # Disable the Gradle daemon for Continuous Integration servers as correctness # is usually a priority over speed in CI environments. Using a fresh @@ -58,7 +59,7 @@ package: - .gradle artifacts: paths: - - build/libs/*.jar + - build/libs/moviesquotebot.jar release: stage: release @@ -74,4 +75,13 @@ release-master: - docker build . -t $CONTAINER_RELEASE_IMAGE - docker push $CONTAINER_RELEASE_IMAGE only: - - master \ No newline at end of file + - master + +deploy: + stage: deploy + image: alpine + before_script: + - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + diff --git a/build.gradle b/build.gradle index 463ffe1..2fcde53 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,7 @@ dependencies { implementation 'com.github.wtekiela:opensub4j:0.3.0' implementation 'org.apache.commons:commons-lang3:3.11' implementation 'commons-cli:commons-cli:1.4' + implementation 'org.jsoup:jsoup:1.13.1' implementation 'org.apache.commons:commons-csv:1.8' implementation 'ch.qos.logback:logback-classic:1.2.3' implementation 'org.postgresql:postgresql:42.2.18.jre7' diff --git a/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java b/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java index 4400d4d..dd949be 100644 --- a/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java +++ b/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java @@ -11,7 +11,7 @@ public class MoviesQuoteBot { public static final String PREFIX = "!"; public static final String NAME = "Movies Quote Bot"; public static final String DESCRIPTION = "I may know some quotes from some movies."; - public static final String VERSION = "0.3.3-SNAPSHOT"; + public static final String VERSION = "0.3.4-SNAPSHOT"; private static final Logger logger = LoggerFactory.getLogger(MoviesQuoteBot.class.getCanonicalName()); public static void main(String[] args) { diff --git a/src/main/java/xyz/vallat/louis/commands/Quote.java b/src/main/java/xyz/vallat/louis/commands/Quote.java index 19edd62..1ebc2fa 100644 --- a/src/main/java/xyz/vallat/louis/commands/Quote.java +++ b/src/main/java/xyz/vallat/louis/commands/Quote.java @@ -3,6 +3,8 @@ package xyz.vallat.louis.commands; import discord4j.core.event.domain.message.MessageCreateEvent; import discord4j.rest.util.Color; import org.apache.commons.cli.*; +import org.jsoup.Jsoup; +import org.jsoup.safety.Whitelist; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; @@ -49,10 +51,11 @@ public class Quote extends Command { if (quote == null) embed.setDescription("We don't have any quote in that language right now! Sorry!").setColor(Color.ORANGE); else { - embed.setDescription(quote.getSubtitleBlock().getDialogue() - .replaceAll("|", "*") - .replaceAll("|", "**") - ); + embed.setDescription(Jsoup.clean(quote.getSubtitleBlock().getDialogue() + .replaceAll("|", "*") + .replaceAll("|", "**") + .replaceAll("|", "__"), + Whitelist.none())); embed.setFooter(quote.getMovie().toString(), null); embed.setColor(Color.MEDIUM_SEA_GREEN); }