From 9b10e851d16cff9772e4cf3d71917df27b0416d6 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 1 Nov 2020 15:00:21 -0500 Subject: [PATCH] Fix Bangumi login (fixes #3994) --- .../java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt | 2 +- .../kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt | 2 +- .../main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt index 8ef3f2833..6b28a5468 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt @@ -164,7 +164,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept if (responseBody.isEmpty()) { throw Exception("Null Response") } - Json.decodeFromString(responseBody) + Json { ignoreUnknownKeys = true }.decodeFromString(responseBody) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt index c9f314812..475e7287b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt @@ -30,7 +30,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor { if (currAuth.isExpired()) { val response = chain.proceed(BangumiApi.refreshTokenRequest(currAuth.refresh_token!!)) if (response.isSuccessful) { - newAuth(Json.decodeFromString(response.body!!.string())) + newAuth(Json { ignoreUnknownKeys = true }.decodeFromString(response.body!!.string())) } else { response.close() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt index 912d5bb40..774438a5e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable data class OAuth( val access_token: String, val token_type: String, - val created_at: Long, + val created_at: Long = System.currentTimeMillis() / 1000, val expires_in: Long, val refresh_token: String?, val user_id: Long?