Upload files to "src/openonyx/connection"

This commit is contained in:
winterflyt committed 2026-11-30 05:46:04 +02:00
1 parent e17c348850
commit 9bd42a998e
4 files changed
+133

No files matched your search

@@ -0,0 +1,6 @@
package openonyx.connection;
import java.net.InetSocketAddress;
record ProxySettingsData(String host, int port, InetSocketAddress socket) {
}
@@ -0,0 +1,23 @@
package openonyx.connection;
import java.net.InetSocketAddress;
record ProxySettingsData2(
ProxySettingsMode protocol, boolean enabled, boolean useForAuth, String address, String username, String password, ProxySettingsData endpoint
) {
private static ProxySettingsData2 L() {
return new ProxySettingsData2(ProxySettingsMode.SOCKS5, false, false, "", "", "", null);
}
private InetSocketAddress L() {
return this.endpoint == null ? null : this.endpoint.socket();
}
private String d() {
return this.endpoint == null ? "" : this.endpoint.host();
}
private int L() {
return this.endpoint == null ? 0 : this.endpoint.port();
}
}
@@ -0,0 +1,41 @@
package openonyx.connection;
public enum ProxySettingsMode {
HTTP("http", "HTTP/HTTPS"),
SOCKS5("socks5", "SOCKS5");
private final String i;
private final String H;
private static ProxySettingsMode[] L() {
ProxySettingsMode[] proxySettingsModes = new ProxySettingsMode[2];
boolean bl = true;
proxySettingsModes[0] = SOCKS5;
proxySettingsModes[1] = HTTP;
return proxySettingsModes;
}
ProxySettingsMode(String string1, String string2) {
this.i = string1;
this.H = string2;
}
public String L() {
return this.H;
}
public static ProxySettingsMode L(String string) {
String string1 = string;
ProxySettingsMode[] proxySettingsModes;
int ix = (proxySettingsModes = values()).length;
for (int k = j = 0; k < ix; k = ++j) {
ProxySettingsMode proxySettingsMode;
if ((proxySettingsMode = proxySettingsModes[j]).i.equalsIgnoreCase(string1)) {
return proxySettingsMode;
}
}
return SOCKS5;
}
}
+63
View File
@@ -0,0 +1,63 @@
package openonyx.connection;
import com.google.gson.JsonObject;
import com.mojang.util.UUIDTypeAdapter;
import net.minecraft.util.Session;
import openonyx.connection.internal.AuthException;
import openonyx.connection.internal.XboxLiveAuth;
import openonyx.connection.internal.XboxLiveAuthData;
public class TokenAccount extends Account {
private String e;
@Override
protected void L(JsonObject jsonObject) {
this.e = L(jsonObject, "accessToken");
}
@Override
public Session L() throws AuthException {
if (this.e != null && !this.e.isBlank()) {
if (this.uuid == null) {
this.L();
}
return new Session(this.i, UUIDTypeAdapter.fromUUID(this.uuid), this.e, "mojang");
} else {
throw new AuthException("No access token stored for this account");
}
}
@Override
protected void d(JsonObject jsonObject) {
if (this.e != null) {
jsonObject.addProperty("accessToken", this.e);
}
}
public TokenAccount(String string) {
super(AccountType.ACCESS_TOKEN, string);
}
public static TokenAccount L(String string) throws AuthException {
String string1 = string;
XboxLiveAuthData xboxLiveAuthData = XboxLiveAuth.L(string1);
TokenAccount tokenAccount = new TokenAccount(xboxLiveAuthData.name());
tokenAccount.uuid = xboxLiveAuthData.uuid();
tokenAccount.e = string1.trim();
return tokenAccount;
}
@Override
public void L() throws AuthException {
TokenAccount tokenAccount1 = this;
XboxLiveAuthData xboxLiveAuthData;
tokenAccount1.i = (xboxLiveAuthData = XboxLiveAuth.L(tokenAccount1.e)).name();
tokenAccount1.uuid = xboxLiveAuthData.uuid();
}
@Override
public String d() {
return this.e;
}
}