mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
默认不严格验证
This commit is contained in:
@@ -198,7 +198,8 @@ resource-pack:
|
||||
# Generates a single-use, time-limited download link for each player.
|
||||
one-time-token: true
|
||||
# Enhances validation for deny-non-minecraft-request and one-time-token.
|
||||
strict-validation: true
|
||||
# Do not enable this on an offline server
|
||||
strict-validation: false
|
||||
rate-limiting:
|
||||
# Maximum bandwidth per second to prevent server instability for other players during resource pack downloads
|
||||
max-bandwidth-per-second: 5_000_000 # 5MB/s
|
||||
|
||||
@@ -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