mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 15:01:52 +01:00
Fix MAL Delete entry api
This commit is contained in:
parent
9090f87756
commit
5cf9d09a02
@ -37,6 +37,7 @@ import org.jsoup.Jsoup
|
|||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import org.jsoup.parser.Parser
|
import org.jsoup.parser.Parser
|
||||||
|
import retrofit2.http.DELETE
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -249,18 +250,21 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun remove(track: Track): Boolean {
|
suspend fun remove(track: Track): Boolean {
|
||||||
try {
|
return withIOContext {
|
||||||
authClient.newCall(POST(url = removeUrl(track.media_id))).await()
|
try {
|
||||||
return true
|
val request = Request.Builder()
|
||||||
} catch (e: Exception) {
|
.url(mangaUrl(track.media_id).toString())
|
||||||
Timber.w(e)
|
.delete()
|
||||||
|
.build()
|
||||||
|
authClient.newCall(request).await()
|
||||||
|
true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.w(e)
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeUrl(mediaId: Int) = "$baseApiUrl/manga".toUri().buildUpon().appendPath(mediaId.toString())
|
|
||||||
.appendPath("delete").toString()
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// Registered under jay's MAL account
|
// Registered under jay's MAL account
|
||||||
private const val clientId = "8d3821c90edb495432a5ecb61de59200"
|
private const val clientId = "8d3821c90edb495432a5ecb61de59200"
|
||||||
|
Loading…
Reference in New Issue
Block a user