Features, People, Features!

Dieser Commit ist enthalten in:
Chaoscaot 2022-09-25 16:03:41 +02:00
Ursprung e438a63085
Commit acd392b891
12 geänderte Dateien mit 80 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -42,9 +42,7 @@ processResources {
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
expand "minecraftVersion": project.minecraft_version
expand "loaderVersion": project.loader_version
expand "version": project.version, "minecraftVersion": project.minecraft_version, "loaderVersion": project.loader_version
}
}

Datei anzeigen

@ -1,3 +1,4 @@
# SPDX-License-Identifier: MIT
accessWidener v1 named
mutable field net/minecraft/server/MinecraftServer apiServices Lnet/minecraft/util/ApiServices;
accessible field net/minecraft/client/gui/screen/ConnectScreen connection Lnet/minecraft/network/ClientConnection;

Datei anzeigen

@ -1,10 +1,13 @@
{
"gui.altauth.confirm.title": "%s §rmöchte '%s' als AltAuth server nutzen",
"gui.altauth.confirm.text": "Willst du\n'%s'\nals Authentication Server vertrauen?\n\n§4§lACHTUNG: §rDieser Server ist nicht von Mojang und kann unsicher sein!\nJemand bösartiges kann mit den gesendeten Information sich in deinen Minecraft Account einloggen und ihn auf §4§lJEDEM§r Server benutzen!\n\nWenn du dir nicht sicher bist, klicke auf 'Abbrechen'.",
"gui.altauth.confirm.text": "Willst du\n'%s'\nals Authentication Server vertrauen?\n\n§4§lACHTUNG: §rJemand bösartiges kann mit den gesendeten Information sich als dich für bis zu Zwei Tage auf §4§lJEDEN§r Server ausgeben!\n\nWenn du dir nicht sicher bist, klicke auf 'Abbrechen'.",
"gui.altauth.confirm.force_mojang": "Mojang Authentifizierung erzwingen",
"gui.altauth.confirm.once": "Einmal vertrauen",
"gui.altauth.connecting": "Verbinden mit AltAuth '%s'...",
"gui.altauth.error": "AltAuth Fehler!",
"config.altauth.title": "AltAuth Client Config",
"config.altauth.general": "Allgemein",
"config.altauth.enabled": "AltAuth Benutzen",
"config.altauth.servers": "Vertraute AltAuth Server"
"config.altauth.servers": "Vertraute AltAuth Server",
"config.altauth.disabled": "Mojang Authentifizierung benutzen"
}

Datei anzeigen

@ -1,10 +1,13 @@
{
"gui.altauth.confirm.title": "%s wants to use '%s' as AltAuth Server",
"gui.altauth.confirm.text": "Do you want to trust\n'%s'\nas an Authentication server?\n\n§4§lWARNING: §rThe Authentication server is not provided by Mojang and can be unsafe!\nA Malicious actor can use the info send to this Server to login and use your Minecraft Account on §4§lANY§r server!\n\nMake sure that you trust this Server!",
"gui.altauth.confirm.text": "Do you want to trust\n'%s'\nas an Authentication server?\n\n§4§lWARNING: §rA Malicious actor can use the info send to this server to impersonate you on §4§lANY§r server for up to two days!\n\nMake sure that you trust this Server!",
"gui.altauth.confirm.force_mojang": "Use Mojang Authentication",
"gui.altauth.confirm.once": "Trust Once",
"gui.altauth.connecting": "Connecting with AltAuth '%s'...",
"gui.altauth.error": "AltAuth error",
"config.altauth.title": "AltAuth Client Config",
"config.altauth.general": "General",
"config.altauth.enabled": "AltAuth Enabled",
"config.altauth.servers": "Trusted AltAuth Servers"
"config.altauth.servers": "Trusted AltAuth Servers",
"config.altauth.disabled": "Forced Mojang Authentication"
}

Datei anzeigen

@ -16,4 +16,6 @@ public class AltAuth {
public static final Logger LOGGER = LogManager.getLogger();
public static ServerAddress address;
public static boolean trustOnce = false;
}

Datei anzeigen

