From 28c536ca27e6fae6a38e2b9cc5bb9a198754447d Mon Sep 17 00:00:00 2001 From: Osten <11805592+LagradOst@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:12:17 +0200 Subject: [PATCH] update rate limit + dep --- app/build.gradle | 24 +++++++++---------- .../lagradost/quicknovel/BookDownloader2.kt | 9 ++++--- .../quicknovel/providers/RoyalRoadProvider.kt | 2 +- .../quicknovel/ui/result/ResultFragment.kt | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 33860214..8a4c099e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,21 +55,21 @@ repositories { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation 'androidx.core:core-ktx:1.12.0' + implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'org.jsoup:jsoup:1.15.1' - implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5' - implementation 'androidx.navigation:navigation-ui-ktx:2.7.5' + implementation 'org.jsoup:jsoup:1.17.2' + implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7' + implementation 'androidx.navigation:navigation-ui-ktx:2.7.7' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'com.github.bumptech.glide:glide:4.15.1' + androidTestImplementation 'androidx.test.ext:junit:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.0' + implementation 'com.github.bumptech.glide:glide:4.16.0' kapt 'com.github.bumptech.glide:compiler:4.13.1' implementation 'jp.wasabeef:glide-transformations:4.3.0' implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1" - implementation "androidx.preference:preference-ktx:1.2.0" + implementation "androidx.preference:preference-ktx:1.2.1" implementation('nl.siegmann.epublib:epublib-core:3.1') { exclude group: 'org.slf4j' @@ -77,18 +77,18 @@ dependencies { } implementation 'org.slf4j:slf4j-android:1.7.25' - implementation "androidx.recyclerview:recyclerview:1.3.0" + implementation "androidx.recyclerview:recyclerview:1.3.2" implementation 'android.arch.lifecycle:extensions:1.1.1' implementation 'io.reactivex.rxjava2:rxjava:2.2.18' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' - implementation("com.google.android.material:material:1.5.0") + implementation("com.google.android.material:material:1.12.0") - implementation 'androidx.media:media:1.6.0' + implementation 'androidx.media:media:1.7.0' implementation 'com.github.LagradOst:SafeFile:0.0.6' // To Prevent the URI File Fu*kery implementation 'com.jaredrummler:colorpicker:1.1.0' - implementation 'com.github.Blatzar:NiceHttp:0.4.4' + implementation 'com.github.Blatzar:NiceHttp:0.4.11' implementation "io.noties.markwon:core:4.6.2" implementation "io.noties.markwon:image-glide:4.6.2" diff --git a/app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt b/app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt index 4be6a9e3..b27df038 100644 --- a/app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt +++ b/app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt @@ -589,12 +589,15 @@ object BookDownloader2Helper { if (!page.isNullOrBlank()) { rFile.createNewFile() // only create the file when actually needed rFile.writeText("${data.name}\n${page}") + if (api.rateLimitTime > 0) { + delay(api.rateLimitTime) + } return@withContext true } else { delay(5000) // ERROR - } - if (api.rateLimitTime > 0) { - delay(api.rateLimitTime) + if (api.rateLimitTime > 0) { + delay(api.rateLimitTime) + } } } finally { if (rateLimit) { diff --git a/app/src/main/java/com/lagradost/quicknovel/providers/RoyalRoadProvider.kt b/app/src/main/java/com/lagradost/quicknovel/providers/RoyalRoadProvider.kt index b4026be4..1500ca79 100644 --- a/app/src/main/java/com/lagradost/quicknovel/providers/RoyalRoadProvider.kt +++ b/app/src/main/java/com/lagradost/quicknovel/providers/RoyalRoadProvider.kt @@ -25,7 +25,7 @@ import java.util.Date class RoyalRoadProvider : MainAPI() { override val name = "Royal Road" override val mainUrl = "https://www.royalroad.com" - override val rateLimitTime = 5000L + override val rateLimitTime = 500L override val hasMainPage = true override val iconId = R.drawable.big_icon_royalroad diff --git a/app/src/main/java/com/lagradost/quicknovel/ui/result/ResultFragment.kt b/app/src/main/java/com/lagradost/quicknovel/ui/result/ResultFragment.kt index d98e9bb2..4c5ed237 100644 --- a/app/src/main/java/com/lagradost/quicknovel/ui/result/ResultFragment.kt +++ b/app/src/main/java/com/lagradost/quicknovel/ui/result/ResultFragment.kt @@ -172,7 +172,7 @@ class ResultFragment : Fragment() { val res = loadResponse.value binding.apply { - downloadWarning.isVisible = api.rateLimitTime > 1000 + downloadWarning.isVisible = api.rateLimitTime > 2000 res.image?.let { img -> resultEmptyView.setOnClickListener {