mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-09 03:46:18 -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 {
|
||||
url = addHttpsIfMissing(url);
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
||||
conn.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||
|
||||
String ali = conn.getHeaderField("x-authlib-injector-api-location");
|
||||
if (ali != null) {
|
||||
@ -68,6 +69,7 @@ public class AuthlibInjectorServer implements Observable {
|
||||
conn.disconnect();
|
||||
url = absoluteAli.toString();
|
||||
conn = (HttpURLConnection) absoluteAli.openConnection();
|
||||
conn.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public final class NetworkUtils {
|
||||
connection.setUseCaches(false);
|
||||
connection.setConnectTimeout(TIME_OUT);
|
||||
connection.setReadTimeout(TIME_OUT);
|
||||
connection.setRequestProperty("Accept-Language", Locale.getDefault().toString());
|
||||
connection.setRequestProperty("Accept-Language", Locale.getDefault().toLanguageTag());
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user