@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import de.chaoscaot.altauth.fabric.config.ClientConfig;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
public class TrustServerScreen extends ConfirmScreen {
private static final Text FORCE_MOJANG = Text.translatable("gui.altauth.confirm.force_mojang");
private static final Text TRUST_ONCE = Text.translatable("gui.altauth.confirm.once");
private final String server;
private final Screen parent;
public TrustServerScreen(String server, Screen parent) {
super(t -> {}, Text.translatable("gui.altauth.confirm.title", AltAuth.address.getAddress(), server), Text.translatable("gui.altauth.confirm.text", server), ScreenTexts.YES, ScreenTexts.CANCEL);
this.server = server;
this.parent = parent;
}
@Override
protected void addButtons(int y) {
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, y, 150, 20, this.yesText, (button) -> {
ClientConfig.INSTANCE.allowedServers.add(server);
ClientConfig.INSTANCE.save();
ConnectScreen.connect(parent, client, AltAuth.address, null);
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, y, 150, 20, FORCE_MOJANG, (button) -> {
ClientConfig.INSTANCE.forcedMojang.add(AltAuth.address.getAddress());
ClientConfig.INSTANCE.save();
ConnectScreen.connect(parent, client, AltAuth.address, null);
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, y + 25, 150, 20, TRUST_ONCE, (button) -> {
AltAuth.trustOnce = true;
ConnectScreen.connect(parent, client, AltAuth.address, null);
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, y + 25, 150, 20, this.noText, (button) -> {
client.setScreen(parent);
}));
}
}

Datei anzeigen

@ -38,6 +38,7 @@ public class ClientConfig {
public boolean enabled = true;
public List<String> allowedServers = new ArrayList<>();
public List<String> forcedMojang = new ArrayList<>();
public void save() {
try {

Datei anzeigen

@ -9,7 +9,6 @@ import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
import java.util.ArrayList;
@ -36,6 +35,11 @@ public class ModMenuIntegration implements ModMenuApi {
.setDefaultValue(new ArrayList<>())
.setSaveConsumer(list -> ClientConfig.INSTANCE.allowedServers = list)
.build());
general.addEntry(entryBuilder.startStrList(Text.translatable("config.altauth.disabled"), ClientConfig.INSTANCE.forcedMojang)
.setDefaultValue(new ArrayList<>())
.setSaveConsumer(list -> ClientConfig.INSTANCE.forcedMojang = list)
.build());
return builder.build();
};
}

Datei anzeigen

@ -26,11 +26,11 @@ public class ServerConfig {
try {
INSTANCE = AltAuth.GSON.fromJson(Files.readString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME)), ServerConfig.class);
if(INSTANCE.serverUrl.length() > 20) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: ServerUrl is too long. Max length is 20 characters");
AltAuth.LOGGER.error("AltauthServer: ServerUrl is too long. Max length is 20 characters");
INSTANCE.serverUrl = "";
}
} catch (IOException e) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while loading config", e);
AltAuth.LOGGER.error("AltauthServer: Error while loading config", e);
AltAuth.LOGGER.info("Reset Config...");
INSTANCE = new ServerConfig();
INSTANCE.save();
@ -47,7 +47,7 @@ public class ServerConfig {
try {
Files.writeString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME), AltAuth.GSON.toJson(this));
} catch (IOException e) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while saving config", e);
AltAuth.LOGGER.error("AltauthServer: Error while saving config", e);
}
}
}

Datei anzeigen

@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric.mixin;
import de.chaoscaot.altauth.fabric.AltAuth;

Datei anzeigen

@ -4,6 +4,7 @@ package de.chaoscaot.altauth.fabric.mixin;
import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
import de.chaoscaot.altauth.fabric.AltAuth;
import de.chaoscaot.altauth.fabric.TrustServerScreen;
import de.chaoscaot.altauth.fabric.config.ClientConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -37,9 +38,10 @@ public class LoginRequestMixin {
public void onHello(LoginHelloS2CPacket packet, CallbackInfo ci) {
String server = packet.getServerId();
try {
if(packet.getServerId().contains(".")) {
if(server.contains(".") && !ClientConfig.INSTANCE.forcedMojang.contains(AltAuth.address.getAddress()) && ClientConfig.INSTANCE.enabled) {
LOGGER.info("AltauthClient: LoginRequestMixin: Server is running on a custom: {}", server);
if(ClientConfig.INSTANCE.allowedServers.contains(server)) {
if(ClientConfig.INSTANCE.allowedServers.contains(server) || AltAuth.trustOnce) {
AltAuth.trustOnce = false;
if(MinecraftClient.getInstance().currentScreen instanceof ConnectScreen cs) {
cs.status = Text.translatable("gui.altauth.connecting", server);
}
@ -53,16 +55,7 @@ public class LoginRequestMixin {
cs.connection.disconnect(Text.translatable("connect.aborted"));
}
MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new ConfirmScreen(t -> {
if(t) {
ClientConfig.INSTANCE.allowedServers.add(server);
ClientConfig.INSTANCE.save();
ConnectScreen.connect(cs.parent, client, AltAuth.address, null);
} else {
client.setScreen(cs.parent);
}
}, Text.translatable("gui.altauth.confirm.title", AltAuth.address.getAddress(), server), Text.translatable("gui.altauth.confirm.text", server), ScreenTexts.YES, ScreenTexts.CANCEL)));
MinecraftClient.getInstance().execute(() -> client.setScreen(new TrustServerScreen(server, cs.parent)));
}
}
} else {

Datei anzeigen

@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric.mixin;
import de.chaoscaot.altauth.fabric.AltAuth;