mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-07 04:44:35 -05:00
Lint (#423)
This commit is contained in:
@@ -29,7 +29,6 @@ import uy.kohesive.injekt.api.get
|
||||
class AppModule(val app: Application) : InjektModule {
|
||||
|
||||
override fun InjektRegistrar.registerInjectables() {
|
||||
|
||||
addSingleton(app)
|
||||
|
||||
// addSingletonFactory { PreferencesHelper(app) }
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.util.concurrent.TimeUnit
|
||||
fun OkHttpClient.Builder.rateLimit(
|
||||
permits: Int,
|
||||
period: Long = 1,
|
||||
unit: TimeUnit = TimeUnit.SECONDS,
|
||||
unit: TimeUnit = TimeUnit.SECONDS
|
||||
) = addInterceptor(RateLimitInterceptor(permits, period, unit))
|
||||
|
||||
private class RateLimitInterceptor(
|
||||
private val permits: Int,
|
||||
period: Long,
|
||||
unit: TimeUnit,
|
||||
unit: TimeUnit
|
||||
) : Interceptor {
|
||||
|
||||
private val requestQueue = ArrayList<Long>(permits)
|
||||
|
||||
@@ -26,14 +26,14 @@ fun OkHttpClient.Builder.rateLimitHost(
|
||||
httpUrl: HttpUrl,
|
||||
permits: Int,
|
||||
period: Long = 1,
|
||||
unit: TimeUnit = TimeUnit.SECONDS,
|
||||
unit: TimeUnit = TimeUnit.SECONDS
|
||||
) = addInterceptor(SpecificHostRateLimitInterceptor(httpUrl, permits, period, unit))
|
||||
|
||||
class SpecificHostRateLimitInterceptor(
|
||||
httpUrl: HttpUrl,
|
||||
private val permits: Int,
|
||||
period: Long,
|
||||
unit: TimeUnit,
|
||||
unit: TimeUnit
|
||||
) : Interceptor {
|
||||
|
||||
private val requestQueue = ArrayList<Long>(permits)
|
||||
|
||||
@@ -327,8 +327,9 @@ class LocalSource : CatalogueSource {
|
||||
|
||||
fun getFormat(chapter: SChapter): Format {
|
||||
val chapFile = File(applicationDirs.localMangaRoot, chapter.url)
|
||||
if (chapFile.exists())
|
||||
if (chapFile.exists()) {
|
||||
return getFormat(chapFile)
|
||||
}
|
||||
|
||||
throw Exception("Chapter not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user