Bump dependencies + linting

This commit is contained in:
arkon
2022-09-10 23:57:03 -04:00
parent 5b474e96b7
commit cd3cb72b65
33 changed files with 195 additions and 104 deletions

View File

@@ -44,8 +44,11 @@ class BackupFileValidator(
.filter { sourceManager.get(it.key) == null }
.values.map {
val id = it.toLongOrNull()
if (id == null) it
else sourceManager.getOrStub(id).toString()
if (id == null) {
it
} else {
sourceManager.getOrStub(id).toString()
}
}
.distinct()
.sorted()

View File

@@ -11,7 +11,8 @@ data class BackupTracking(
@ProtoNumber(1) var syncId: Int,
// LibraryId is not null in 1.x
@ProtoNumber(2) var libraryId: Long,
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING) @ProtoNumber(3)
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING)
@ProtoNumber(3)
var mediaIdInt: Int = 0,
// trackingUrl is called mediaUrl in 1.x
@ProtoNumber(4) var trackingUrl: String = "",

View File

@@ -30,29 +30,37 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
}
}
val authRequest = if (originalRequest.method == "GET") originalRequest.newBuilder()
.header("User-Agent", "Tachiyomi")
.url(
originalRequest.url.newBuilder()
.addQueryParameter("access_token", currAuth.access_token).build(),
)
.build() else originalRequest.newBuilder()
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
.header("User-Agent", "Tachiyomi")
.build()
val authRequest = if (originalRequest.method == "GET") {
originalRequest.newBuilder()
.header("User-Agent", "Tachiyomi")
.url(
originalRequest.url.newBuilder()
.addQueryParameter("access_token", currAuth.access_token).build(),
)
.build()
} else {
originalRequest.newBuilder()
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
.header("User-Agent", "Tachiyomi")
.build()
}
return chain.proceed(authRequest)
}
fun newAuth(oauth: OAuth?) {
this.oauth = if (oauth == null) null else OAuth(
oauth.access_token,
oauth.token_type,
System.currentTimeMillis() / 1000,
oauth.expires_in,
oauth.refresh_token,
this.oauth?.user_id,
)
this.oauth = if (oauth == null) {
null
} else {
OAuth(
oauth.access_token,
oauth.token_type,
System.currentTimeMillis() / 1000,
oauth.expires_in,
oauth.refresh_token,
this.oauth?.user_id,
)
}
bangumi.saveToken(oauth)
}

View File

@@ -41,8 +41,11 @@ class KomgaApi(private val client: OkHttpClient) {
val progress = client
.newCall(GET("${url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi"))
.await().let {
if (url.contains("/api/v1/series/")) it.parseAs<ReadProgressV2Dto>()
else it.parseAs<ReadProgressDto>().toV2()
if (url.contains("/api/v1/series/")) {
it.parseAs<ReadProgressV2Dto>()
} else {
it.parseAs<ReadProgressDto>().toV2()
}
}
track.apply {