mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
fix: add locale to avoid wrong yggdrasil server name (#2521)
* fix: add locale to avoid wrong yggdrasil server name * update --------- Co-authored-by: Glavo <zjx001202@gmail.com>
This commit is contained in:
parent
94ccee0b76
commit
1605eb1775
@ -60,6 +60,7 @@ public class AuthlibInjectorServer implements Observable {
|
|||||||
try {
|
try {
|
||||||
url = addHttpsIfMissing(url);
|
url = addHttpsIfMissing(url);
|
||||||
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
||||||
|
conn.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||||
|
|
||||||
String ali = conn.getHeaderField("x-authlib-injector-api-location");
|
String ali = conn.getHeaderField("x-authlib-injector-api-location");
|
||||||
if (ali != null) {
|
if (ali != null) {
|
||||||
@ -68,6 +69,7 @@ public class AuthlibInjectorServer implements Observable {
|
|||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
url = absoluteAli.toString();
|
url = absoluteAli.toString();
|
||||||
conn = (HttpURLConnection) absoluteAli.openConnection();
|
conn = (HttpURLConnection) absoluteAli.openConnection();
|
||||||
|
conn.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public final class NetworkUtils {
|
|||||||
connection.setUseCaches(false);
|
connection.setUseCaches(false);
|
||||||
connection.setConnectTimeout(TIME_OUT);
|
connection.setConnectTimeout(TIME_OUT);
|
||||||
connection.setReadTimeout(TIME_OUT);
|
connection.setReadTimeout(TIME_OUT);
|
||||||
connection.setRequestProperty("Accept-Language", Locale.getDefault().toString());
|
connection.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user