mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 19:59:17 +01:00
Fix Bangumi login (fixes #3994)
This commit is contained in:
parent
6675508b24
commit
9b10e851d1
@ -164,7 +164,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
|||||||
if (responseBody.isEmpty()) {
|
if (responseBody.isEmpty()) {
|
||||||
throw Exception("Null Response")
|
throw Exception("Null Response")
|
||||||
}
|
}
|
||||||
Json.decodeFromString<OAuth>(responseBody)
|
Json { ignoreUnknownKeys = true }.decodeFromString<OAuth>(responseBody)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
|||||||
if (currAuth.isExpired()) {
|
if (currAuth.isExpired()) {
|
||||||
val response = chain.proceed(BangumiApi.refreshTokenRequest(currAuth.refresh_token!!))
|
val response = chain.proceed(BangumiApi.refreshTokenRequest(currAuth.refresh_token!!))
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
newAuth(Json.decodeFromString<OAuth>(response.body!!.string()))
|
newAuth(Json { ignoreUnknownKeys = true }.decodeFromString<OAuth>(response.body!!.string()))
|
||||||
} else {
|
} else {
|
||||||
response.close()
|
response.close()
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
|
|||||||
data class OAuth(
|
data class OAuth(
|
||||||
val access_token: String,
|
val access_token: String,
|
||||||
val token_type: String,
|
val token_type: String,
|
||||||
val created_at: Long,
|
val created_at: Long = System.currentTimeMillis() / 1000,
|
||||||
val expires_in: Long,
|
val expires_in: Long,
|
||||||
val refresh_token: String?,
|
val refresh_token: String?,
|
||||||
val user_id: Long?
|
val user_id: Long?
|
||||||
|
Loading…
Reference in New Issue
Block a user