[fix] Fixed the issue of freezing when entering the client without configuring the private key
This commit is contained in:
@@ -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] Fix tablet full-screen mode bug
|
||||||
- [x] Hide private key after user input
|
- [x] Hide private key after user input
|
||||||
- [x] Optimize API call logic, do not create crashes
|
- [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
|
- [ ] Replace Android robot icon with custom design
|
||||||
- [ ] Configure server baseURL in client settings
|
- [ ] Configure server baseURL in client settings
|
||||||
- [ ] Implement proper access control for directory queries
|
- [ ] Implement proper access control for directory queries
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import java.security.PrivateKey
|
|||||||
import java.security.Signature
|
import java.security.Signature
|
||||||
|
|
||||||
object AuthManager {
|
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
|
val api = ApiClient.api
|
||||||
var challengeBase64 = ""
|
var challengeBase64 = ""
|
||||||
|
|
||||||
try{
|
try{
|
||||||
challengeBase64 = api.getChallenge(username).string()
|
challengeBase64 = api.getChallenge(username).string()
|
||||||
}catch (e: Exception)
|
}catch (e: Exception)
|
||||||
@@ -21,7 +22,7 @@ object AuthManager {
|
|||||||
|
|
||||||
val signedBase64 = signChallenge(db64(privateKey), db64(challengeBase64))
|
val signedBase64 = signChallenge(db64(privateKey), db64(challengeBase64))
|
||||||
|
|
||||||
return@runBlocking try {
|
return try {
|
||||||
api.verifyChallenge(username, ChallengeResponse(response = signedBase64)).string()
|
api.verifyChallenge(username, ChallengeResponse(response = signedBase64)).string()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
|||||||
Reference in New Issue
Block a user