AllAnime: update url (#16948)
This commit is contained in:
parent
67c01b56aa
commit
9de0f461b9
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'AllAnime'
|
extName = 'AllAnime'
|
||||||
pkgNameSuffix = 'en.allanime'
|
pkgNameSuffix = 'en.allanime'
|
||||||
extClass = '.AllAnime'
|
extClass = '.AllAnime'
|
||||||
extVersionCode = 4
|
extVersionCode = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import androidx.preference.SwitchPreferenceCompat
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.encodeToString
|
import kotlinx.serialization.encodeToString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -50,11 +49,9 @@ class AllAnime : ConfigurableSource, HttpSource() {
|
||||||
private val preferences: SharedPreferences =
|
private val preferences: SharedPreferences =
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
|
|
||||||
private val domain = preferences.domainPref
|
override val baseUrl = "https://allanime.ai"
|
||||||
|
|
||||||
override val baseUrl = "https://$domain"
|
private val apiUrl = "https://api.allanime.day/api"
|
||||||
|
|
||||||
private val apiUrl = "https://api.$domain/allanimeapi"
|
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
.addInterceptor { chain ->
|
.addInterceptor { chain ->
|
||||||
|
@ -75,7 +72,7 @@ class AllAnime : ConfigurableSource, HttpSource() {
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.rateLimitHost(apiUrl.toHttpUrl(), 1)
|
.rateLimit(1)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
override fun headersBuilder() = super.headersBuilder()
|
override fun headersBuilder() = super.headersBuilder()
|
||||||
|
@ -317,15 +314,6 @@ class AllAnime : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
ListPreference(screen.context).apply {
|
|
||||||
key = DOMAIN_PREF
|
|
||||||
title = "Preferred domain"
|
|
||||||
entries = arrayOf("allanime.to", "allanime.co")
|
|
||||||
entryValues = arrayOf("allanime.to", "allanime.co")
|
|
||||||
setDefaultValue(DOMAIN_PREF_DEFAULT)
|
|
||||||
summary = "Requires App Restart"
|
|
||||||
}.let { screen.addPreference(it) }
|
|
||||||
|
|
||||||
ListPreference(screen.context).apply {
|
ListPreference(screen.context).apply {
|
||||||
key = IMAGE_QUALITY_PREF
|
key = IMAGE_QUALITY_PREF
|
||||||
title = "Image Quality"
|
title = "Image Quality"
|
||||||
|
@ -351,9 +339,6 @@ class AllAnime : ConfigurableSource, HttpSource() {
|
||||||
}.let { screen.addPreference(it) }
|
}.let { screen.addPreference(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SharedPreferences.domainPref
|
|
||||||
get() = getString(DOMAIN_PREF, DOMAIN_PREF_DEFAULT)!!
|
|
||||||
|
|
||||||
private val SharedPreferences.titlePref
|
private val SharedPreferences.titlePref
|
||||||
get() = getString(TITLE_PREF, TITLE_PREF_DEFAULT)
|
get() = getString(TITLE_PREF, TITLE_PREF_DEFAULT)
|
||||||
|
|
||||||
|
@ -379,8 +364,6 @@ class AllAnime : ConfigurableSource, HttpSource() {
|
||||||
val titleSpecialCharactersRegex = Regex("[^a-z\\d]+")
|
val titleSpecialCharactersRegex = Regex("[^a-z\\d]+")
|
||||||
private val imageUrlFromPageRegex = Regex("selectedPicturesServer:\\[\\{.*?url:\"(.*?)\".*?\\}\\]")
|
private val imageUrlFromPageRegex = Regex("selectedPicturesServer:\\[\\{.*?url:\"(.*?)\".*?\\}\\]")
|
||||||
|
|
||||||
private const val DOMAIN_PREF = "pref_domain"
|
|
||||||
private const val DOMAIN_PREF_DEFAULT = "allanime.to"
|
|
||||||
private const val TITLE_PREF = "pref_title"
|
private const val TITLE_PREF = "pref_title"
|
||||||
private const val TITLE_PREF_DEFAULT = "romaji"
|
private const val TITLE_PREF_DEFAULT = "romaji"
|
||||||
private const val SHOW_ADULT_PREF = "pref_adult"
|
private const val SHOW_ADULT_PREF = "pref_adult"
|
||||||
|
|
|
@ -84,10 +84,13 @@ data class ApiMangaDetailsResponse(
|
||||||
thumbnail_url = thumbnail?.parseThumbnailUrl()
|
thumbnail_url = thumbnail?.parseThumbnailUrl()
|
||||||
description = this@Manga.description?.parseDescription()
|
description = this@Manga.description?.parseDescription()
|
||||||
if (!altNames.isNullOrEmpty()) {
|
if (!altNames.isNullOrEmpty()) {
|
||||||
description += altNames.joinToString(
|
if (description.isNullOrEmpty()) {
|
||||||
prefix = "\n\nAlternative Names:\n* ",
|
description = "Alternative Titles:\n"
|
||||||
separator = "\n* ",
|
} else {
|
||||||
) { it.trim() }
|
description += "\n\nAlternative Titles:\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
description += altNames.joinToString("\n") { "• ${it.trim()}" }
|
||||||
}
|
}
|
||||||
if (authors?.isNotEmpty() == true) {
|
if (authors?.isNotEmpty() == true) {
|
||||||
author = authors.first().trim()
|
author = authors.first().trim()
|
||||||
|
|
Loading…
Reference in New Issue