9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-24 01:19:24 +00:00

feat(core): 为 CustomApiHost 添加身份验证密钥支持

This commit is contained in:
jhqwqmc
2025-04-18 06:45:14 +08:00
parent a06a1b96ef
commit e92e50bb78

View File

@@ -9,9 +9,7 @@ import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.util.GsonHelper;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@@ -118,7 +116,7 @@ public class CustomApiHost implements ResourcePackHost {
@Override
public ResourcePackHost create(Map<String, Object> arguments) {
String apiUrl = (String) arguments.get("api-url");
String authKey = (String) arguments.get("auth-key");
String authKey = (String) arguments.getOrDefault("auth-key", "");
if (apiUrl == null || apiUrl.isEmpty()) {
throw new IllegalArgumentException("'api-url' cannot be empty for custom api host");
}