diff options
author | Luck <git@lucko.me> | 2023-08-28 16:21:03 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2023-08-28 16:21:03 +0100 |
commit | fac7ec97a848835dacc860a596269be12ae86956 (patch) | |
tree | 0594925d3cd657b9154538ae3329e698bd1bd734 | |
parent | 3c0c141189a0af706dfab9d052a2fd47d1906b39 (diff) | |
download | spark-fac7ec97a848835dacc860a596269be12ae86956.tar.gz spark-fac7ec97a848835dacc860a596269be12ae86956.tar.bz2 spark-fac7ec97a848835dacc860a596269be12ae86956.zip |
Use a different websocket library
-rw-r--r-- | spark-bukkit/build.gradle | 1 | ||||
-rw-r--r-- | spark-bungeecord/build.gradle | 1 | ||||
-rw-r--r-- | spark-common/build.gradle | 5 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java | 5 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java | 4 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/ws/ViewerSocketConnection.java | 9 | ||||
-rw-r--r-- | spark-fabric/build.gradle | 1 | ||||
-rw-r--r-- | spark-forge/build.gradle | 1 | ||||
-rw-r--r-- | spark-minestom/build.gradle | 1 | ||||
-rw-r--r-- | spark-nukkit/build.gradle | 1 | ||||
-rw-r--r-- | spark-sponge7/build.gradle | 1 | ||||
-rw-r--r-- | spark-sponge8/build.gradle | 1 | ||||
-rw-r--r-- | spark-velocity/build.gradle | 1 | ||||
-rw-r--r-- | spark-velocity4/build.gradle | 1 | ||||
-rw-r--r-- | spark-waterdog/build.gradle | 1 |
15 files changed, 21 insertions, 13 deletions
diff --git a/spark-bukkit/build.gradle b/spark-bukkit/build.gradle index 87e9832..4734990 100644 --- a/spark-bukkit/build.gradle +++ b/spark-bukkit/build.gradle @@ -38,6 +38,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-bungeecord/build.gradle b/spark-bungeecord/build.gradle index 7ff44cd..5139b3f 100644 --- a/spark-bungeecord/build.gradle +++ b/spark-bungeecord/build.gradle @@ -28,6 +28,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-common/build.gradle b/spark-common/build.gradle index 1713168..d619262 100644 --- a/spark-common/build.gradle +++ b/spark-common/build.gradle @@ -20,7 +20,10 @@ dependencies { implementation 'org.ow2.asm:asm:9.1' implementation 'net.bytebuddy:byte-buddy-agent:1.11.0' implementation 'com.google.protobuf:protobuf-javalite:3.21.11' - implementation 'me.lucko:bytesocks-java-client:1.0-SNAPSHOT' + + implementation('me.lucko:bytesocks-java-client:1.0-20230828.145440-5') { + exclude(module: 'slf4j-api') + } api('net.kyori:adventure-api:4.12.0') { exclude(module: 'adventure-bom') diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index 84f435a..fc41b6f 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -22,9 +22,7 @@ package me.lucko.spark.common; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; - import me.lucko.bytesocks.client.BytesocksClient; -import me.lucko.bytesocks.client.BytesocksClientFactory; import me.lucko.spark.common.activitylog.ActivityLog; import me.lucko.spark.common.api.SparkApi; import me.lucko.spark.common.command.Arguments; @@ -57,7 +55,6 @@ import me.lucko.spark.common.util.BytebinClient; import me.lucko.spark.common.util.Configuration; import me.lucko.spark.common.util.TemporaryFiles; import me.lucko.spark.common.ws.TrustedKeyStore; - import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; @@ -128,7 +125,7 @@ public class SparkPlatform { String bytesocksHost = this.configuration.getString("bytesocksHost", "spark-usersockets.lucko.me"); this.bytebinClient = new BytebinClient(bytebinUrl, "spark-plugin"); - this.bytesocksClient = BytesocksClientFactory.newClient(bytesocksHost, "spark-plugin"); + this.bytesocksClient = BytesocksClient.create(bytesocksHost, "spark-plugin"); this.trustedKeyStore = new TrustedKeyStore(this.configuration); this.disableResponseBroadcast = this.configuration.getBoolean("disableResponseBroadcast", false); diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java index 27e790f..ad0557d 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java @@ -21,7 +21,6 @@ package me.lucko.spark.common.command.modules; import com.google.common.collect.Iterables; - import me.lucko.bytesocks.client.BytesocksClient; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.activitylog.Activity; @@ -46,7 +45,6 @@ import me.lucko.spark.common.util.MediaTypes; import me.lucko.spark.common.util.MethodDisambiguator; import me.lucko.spark.common.ws.ViewerSocket; import me.lucko.spark.proto.SparkSamplerProtos; - import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; @@ -339,7 +337,7 @@ public class SamplerModule implements CommandModule { private void profilerOpen(SparkPlatform platform, CommandSender sender, CommandResponseHandler resp, Arguments arguments) { BytesocksClient bytesocksClient = platform.getBytesocksClient(); if (bytesocksClient == null) { - resp.replyPrefixed(text("The live viewer is only supported on Java 11 or newer.", RED)); + resp.replyPrefixed(text("The live viewer is not supported.", RED)); return; } diff --git a/spark-common/src/main/java/me/lucko/spark/common/ws/ViewerSocketConnection.java b/spark-common/src/main/java/me/lucko/spark/common/ws/ViewerSocketConnection.java index 9079860..2173f53 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/ws/ViewerSocketConnection.java +++ b/spark-common/src/main/java/me/lucko/spark/common/ws/ViewerSocketConnection.java @@ -21,7 +21,6 @@ package me.lucko.spark.common.ws; import com.google.protobuf.ByteString; - import me.lucko.bytesocks.client.BytesocksClient; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.proto.SparkWebSocketProtos.PacketWrapper; @@ -87,7 +86,7 @@ public class ViewerSocketConnection implements BytesocksClient.Listener, AutoClo * @return the channel id */ public String getChannelId() { - return this.socket.getChannelId(); + return this.socket.channelId(); } /** @@ -100,7 +99,7 @@ public class ViewerSocketConnection implements BytesocksClient.Listener, AutoClo } @Override - public void onText(CharSequence data) { + public void onText(String data) { try { RawPacket packet = decodeRawPacket(data); handleRawPacket(packet); @@ -178,8 +177,8 @@ public class ViewerSocketConnection implements BytesocksClient.Listener, AutoClo * @param data the encoded data * @return the decoded packet */ - private RawPacket decodeRawPacket(CharSequence data) throws IOException { - byte[] buf = Base64.getDecoder().decode(data.toString()); + private RawPacket decodeRawPacket(String data) throws IOException { + byte[] buf = Base64.getDecoder().decode(data); return RawPacket.parseFrom(buf); } diff --git a/spark-fabric/build.gradle b/spark-fabric/build.gradle index f1dccb0..792f147 100644 --- a/spark-fabric/build.gradle +++ b/spark-fabric/build.gradle @@ -81,6 +81,7 @@ shadowJar { // relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-forge/build.gradle b/spark-forge/build.gradle index 1e2a3ca..76e5054 100644 --- a/spark-forge/build.gradle +++ b/spark-forge/build.gradle @@ -48,6 +48,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-minestom/build.gradle b/spark-minestom/build.gradle index 22175a0..1958709 100644 --- a/spark-minestom/build.gradle +++ b/spark-minestom/build.gradle @@ -36,6 +36,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-nukkit/build.gradle b/spark-nukkit/build.gradle index 19e6b42..453573d 100644 --- a/spark-nukkit/build.gradle +++ b/spark-nukkit/build.gradle @@ -32,6 +32,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-sponge7/build.gradle b/spark-sponge7/build.gradle index ac9e841..aae4ef4 100644 --- a/spark-sponge7/build.gradle +++ b/spark-sponge7/build.gradle @@ -29,6 +29,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-sponge8/build.gradle b/spark-sponge8/build.gradle index 486e05b..9cba862 100644 --- a/spark-sponge8/build.gradle +++ b/spark-sponge8/build.gradle @@ -34,6 +34,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-velocity/build.gradle b/spark-velocity/build.gradle index fd81f90..ab93a7c 100644 --- a/spark-velocity/build.gradle +++ b/spark-velocity/build.gradle @@ -32,6 +32,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-velocity4/build.gradle b/spark-velocity4/build.gradle index 8bbb28b..f242c1e 100644 --- a/spark-velocity4/build.gradle +++ b/spark-velocity4/build.gradle @@ -37,6 +37,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' diff --git a/spark-waterdog/build.gradle b/spark-waterdog/build.gradle index 9fb67b5..4563626 100644 --- a/spark-waterdog/build.gradle +++ b/spark-waterdog/build.gradle @@ -39,6 +39,7 @@ shadowJar { relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm' relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler' relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks' + relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws' exclude 'module-info.class' exclude 'META-INF/maven/**' |