2020-12-21 22:29:15 +00:00
|
|
|
package com.discord.utilities.websocket;
|
|
|
|
|
|
|
|
import com.PatchConfig;
|
|
|
|
import com.discordtest.BuildConfig;
|
|
|
|
|
|
|
|
import lanchon.dexpatcher.annotation.DexAdd;
|
|
|
|
import lanchon.dexpatcher.annotation.DexEdit;
|
|
|
|
|
|
|
|
@DexEdit
|
2021-01-01 21:23:37 +00:00
|
|
|
public final class WebSocket {
|
2020-12-21 22:29:15 +00:00
|
|
|
|
|
|
|
// TODO can be done with wrap
|
|
|
|
|
|
|
|
// Rename original method
|
|
|
|
@DexEdit(target = "connect")
|
|
|
|
public final void orig_connect(String str) {}
|
|
|
|
|
|
|
|
// Replace connect method, part of nozlib patch
|
|
|
|
@DexAdd
|
|
|
|
public final void connect(String str) {
|
|
|
|
if (!PatchConfig.NOZLIB_ENABLED) {
|
|
|
|
// Patch not enabled
|
|
|
|
orig_connect(str);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove compress options
|
|
|
|
if (str != null) {
|
|
|
|
str = str.replaceAll("&compress=zlib-stream", "");
|
|
|
|
}
|
|
|
|
// Call original method
|
|
|
|
orig_connect(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|