From 1632c8b2fb7021e090adb00a711347ac27bf2489 Mon Sep 17 00:00:00 2001 From: acite <1498045907@qq.com> Date: Mon, 25 Aug 2025 19:10:05 +0800 Subject: [PATCH] [fix] Fixed the issue of freezing when entering the client without configuring the private key --- README.md | 1 + .../main/java/com/acitelight/aether/service/AuthManager.kt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ebcfbd..98d5ba1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ _🚀This is the client of the multimedia server Abyss, which can also be extend - [x] Fix tablet full-screen mode bug - [x] Hide private key after user input - [x] Optimize API call logic, do not create crashes +- [x] Fix the issue of freezing when entering the client without configuring the private key - [ ] Replace Android robot icon with custom design - [ ] Configure server baseURL in client settings - [ ] Implement proper access control for directory queries diff --git a/app/src/main/java/com/acitelight/aether/service/AuthManager.kt b/app/src/main/java/com/acitelight/aether/service/AuthManager.kt index 1723f12..82efb0f 100644 --- a/app/src/main/java/com/acitelight/aether/service/AuthManager.kt +++ b/app/src/main/java/com/acitelight/aether/service/AuthManager.kt @@ -9,9 +9,10 @@ import java.security.PrivateKey import java.security.Signature object AuthManager { - suspend fun fetchToken(baseUrl: String, username: String, privateKey: String): String? = runBlocking { + suspend fun fetchToken(baseUrl: String, username: String, privateKey: String): String? { val api = ApiClient.api var challengeBase64 = "" + try{ challengeBase64 = api.getChallenge(username).string() }catch (e: Exception) @@ -21,7 +22,7 @@ object AuthManager { val signedBase64 = signChallenge(db64(privateKey), db64(challengeBase64)) - return@runBlocking try { + return try { api.verifyChallenge(username, ChallengeResponse(response = signedBase64)).string() } catch (e: Exception) { e.printStackTrace()