diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8b335103a5..7f0783c0a6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,7 @@ }, "features": { "ghcr.io/devcontainers/features/java:1": { - "version": "24-tem", + "version": "25-tem", "jdkDistro": "tem", "installGradle": true }, diff --git a/.github/workflows/basic-checks.yaml b/.github/workflows/basic-checks.yaml index 2619863c74..29194fb84d 100644 --- a/.github/workflows/basic-checks.yaml +++ b/.github/workflows/basic-checks.yaml @@ -3,7 +3,7 @@ name: Basic checks on: [pull_request] env: - JAVA_VERSION: 24 + JAVA_VERSION: 25 jobs: spotless: diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 9ee9c064f8..31c8a77507 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -8,7 +8,7 @@ on: - cron: '0 20 * * 4' env: - JAVA_VERSION: 24 + JAVA_VERSION: 25 jobs: sonar: diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index edd933f799..b78064ff15 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -7,7 +7,7 @@ on: - 'master' env: - JAVA_VERSION: 24 + JAVA_VERSION: 25 jobs: docker: diff --git a/.github/workflows/docker-verify.yaml b/.github/workflows/docker-verify.yaml index 560c6f61d9..36faa729c9 100644 --- a/.github/workflows/docker-verify.yaml +++ b/.github/workflows/docker-verify.yaml @@ -3,7 +3,7 @@ name: Docker Verify on: [pull_request] env: - JAVA_VERSION: 24 + JAVA_VERSION: 25 jobs: docker: diff --git a/.github/workflows/releases.yaml b/.github/workflows/releases.yaml index fbd106930b..0e78daba85 100644 --- a/.github/workflows/releases.yaml +++ b/.github/workflows/releases.yaml @@ -10,7 +10,7 @@ defaults: shell: bash env: - JAVA_VERSION: 24 + JAVA_VERSION: 25 jobs: diff --git a/.vscode/settings.json b/.vscode/settings.json index 5f19eba23c..9b6fe2e916 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { - //Configure the JDK to Java 18 in settings + //Configure the JDK to Java 25 in settings "java.compile.nullAnalysis.mode": "disabled", "java.format.settings.url": "meta/formatting/google-style-eclipse.xml", "editor.formatOnSave": true, "editor.formatOnPaste": true, "java.format.enabled": true, -} \ No newline at end of file +} diff --git a/README.md b/README.md index 3c9c50cb40..b1e65d81e4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # TJ-Bot [![codefactor](https://img.shields.io/codefactor/grade/github/together-java/tj-bot)](https://www.codefactor.io/repository/github/together-java/tj-bot) -![Java](https://img.shields.io/badge/Java-24-ff696c) +![Java](https://img.shields.io/badge/Java-25-ff696c) [![license](https://img.shields.io/github/license/Together-Java/TJ-Bot)](https://github.com/Together-Java/TJ-Bot/blob/master/LICENSE) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/Together-Java/TJ-Bot?label=release) diff --git a/application/build.gradle b/application/build.gradle index e03e8adb22..f701c01246 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -1,13 +1,13 @@ buildscript { dependencies { - classpath 'org.xerial:sqlite-jdbc:3.50.1.0' + classpath 'org.xerial:sqlite-jdbc:3.51.0.0' } } plugins { id 'application' - id 'com.google.cloud.tools.jib' version '3.4.5' - id 'com.github.johnrengelman.shadow' version '8.1.1' + id 'com.google.cloud.tools.jib' version '3.5.0' + id 'com.gradleup.shadow' version '9.2.2' id 'database-settings' } @@ -18,7 +18,7 @@ repositories { var outputImage = 'togetherjava.org:5001/togetherjava/tjbot:' + System.getenv('BRANCH_NAME') ?: 'latest' jib { - from.image = 'eclipse-temurin:24' + from.image = 'eclipse-temurin:25' to { image = outputImage auth { @@ -78,9 +78,9 @@ dependencies { implementation 'org.kohsuke:github-api:1.329' implementation 'org.apache.commons:commons-text:1.14.0' - implementation 'com.apptasticsoftware:rssreader:3.10.0' + implementation 'com.apptasticsoftware:rssreader:3.11.0' - testImplementation 'org.mockito:mockito-core:5.19.0' + testImplementation 'org.mockito:mockito-core:5.20.0' testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion" testRuntimeOnly 'org.junit.platform:junit-platform-launcher' diff --git a/application/config.json.template b/application/config.json.template index 7225704286..5cfe9ac38e 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -40,9 +40,10 @@ "whatsapp", "crypto", "^claim", - "teen", + "^teen$", "adobe", - "hack", + "^hack$", + "hacks", "steamcommunity", "freenitro", "^earn$", @@ -62,7 +63,10 @@ "youtube.com", "www.youtube.com", "cdn.discordapp.com", - "media.discordapp.net" + "media.discordapp.net", + "store.steampowered.com", + "help.steampowered.com", + "learn.microsoft.com" ], "hostBlacklist": [ "bit.ly", diff --git a/application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java b/application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java index 69e59f9358..9751397137 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java @@ -100,6 +100,10 @@ public void onMessageContext(MessageContextInteractionEvent event) { .formatted(originalMessage); Optional chatGptTitle = chatGptService.ask(chatGptTitleRequest, null); String title = chatGptTitle.orElse(createTitle(originalMessage)); + if (title.startsWith("\"") && title.endsWith("\"")) { + title = title.substring(1, title.length() - 1); + } + if (title.length() > TITLE_MAX_LENGTH) { title = title.substring(0, TITLE_MAX_LENGTH); } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/TokenAnalyse.java b/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/TokenAnalyse.java index 01ea2fff2f..926e74f356 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/TokenAnalyse.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/TokenAnalyse.java @@ -5,6 +5,8 @@ import java.net.URI; import java.util.Locale; +import java.util.function.Predicate; +import java.util.regex.Pattern; /** * Analyzes a given text token. Populates various metrics regarding the token possibly being @@ -14,6 +16,10 @@ * {@link #analyze(String, AnalyseResults)}. */ final class TokenAnalyse { + // Tokens like: "org.schema.game.common.data.world.Sector.access$200(Sector.java:120)" + private static final Predicate IS_STACKTRACE_TOKEN = + Pattern.compile("(org|com|de|dev)(\\.[^.()]+){4,15}\\([^.()]+\\.java:\\d+\\)") + .asMatchPredicate(); private final ScamBlockerConfig config; TokenAnalyse(ScamBlockerConfig config) { @@ -27,7 +33,7 @@ final class TokenAnalyse { * @param results metrics representing how suspicious the token is */ void analyze(String token, AnalyseResults results) { - if (token.isBlank()) { + if (token.isBlank() || IS_STACKTRACE_TOKEN.test(token)) { return; } diff --git a/application/src/test/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetectorTest.java b/application/src/test/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetectorTest.java index 52c9b3dffe..e4fda78ec2 100644 --- a/application/src/test/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetectorTest.java +++ b/application/src/test/java/org/togetherjava/tjbot/features/moderation/scam/ScamDetectorTest.java @@ -36,12 +36,13 @@ void setUp() { when(scamConfig.getSuspiciousKeywords()).thenReturn(Set.of("nitro", "boob", "sexy", "sexi", "esex", "steam", "gift", "onlyfans", "bitcoin", "btc", "promo", "trader", "trading", - "whatsapp", "crypto", "^claim", "teen", "adobe", "hack", "steamcommunity", - "freenitro", "^earn$", "^earning", ".exe$", "mrbeast")); - when(scamConfig.getHostWhitelist()).thenReturn(Set.of("discord.com", "discord.media", - "discordapp.com", "discordapp.net", "discordstatus.com", "thehackernews.com", - "gradle.org", "help.gradle.org", "youtube.com", "www.youtube.com", - "cdn.discordapp.com", "media.discordapp.net")); + "whatsapp", "crypto", "^claim", "teen", "adobe", "^hack$", "hacks", + "steamcommunity", "freenitro", "^earn$", "^earning", ".exe$", "mrbeast")); + when(scamConfig.getHostWhitelist()) + .thenReturn(Set.of("discord.com", "discord.media", "discordapp.com", "discordapp.net", + "discordstatus.com", "thehackernews.com", "gradle.org", "help.gradle.org", + "youtube.com", "www.youtube.com", "cdn.discordapp.com", "media.discordapp.net", + "store.steampowered.com", "help.steampowered.com", "learn.microsoft.com")); when(scamConfig.getHostBlacklist()).thenReturn(Set.of("bit.ly", "discord.gg", "teletype.in", "t.me", "corematrix.us", "u.to", "steamcommunity.com", "goo.su", "telegra.ph", "shorturl.at", "cheatings.xyz", "transfer.sh", "tobimoller.space")); @@ -428,7 +429,25 @@ B2CWorkflow Builder (React Flow) https://cdn.discordapp.com/attachments/1234/5678/1.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa& https://cdn.discordapp.com/attachments/1234/5678/2.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa& https://cdn.discordapp.com/attachments/1234/5678/3.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa& - https://cdn.discordapp.com/attachments/1234/5678/4.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&"""); + https://cdn.discordapp.com/attachments/1234/5678/4.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&""", + """ + I’ll help the first 10 interested people learn how to start earning over $100,000 within a week. + You only send me 10% of your profits after you receive them. + No pressure. No gimmicks. Just results. + Send a friend request or DM me (HOW) on Telegram: + @Joinna_Dwayno + (Or use the link in my bio.) + If you’re not serious, don’t message.""", + """ + I'll help the first 10 people interested on how to start earning $100k or more within a week, but you will reimburse me 15% of your profits when you receive it. + Note: only interested people should send a friend request or send me a dm! ask me (HOW) via Telegram + @laula_david2 + Or Click /use the the telegram link on my bio""", + """ + I’m looking for a couple of reliable people (🇺🇸) to help with simple recurring tasks. It’s only 1–2 hours of work per week, fully flexible on your schedule, + and pays $150+ per month, with the potential to increase to $300+ later. If you’re interested in easy side income with minimal time commitment, + send me a message💬 and I’ll share more details. + WhatsApp: +12534267893"""); } private static List provideRealFalsePositiveMessages() { @@ -516,6 +535,30 @@ public static void main(String[] args){ It was pretty pricey, and the costs likely differ a lot from country to country (keeping in mind that a portion is importing of equipment to NZ and some is labour in a very different market). We have 13.5KW of storage, a 10KW inverter, 11.5KW of generation and an EV charger. - All up, on a 1% 'green loan', it was $40k NZD (~$23k USD)"""); + All up, on a 1% 'green loan', it was $40k NZD (~$23k USD)""", + "https://store.steampowered.com/app/3176060/Emissary_Zero/", + "https://store.steampowered.com/app/3028330/Battlefield_REDSEC/", + "https://help.steampowered.com/en/faqs/view/49A1-B944-48B8-FF00", + "https://store.steampowered.com/api/appdetails?appids=8930 this endpoint is so cool", + "id play it if it was free maybe https://store.steampowered.com/app/1349230/5DChessWithMultiverseTime_Travel/", + "Why wouldn't they just take the $150 and not bother hacking an account to get the petfood sent?", + """ + https://learn.microsoft.com/en-us/powershell/scripting/discover-powershell?view=powershell-7.5 + What makes PowerShell unique is that it accepts and returns .NET objects, rather than text. + because of that, but well it says that it returns .NET objects not that the commands are from .NET, + but well as i said i use cmd.exe because i do not know .NET nor powershell""", + """ + Exception in thread "ServerEntityWriterThread" + java.lang.NoSuchMethodError: org.schema.game.common.controller.rails.RailRelation.isLocked()Z + at org.schema.game.common.controller.rails.RailController.getDockedTag(RailController.java:2686) + at org.schema.game.common.controller.rails.RailController.getTag(RailController.java:2652) + at org.schema.game.common.controller.SegmentController.toTagStructure(SegmentController.java:2813) + at org.schema.game.common.data.EntityFileTools.write(EntityFileTools.java:57) + at org.schema.game.server.controller.GameServerController.writeEntity(GameServerController.java:2938) + at org.schema.game.common.data.world.Sector.writeSingle(Sector.java:2570) + at org.schema.game.common.data.world.Sector.writeEntity(Sector.java:2546) + at org.schema.game.common.data.world.Sector.access$200(Sector.java:120) + at org.schema.game.common.data.world.Sector$3.run(Sector.java:2665) + at org.schema.schine.network.server.ServerEntityWriterThread.run(ServerEntityWriterThread.java:74)"""); } } diff --git a/build.gradle b/build.gradle index 272e5fffec..f3562829ed 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' - id "com.diffplug.spotless" version "7.2.0" - id "org.sonarqube" version "6.3.1.5724" + id "com.diffplug.spotless" version "8.0.0" + id "org.sonarqube" version "7.0.1.6134" id "name.remal.sonarlint" version "6.0.0" } repositories { @@ -15,7 +15,7 @@ ext { jooqVersion = '3.20.5' jacksonVersion = '2.19.1' chatGPTVersion = '0.18.2' - junitVersion = '5.13.2' + junitVersion = '6.0.0' } // Skips sonarlint during the build, useful for testing purposes. @@ -35,7 +35,9 @@ sonarqube { tasks.register('installLocalGitHook', Copy) { from new File(rootProject.rootDir, 'scripts/pre-commit') into new File(rootProject.rootDir, '.git/hooks') - fileMode 0775 + filePermissions { + unix("rwxrwxr-x") + } } build.dependsOn installLocalGitHook @@ -59,7 +61,7 @@ subprojects { java { toolchain { // Nails the Java-Version of every Subproject - languageVersion = JavaLanguageVersion.of(24) + languageVersion = JavaLanguageVersion.of(25) } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 4324ee2457..f800175af0 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -7,6 +7,6 @@ repositories { } dependencies { - implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:10.6.0" - implementation 'nu.studer:gradle-jooq-plugin:9.0' + implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:11.17.0" + implementation 'nu.studer:gradle-jooq-plugin:10.1.1' } diff --git a/buildSrc/src/main/groovy/database-settings.gradle b/buildSrc/src/main/groovy/database-settings.gradle index 8d931179d6..1c8afbdbe9 100644 --- a/buildSrc/src/main/groovy/database-settings.gradle +++ b/buildSrc/src/main/groovy/database-settings.gradle @@ -72,7 +72,7 @@ var sqliteVersion = "3.36.0.3" dependencies { implementation "org.xerial:sqlite-jdbc:${sqliteVersion}" - implementation 'org.flywaydb:flyway-core:8.0.0' + implementation 'org.flywaydb:flyway-core:11.17.0' implementation "org.jooq:jooq:$jooqVersion" jooqGenerator "org.xerial:sqlite-jdbc:${sqliteVersion}" diff --git a/database/build.gradle b/database/build.gradle index 79a0587e5f..8b9f5fd380 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -2,12 +2,12 @@ plugins { id 'java' } -var sqliteVersion = "3.50.1.0" +var sqliteVersion = "3.51.0.0" dependencies { implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation "org.xerial:sqlite-jdbc:${sqliteVersion}" - implementation 'org.flywaydb:flyway-core:11.13.0' + implementation 'org.flywaydb:flyway-core:11.17.0' implementation "org.jooq:jooq:$jooqVersion" implementation project(':utils') diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55baa..f8e1ee3125 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff23a68d70..bad7c2462f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a9367..adff685a03 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac207..c4bdd3ab8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/wiki/Setup-project-locally.md b/wiki/Setup-project-locally.md index 8b69928eee..b62a6430df 100644 --- a/wiki/Setup-project-locally.md +++ b/wiki/Setup-project-locally.md @@ -6,7 +6,7 @@ Alternatively, you can also work directly in the cloud, for free, and get starte * [[Code in the cloud (codespaces)]] ## Prerequisites -* [Java 24](https://adoptium.net/temurin/releases?version=24) installed +* [Java 25](https://adoptium.net/temurin/releases?version=25) installed * your favorite Java IDE or text editor, e.g. [IntelliJ](https://www.jetbrains.com/idea/download/) or [Eclipse](https://www.eclipse.org/downloads/) * [`git`](https://git-scm.com/downloads) installed (or any GUI or IDE plugin) * [`gradle`](https://gradle.org/releases/) available (or any GUI or IDE plugin), you can either install it or use our provided wrapper