mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-21 18:02:42 +01:00
parent
49f942a8cb
commit
59f3520be7
@ -2,4 +2,4 @@ plugins {
|
|||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 31
|
baseVersionCode = 32
|
||||||
|
@ -5,6 +5,7 @@ import android.app.Application
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import android.webkit.WebViewClient
|
import android.webkit.WebViewClient
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -102,18 +103,18 @@ abstract class LibGroup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var _constants: Constants? = null
|
private var _constants: Constants? = null
|
||||||
private fun getConstants(): Constants {
|
private fun getConstants(): Constants? {
|
||||||
if (_constants == null) {
|
if (_constants == null) {
|
||||||
try {
|
try {
|
||||||
_constants = client.newCall(
|
_constants = client.newCall(
|
||||||
GET("$apiDomain/api/constants?fields[]=genres&fields[]=tags&fields[]=types&fields[]=scanlateStatus&fields[]=status&fields[]=format&fields[]=ageRestriction&fields[]=imageServers", headers),
|
GET("$apiDomain/api/constants?fields[]=genres&fields[]=tags&fields[]=types&fields[]=scanlateStatus&fields[]=status&fields[]=format&fields[]=ageRestriction&fields[]=imageServers", headers),
|
||||||
).execute().parseAs<Data<Constants>>().data
|
).execute().parseAs<Data<Constants>>().data
|
||||||
return _constants!!
|
return _constants
|
||||||
} catch (ex: SerializationException) {
|
} catch (ex: Exception) {
|
||||||
throw Exception("Ошибка сериализации. Проверьте сайт.")
|
Log.d("LibGroup", "Error getting constants: $ex")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _constants!!
|
return _constants
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkForToken(chain: Interceptor.Chain): Response {
|
private fun checkForToken(chain: Interceptor.Chain): Response {
|
||||||
@ -376,7 +377,7 @@ abstract class LibGroup(
|
|||||||
if (page.imageUrl != null) {
|
if (page.imageUrl != null) {
|
||||||
return Observable.just(page.imageUrl)
|
return Observable.just(page.imageUrl)
|
||||||
}
|
}
|
||||||
val server = getConstants().getServer(isServer(), siteId).url
|
val server = getConstants()?.getServer(isServer(), siteId)?.url ?: throw Exception("Ошибка получения сервера изображений")
|
||||||
return Observable.just("$server${page.url}")
|
return Observable.just("$server${page.url}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,13 +509,13 @@ abstract class LibGroup(
|
|||||||
|
|
||||||
filters += if (_constants != null) {
|
filters += if (_constants != null) {
|
||||||
listOf(
|
listOf(
|
||||||
CategoryList(getConstants().getCategories(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
CategoryList(getConstants()!!.getCategories(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
||||||
FormatList(getConstants().getFormats(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
FormatList(getConstants()!!.getFormats(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
||||||
GenreList(getConstants().getGenres(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
GenreList(getConstants()!!.getGenres(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
||||||
TagList(getConstants().getTags(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
TagList(getConstants()!!.getTags(siteId).map { SearchFilter(it.name, it.id.toString()) }),
|
||||||
StatusList(getConstants().getScanlateStatuses(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
StatusList(getConstants()!!.getScanlateStatuses(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
||||||
StatusTitleList(getConstants().getTitleStatuses(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
StatusTitleList(getConstants()!!.getTitleStatuses(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
||||||
AgeList(getConstants().getAgeRestrictions(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
AgeList(getConstants()!!.getAgeRestrictions(siteId).map { CheckFilter(it.label, it.id.toString()) }),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
listOf(
|
listOf(
|
||||||
|
Loading…
Reference in New Issue
Block a user