From 0705465ba46a0a1f40dc6dc9189ca167a05895a9 Mon Sep 17 00:00:00 2001 From: Xirren Date: Wed, 7 Jan 2026 22:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=A6=E5=8F=B7SSL?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=20(#5143)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: xirren Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com> --- HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java | 6 ++++++ .../hmcl/ui/account/AddAuthlibInjectorServerPane.java | 6 ++++++ HMCL/src/main/resources/assets/lang/I18N.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_ar.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_es.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_lzh.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_ru.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_uk.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_zh.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | 1 + 10 files changed, 20 insertions(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java index d88f16fd9..a1cdc83b7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java @@ -414,6 +414,12 @@ public final class Accounts { return i18n("account.failed.no_character"); } else if (exception instanceof ServerDisconnectException) { if (exception.getCause() instanceof SSLException) { + if (exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("Remote host terminated")) { + return i18n("account.failed.connect_authentication_server"); + } + if (exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("No name matching") || exception.getCause().getMessage().contains("No subject alternative DNS name matching")) { + return i18n("account.failed.dns"); + } return i18n("account.failed.ssl"); } else { return i18n("account.failed.connect_authentication_server"); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java index 78ee95e6b..ad8d99a2a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java @@ -164,6 +164,12 @@ public final class AddAuthlibInjectorServerPane extends TransitionPane implement private String resolveFetchExceptionMessage(Throwable exception) { if (exception instanceof SSLException) { + if (exception.getMessage() != null && exception.getMessage().contains("Remote host terminated")) { + return i18n("account.failed.connect_injector_server"); + } + if (exception.getMessage() != null && exception.getMessage().contains("No name matching") || exception.getMessage().contains("No subject alternative DNS name matching")) { + return i18n("account.failed.dns"); + } return i18n("account.failed.ssl"); } else if (exception instanceof IOException) { return i18n("account.failed.connect_injector_server"); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index d089bdc2b..c2bbad319 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -75,6 +75,7 @@ account.failed.server_disconnected=Failed to connect to the authentication serve If the issue persists after multiple attempts, please try logging in to the account again. account.failed.server_response_malformed=Invalid server response. The authentication server may be down. account.failed.ssl=An SSL error occurred while connecting to the server. Please try updating your Java. +account.failed.dns=An SSL error occurred while connecting to the server. DNS resolution may be incorrect. Please try changing your DNS server or using a proxy service. account.failed.wrong_account=You have logged in to the wrong account. account.hmcl.hint=You need to click "Log in" and complete the process in the opened browser window. account.injector.add=New Auth Server diff --git a/HMCL/src/main/resources/assets/lang/I18N_ar.properties b/HMCL/src/main/resources/assets/lang/I18N_ar.properties index 6521bdfb0..f3798f1fa 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ar.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ar.properties @@ -74,6 +74,7 @@ account.failed.server_disconnected=فشل الاتصال بخادم المصاد إذا استمرت المشكلة بعد محاولات متعددة، يرجى محاولة تسجيل الدخول إلى الحساب مرة أخرى. account.failed.server_response_malformed=استجابة خادم غير صالحة. قد يكون خادم المصادقة معطلاً. account.failed.ssl=حدث خطأ SSL أثناء الاتصال بالخادم. يرجى محاولة تحديث Java الخاص بك. +account.failed.dns=حدث خطأ SSL عند الاتصال بالخادم. قد تكون هناك مشكلة في تحليل أسماء النطاقات (DNS). يرجى محاولة تغيير خادم DNS أو استخدام خدمة وكيل. account.failed.wrong_account=لقد قمت بتسجيل الدخول إلى حساب خاطئ. account.hmcl.hint=يجب عليك النقر على "تسجيل الدخول" وإكمال العملية في نافذة المتصفح المفتوحة. account.injector.add=خادم مصادقة جديد diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index e21cda35d..8f79407ec 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -74,6 +74,7 @@ account.failed.server_disconnected=No se ha podido conectar con el servidor de a Si lo intentas varias veces y sigue fallando, vuelve a intentar iniciar sesión en la cuenta. account.failed.server_response_malformed=Respuesta del servidor no válida, el servidor de autenticación puede no estar funcionando. account.failed.ssl=Se ha producido un error SSL al conectar con el servidor. Por favor, intente actualizar su Java. +account.failed.dns=Se produjo un error SSL al conectar con el servidor. Es posible que la resolución DNS sea incorrecta. Intente cambiar el servidor DNS o usar un servicio proxy. account.failed.wrong_account=Ha iniciado sesión en la cuenta equivocada. account.hmcl.hint=Debe hacer clic en «Iniciar sesión» y completar el proceso en la ventana abierta del navegador. account.injector.add=Nuevo servidor Auth diff --git a/HMCL/src/main/resources/assets/lang/I18N_lzh.properties b/HMCL/src/main/resources/assets/lang/I18N_lzh.properties index 79320f26f..df92e54a8 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_lzh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_lzh.properties @@ -78,6 +78,7 @@ account.failed.server_disconnected=不可訪所入伺服器。戶簿訊更敗矣 君可求助於右上之鈕。 account.failed.server_response_malformed=鑒權伺服器之訊有謬。伺服器或壞。 account.failed.ssl=將訪伺服器而 SSL 有謬。站證或舊,抑爪哇之版舊。宜新爪哇,抑廢代而再試之。\n君可求助於右上之鈕。 +account.failed.dns=將訪伺服器而 SSL 有謬。或由 DNS 解析有誤也。宜更 DNS 伺服,抑用代理以訪。\n君可求助於右上之鈕。 account.failed.wrong_account=入謬戶簿 account.hmcl.hint=子須擊「登戶簿」之紐,並登簿於所見之頁。 account.injector.add=增鑒權伺服器 diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index 6efa9e975..a26d08920 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -77,6 +77,7 @@ account.failed.server_disconnected=Невозможно получить дос аккаунта. account.failed.server_response_malformed=Неверный ответ сервера, видимо сервер авторизации не работает. account.failed.ssl=При подключении к серверу произошла ошибка SSL. Пожалуйста, попробуйте обновить Java. +account.failed.dns=При подключении к серверу произошла ошибка SSL. Возможно, проблемы с разрешением DNS. Попробуйте сменить DNS‑сервер или воспользоваться прокси-службой. account.failed.wrong_account=Вы вошли в неверный аккаунт. account.hmcl.hint=Необходимо нажать на «Войти» и завершить процесс в открывшейся вкладке вашего браузера. account.injector.add=Новый сервер авторизации diff --git a/HMCL/src/main/resources/assets/lang/I18N_uk.properties b/HMCL/src/main/resources/assets/lang/I18N_uk.properties index 73f052853..1bc5ea1f2 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_uk.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_uk.properties @@ -73,6 +73,7 @@ account.failed.server_disconnected=Не вдалося підключитися Якщо проблема не зникає після кількох спроб, спробуйте знову увійти до облікового запису. account.failed.server_response_malformed=Недійсна відповідь сервера. Можливо, сервер автентифікації не працює. account.failed.ssl=Під час підключення до сервера сталася помилка SSL. Спробуйте оновити Java. +account.failed.dns=Під час підключення до сервера сталася помилка SSL. Можливо, DNS неправильно розв'язується. Спробуйте змінити DNS-сервер або використовувати проксі-сервіс. account.failed.wrong_account=Ви увійшли до неправильного облікового запису. account.hmcl.hint=Вам потрібно натиснути "Увійти" і завершити процес у відкритому вікні браузера. account.injector.add=Новий сервер автентифікації diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index c49e57801..5c9232f43 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -78,6 +78,7 @@ account.failed.server_disconnected=無法訪問登入伺服器。帳戶資訊重 若嘗試多次無法重新整理,可嘗試重新增加該帳戶,或許可以解決該問題。 account.failed.server_response_malformed=無法解析認證伺服器回應,可能是伺服器故障。 account.failed.ssl=連線伺服器時發生了 SSL 錯誤。可能網站證書已過期或你使用的 Java 版本過低。請嘗試更新 Java。 +account.failed.dns=連線伺服器時發生了 SSL 錯誤。可能是 DNS 解析有誤。請嘗試更換 DNS 伺服器或使用代理服務。 account.failed.wrong_account=登入了錯誤的帳戶 account.hmcl.hint=你需要點擊「登入」按鈕,並在開啟的網頁中完成登入 account.injector.add=新增認證伺服器 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 76e838140..2efc9c139 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -79,6 +79,7 @@ account.failed.server_disconnected=无法访问登录服务器。账户信息刷 你可以点击右上角帮助按钮进行求助。 account.failed.server_response_malformed=无法解析认证服务器响应。可能是服务器故障。 account.failed.ssl=连接服务器时发生了 SSL 错误。可能网站证书已过期或你使用的 Java 版本过低。请尝试更新 Java,或关闭网络代理后再试。\n你可以点击右上角帮助按钮进行求助。 +account.failed.dns=连接服务器时发生了 SSL 错误。可能是 DNS 解析有误。请尝试更换 DNS 服务器或使用代理服务。\n你可以点击右上角帮助按钮进行求助。 account.failed.wrong_account=登录了错误的账户 account.hmcl.hint=你需要点击“登录”按钮,并在弹出的网页中完成登录。 account.injector.add=添加认证服务器