log upload commands fixed - upload to mclo.gs website

This commit is contained in:
Ronan committed 2026-11-13 21:34:44 +01:00
1 parent 97ee43e434
commit 04309fba14
7 files changed
+134 -108

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@
<properties><bettersync.version>2.0.0</bettersync.version><maven.compiler.release>8</maven.compiler.release><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>
<repositories><repository><id>spigot</id><url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url></repository><repository><id>jitpack.io</id><url>https://jitpack.io</url></repository></repositories>
<dependencies>
<dependency><groupId>org.jetbrains</groupId><artifactId>annotations</artifactId><version>24.0.1</version><scope>provided</scope></dependency>
<dependency><groupId>com.github.RonanPlugins</groupId><artifactId>BetterSync</artifactId><version>${bettersync.version}</version></dependency>
<dependency><groupId>org.spigotmc</groupId><artifactId>spigot-api</artifactId><version>1.8.8-R0.1-SNAPSHOT</version><exclusions><exclusion><groupId>net.md-5</groupId><artifactId>bungeecord-chat</artifactId></exclusion></exclusions></dependency>
<dependency><groupId>net.md-5</groupId><artifactId>bungeecord-chat</artifactId><version>1.16-R0.4</version></dependency>
@@ -12,7 +13,7 @@
<build>
<sourceDirectory>../../BetterRTP-Core/src/main/java</sourceDirectory>
<plugins>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.0</version><configuration><includes><include>**/web/editor/*.java</include></includes></configuration></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.0</version><configuration><includes><include>**/web/editor/*.java</include><include>**/web/LogUploader.java</include></includes></configuration></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>3.5.3</version></plugin>
</plugins>
</build>
@@ -0,0 +1,22 @@
package me.SuperRonanCraft.BetterRTP.references.web;
import org.junit.Test;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.nio.charset.StandardCharsets;
import static org.junit.Assert.*;
public class LogUploaderTest {
@Test public void encodesLogContentWithoutLosingFormatting() throws Exception {
String content = "Quotes: \"hello\"\nUnicode: \u00e9 \u2603\nPath: C:\\server\\logs";
JSONObject body = (JSONObject) new JSONParser().parse(new String(LogUploader.requestBody(content), StandardCharsets.UTF_8));
assertEquals(content, body.get("content"));
assertEquals("BetterRTP", body.get("source"));
}
@Test public void acceptsSuccessfulViewerLinksOnly() {
assertEquals("https://mclo.gs/abc123", LogUploader.viewingUrl("{\"success\":true,\"url\":\"https://mclo.gs/abc123\"}"));
for (String response : new String[] {"null", "[]", "not json", "{\"key\":\"legacy\"}", "{\"success\":false,\"url\":\"https://mclo.gs/abc\"}", "{\"success\":true,\"url\":\"https://evil.example/abc\"}", "{\"success\":true,\"url\":42}"}) {
assertNull(response, LogUploader.viewingUrl(response));
}
}
}