Skip to content

Commit

Permalink
Merge pull request #236 from yushijinhun/develop
Browse files Browse the repository at this point in the history
Release v1.2.5
  • Loading branch information
yushijinhun authored Feb 17, 2024
2 parents 2b6bf9f + cf9248b commit 9c95847
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Haowei Wen <[email protected]> and contributors
* Copyright (C) 2024 Haowei Wen <[email protected]> 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
Expand Down Expand Up @@ -49,12 +49,15 @@ public QueryUUIDsFilter(YggdrasilClient mojangClient, YggdrasilClient customClie

@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<Response> 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<String> request = new LinkedHashSet<>();
asJsonArray(parseJson(asString(asBytes(session.getInputStream()))))
.forEach(element -> request.add(asJsonString(element)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private Response reverseProxy(IHTTPSession session, String upstream) throws IOEx
conn.setDoOutput(clientIn != null);
requestHeaders.forEach(conn::setRequestProperty);

if (clientIn != null) {
if (clientIn != null && !method.equalsIgnoreCase("GET") && !method.equalsIgnoreCase("HEAD")) {
try (OutputStream upstreamOut = conn.getOutputStream()) {
transfer(clientIn, upstreamOut);
}
Expand Down

0 comments on commit 9c95847

Please sign in to comment.