From 18d708d62c5417ca5d52e83b3bed8c027ce27089 Mon Sep 17 00:00:00 2001 From: Haowei Wen Date: Sun, 18 Feb 2024 00:31:20 +0800 Subject: [PATCH] Fix UUID lookup is not working on MC 1.20.4+ (#232) --- .../yushi/authlibinjector/httpd/QueryUUIDsFilter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/moe/yushi/authlibinjector/httpd/QueryUUIDsFilter.java b/src/main/java/moe/yushi/authlibinjector/httpd/QueryUUIDsFilter.java index d21dc25..a8cf4f3 100644 --- a/src/main/java/moe/yushi/authlibinjector/httpd/QueryUUIDsFilter.java +++ b/src/main/java/moe/yushi/authlibinjector/httpd/QueryUUIDsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2024 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -49,12 +49,15 @@ public class QueryUUIDsFilter implements URLFilter { @Override public boolean canHandle(String domain) { - return domain.equals("api.mojang.com"); + return domain.equals("api.mojang.com") || domain.equals("api.minecraftservices.com"); } @Override public Optional handle(String domain, String path, IHTTPSession session) throws IOException { - if (domain.equals("api.mojang.com") && path.equals("/profiles/minecraft") && session.getMethod().equals("POST")) { + if ( + (domain.equals("api.mojang.com") && path.equals("/profiles/minecraft") && session.getMethod().equals("POST")) || + (domain.equals("api.minecraftservices.com") && path.equals("/minecraft/profile/lookup/bulk/byname") && session.getMethod().equals("POST")) + ) { Set request = new LinkedHashSet<>(); asJsonArray(parseJson(asString(asBytes(session.getInputStream())))) .forEach(element -> request.add(asJsonString(element)));