mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
默认不严格验证
This commit is contained in:
@@ -77,7 +77,7 @@ public class SelfHost implements ResourcePackHost {
|
||||
boolean oneTimeToken = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("one-time-token", true), "one-time-token");
|
||||
String protocol = arguments.getOrDefault("protocol", "http").toString();
|
||||
boolean denyNonMinecraftRequest = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("deny-non-minecraft-request", true), "deny-non-minecraft-request");
|
||||
boolean strictValidation = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("strict-validation", true), "strict-validation");
|
||||
boolean strictValidation = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("strict-validation", false), "strict-validation");
|
||||
|
||||
Bandwidth limit = null;
|
||||
Map<String, Object> rateLimitingSection = ResourceConfigUtils.getAsMapOrNull(arguments.get("rate-limiting"), "rate-limiting");
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SelfHostHttpServer {
|
||||
private String url;
|
||||
private boolean denyNonMinecraft = true;
|
||||
private boolean useToken;
|
||||
private boolean strictValidation = true;
|
||||
private boolean strictValidation = false;
|
||||
|
||||
private long globalUploadRateLimit = 0;
|
||||
private long minDownloadSpeed = 50_000;
|
||||
@@ -234,7 +234,7 @@ public class SelfHostHttpServer {
|
||||
boolean nonMinecraftClient = userAgent == null || !userAgent.startsWith("Minecraft Java/");
|
||||
if (strictValidation && !nonMinecraftClient) {
|
||||
String clientVersion = request.headers().get("X-Minecraft-Version");
|
||||
nonMinecraftClient = !Objects.equals(clientVersion, userAgent.substring(15));
|
||||
nonMinecraftClient = !Objects.equals(clientVersion, userAgent.substring("Minecraft Java/".length()));
|
||||
}
|
||||
if (nonMinecraftClient) {
|
||||
sendError(ctx, HttpResponseStatus.FORBIDDEN, "Invalid client");
|
||||
|
||||
Reference in New Issue
Block a user