Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit a327569

Browse files
committed
set mojang auth to only use http1.1
1 parent 4587902 commit a327569

File tree

21 files changed

+334
-273
lines changed

21 files changed

+334
-273
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/mixin/AbstractInventoryScreenMixin.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Copyright © 2024 moehreag <[email protected]> & Contributors
3+
*
4+
* This file is part of AxolotlClient.
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*
20+
* For more information, see the LICENSE file.
21+
*/
22+
123
package io.github.axolotlclient.mixin;
224

325
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/auth/AccountsScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ public void removed() {
120120
}
121121

122122
private void initMSAuth() {
123-
Auth.getInstance().getAuth().startDeviceAuth(() -> client.execute(this::refresh));
123+
Auth.getInstance().getAuth().startDeviceAuth().thenRun(() -> client.execute(this::refresh));
124124
}
125125

126126
private void refreshAccount() {
127127
refreshButton.active = false;
128128
AccountsListWidget.Entry entry = accountsListWidget.getSelected();
129129
if (entry != null) {
130-
entry.getAccount().refresh(Auth.getInstance().getAuth(), () -> client.execute(() -> {
130+
entry.getAccount().refresh(Auth.getInstance().getAuth()).thenRun(() -> client.execute(() -> {
131131
Auth.getInstance().save();
132132
refresh();
133133
}));

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public void init() {
6868
if (isContained(client.getSession().getUuid())) {
6969
current = getAccounts().stream().filter(account -> account.getUuid().equals(client.getSession().getUuid())).collect(Collectors.toList()).get(0);
7070
if (current.needsRefresh()) {
71-
current.refresh(auth, () -> {
72-
});
71+
current.refresh(auth);
7372
}
7473
} else {
7574
current = new Account(client.getSession().getUsername(), client.getSession().getUuid(), client.getSession().getAccessToken());
@@ -95,9 +94,7 @@ protected void login(Account account) {
9594
if (account.isExpired()) {
9695
Notifications.getInstance().addStatus(new TranslatableText("auth.notif.title"), new TranslatableText("auth.notif.refreshing", account.getName()));
9796
}
98-
account.refresh(auth, () -> {
99-
getAccounts().stream().filter(a -> account.getUuid().equals(a.getUuid())).findFirst().ifPresent(this::login);
100-
});
97+
account.refresh(auth).thenAccept(this::login);
10198
} else {
10299
try {
103100
API.getInstance().shutdown();
@@ -151,16 +148,14 @@ void showAccountsExpiredScreen(Account account) {
151148
client.execute(() -> client.openScreen(new ConfirmScreen((bl) -> {
152149
client.openScreen(current);
153150
if (bl) {
154-
auth.startDeviceAuth(() -> {
155-
});
151+
auth.startDeviceAuth();
156152
}
157153
}, new TranslatableText("auth"), new TranslatableText("auth.accountExpiredNotice", account.getName()))));
158154
}
159155

160156
@Override
161157
void displayDeviceCode(DeviceFlowData data) {
162-
Screen display = new DeviceCodeDisplayScreen(client.currentScreen, data);
163-
client.openScreen(display);
158+
client.execute(() -> client.openScreen(new DeviceCodeDisplayScreen(client.currentScreen, data)));
164159
}
165160

166161
public Identifier getSkinTexture(Account account) {

1.20/src/main/java/io/github/axolotlclient/modules/auth/AccountsScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ public void init() {
125125
}
126126

127127
private void initMSAuth() {
128-
Auth.getInstance().getAuth().startDeviceAuth(() -> client.execute(this::refresh));
128+
Auth.getInstance().getAuth().startDeviceAuth().thenRun(() -> client.execute(this::refresh));
129129
}
130130

131131
private void refreshAccount() {
132132
refreshButton.active = false;
133133
AccountsListWidget.Entry entry = accountsListWidget.getSelectedOrNull();
134134
if (entry != null) {
135-
entry.getAccount().refresh(Auth.getInstance().getAuth(), () -> client.execute(() -> {
135+
entry.getAccount().refresh(Auth.getInstance().getAuth()).thenRun(() -> client.execute(() -> {
136136
Auth.getInstance().save();
137137
refresh();
138138
}));

1.20/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ public void init() {
7171
current = getAccounts().stream().filter(account -> account.getUuid()
7272
.equals(UUIDTypeAdapter.fromUUID(client.getSession().getPlayerUuid()))).toList().get(0);
7373
if (current.needsRefresh()) {
74-
current.refresh(auth, () -> {
75-
});
74+
current.refresh(auth);
7675
}
7776
} else {
7877
current = new Account(client.getSession().getUsername(), UUIDTypeAdapter.fromUUID(client.getSession().getPlayerUuid()), client.getSession().getAccessToken());
@@ -98,9 +97,7 @@ protected void login(Account account) {
9897
if (account.isExpired()) {
9998
Notifications.getInstance().addStatus(Text.translatable("auth.notif.title"), Text.translatable("auth.notif.refreshing", account.getName()));
10099
}
101-
account.refresh(auth, () -> {
102-
getAccounts().stream().filter(a -> account.getUuid().equals(a.getUuid())).findFirst().ifPresent(this::login);
103-
});
100+
account.refresh(auth).thenAccept(this::login);
104101
} else {
105102
try {
106103
API.getInstance().shutdown();
@@ -138,16 +135,14 @@ void showAccountsExpiredScreen(Account account) {
138135
client.execute(() -> client.setScreen(new ConfirmScreen((bl) -> {
139136
client.setScreen(current);
140137
if (bl) {
141-
auth.startDeviceAuth(() -> {
142-
});
138+
auth.startDeviceAuth();
143139
}
144140
}, Text.translatable("auth"), Text.translatable("auth.accountExpiredNotice", account.getName()))));
145141
}
146142

147143
@Override
148144
void displayDeviceCode(DeviceFlowData data) {
149-
Screen display = new DeviceCodeDisplayScreen(client.currentScreen, data);
150-
client.setScreen(display);
145+
client.execute(() -> client.setScreen(new DeviceCodeDisplayScreen(client.currentScreen, data)));
151146
}
152147

153148
private void loadTexture(String uuid) {

1.20/src/main/java/io/github/axolotlclient/util/MinecraftVersion.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

1.21.4/src/main/java/io/github/axolotlclient/modules/auth/AccountsScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ public void init() {
116116
}
117117

118118
private void initMSAuth() {
119-
Auth.getInstance().getAuth().startDeviceAuth(() -> minecraft.execute(this::refresh));
119+
Auth.getInstance().getAuth().startDeviceAuth().thenRun(() -> minecraft.execute(this::refresh));
120120
}
121121

122122
private void refreshAccount() {
123123
refreshButton.active = false;
124124
AccountsListWidget.Entry entry = accountsListWidget.getSelected();
125125
if (entry != null) {
126-
entry.getAccount().refresh(Auth.getInstance().getAuth(), () -> minecraft.execute(() -> {
126+
entry.getAccount().refresh(Auth.getInstance().getAuth()).thenRun(() -> minecraft.execute(() -> {
127127
Auth.getInstance().save();
128128
refresh();
129129
}));

1.21.4/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public void init() {
7474
if (isContained(mc.getUser().getSessionId())) {
7575
current = getAccounts().stream().filter(account -> account.getUuid().equals(UndashedUuid.toString(mc.getUser().getProfileId()))).toList().getFirst();
7676
if (current.needsRefresh()) {
77-
current.refresh(auth, () -> {
78-
});
77+
current.refresh(auth);
7978
}
8079
} else {
8180
current = new Account(mc.getUser().getName(), UndashedUuid.toString(mc.getUser().getProfileId()), mc.getUser().getAccessToken());
@@ -101,9 +100,7 @@ protected void login(Account account) {
101100
if (account.isExpired()) {
102101
Notifications.getInstance().addStatus(Component.translatable("auth.notif.title"), Component.translatable("auth.notif.refreshing", account.getName()));
103102
}
104-
account.refresh(auth, () -> {
105-
getAccounts().stream().filter(a -> account.getUuid().equals(a.getUuid())).findFirst().ifPresent(this::login);
106-
});
103+
account.refresh(auth).thenAccept(this::login);
107104
} else {
108105
try {
109106
API.getInstance().shutdown();
@@ -146,16 +143,14 @@ void showAccountsExpiredScreen(Account account) {
146143
mc.execute(() -> mc.setScreen(new ConfirmScreen((bl) -> {
147144
mc.setScreen(current);
148145
if (bl) {
149-
auth.startDeviceAuth(() -> {
150-
});
146+
auth.startDeviceAuth();
151147
}
152148
}, Component.translatable("auth"), Component.translatable("auth.accountExpiredNotice", account.getName()))));
153149
}
154150

155151
@Override
156152
void displayDeviceCode(DeviceFlowData data) {
157-
Screen display = new DeviceCodeDisplayScreen(mc.screen, data);
158-
mc.setScreen(display);
153+
mc.execute(() -> mc.setScreen(new DeviceCodeDisplayScreen(mc.screen, data)));
159154
}
160155

161156
private void loadTexture(String uuid) {

1.21/src/main/java/io/github/axolotlclient/modules/auth/AccountsScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ public void init() {
120120
}
121121

122122
private void initMSAuth() {
123-
Auth.getInstance().getAuth().startDeviceAuth(() -> client.execute(this::refresh));
123+
Auth.getInstance().getAuth().startDeviceAuth().thenRun(() -> client.execute(this::refresh));
124124
}
125125

126126
private void refreshAccount() {
127127
refreshButton.active = false;
128128
AccountsListWidget.Entry entry = accountsListWidget.getSelectedOrNull();
129129
if (entry != null) {
130-
entry.getAccount().refresh(Auth.getInstance().getAuth(), () -> client.execute(() -> {
130+
entry.getAccount().refresh(Auth.getInstance().getAuth()).thenRun(() -> client.execute(() -> {
131131
Auth.getInstance().save();
132132
refresh();
133133
}));

1.21/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ public void init() {
7070
current = getAccounts().stream().filter(account -> account.getUuid()
7171
.equals(UndashedUuid.toString(client.getSession().getPlayerUuid()))).toList().getFirst();
7272
if (current.needsRefresh()) {
73-
current.refresh(auth, () -> {
74-
});
73+
current.refresh(auth);
7574
}
7675
} else {
7776
current = new Account(client.getSession().getUsername(), UndashedUuid.toString(client.getSession().getPlayerUuid()), client.getSession().getAccessToken());
@@ -97,9 +96,7 @@ protected void login(Account account) {
9796
if (account.isExpired()) {
9897
Notifications.getInstance().addStatus(Text.translatable("auth.notif.title"), Text.translatable("auth.notif.refreshing", account.getName()));
9998
}
100-
account.refresh(auth, () -> {
101-
getAccounts().stream().filter(a -> account.getUuid().equals(a.getUuid())).findFirst().ifPresent(this::login);
102-
});
99+
account.refresh(auth).thenAccept(this::login);
103100
} else {
104101
try {
105102
API.getInstance().shutdown();
@@ -138,16 +135,14 @@ void showAccountsExpiredScreen(Account account) {
138135
client.execute(() -> client.setScreen(new ConfirmScreen((bl) -> {
139136
client.setScreen(current);
140137
if (bl) {
141-
auth.startDeviceAuth(() -> {
142-
});
138+
auth.startDeviceAuth();
143139
}
144140
}, Text.translatable("auth"), Text.translatable("auth.accountExpiredNotice", account.getName()))));
145141
}
146142

147143
@Override
148144
void displayDeviceCode(DeviceFlowData data) {
149-
Screen display = new DeviceCodeDisplayScreen(client.currentScreen, data);
150-
client.setScreen(display);
145+
client.execute(() -> client.setScreen(new DeviceCodeDisplayScreen(client.currentScreen, data)));
151146
}
152147

153148
private void loadTexture(String uuid) {

0 commit comments

Comments
 (0)