From 25829aacfd1f70c5eee7e9ce8fa1bad870994ca0 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Fri, 28 May 2021 02:43:30 +0430 Subject: [PATCH] new anime library --- .../AnimeCatalogueSource.kt | 4 +- .../{source => animesource}/AnimeSource.kt | 6 +-- .../AnimeSourceFactory.kt | 2 +- .../AnimeSourceManager.kt | 8 ++-- .../ConfigurableAnimeSource.kt | 2 +- .../animesource/model/AnimeFilter.kt | 40 +++++++++++++++++++ .../animesource/model/AnimeFilterList.kt | 6 +++ .../model/AnimesPage.kt | 2 +- .../{source => animesource}/model/SAnime.kt | 2 +- .../model/SAnimeImpl.kt | 4 +- .../{source => animesource}/model/SEpisode.kt | 2 +- .../model/SEpisodeImpl.kt | 4 +- .../online/AnimeHttpSource.kt | 10 ++--- .../online/AnimeHttpSourceFetcher.kt | 1 + .../online/ParsedAnimeHttpSource.kt | 8 ++-- .../main/kotlin/suwayomi/anime/impl/Anime.kt | 2 +- .../kotlin/suwayomi/anime/impl/AnimeList.kt | 2 +- .../kotlin/suwayomi/anime/impl/Episode.kt | 4 +- .../anime/impl/extension/Extension.kt | 6 +-- .../extension/github/ExtensionGithubApi.kt | 7 ++-- .../anime/impl/util/GetAnimeHttpSource.kt | 6 +-- .../suwayomi/anime/impl/util/PackageTools.kt | 4 +- .../suwayomi/anime/model/table/AnimeTable.kt | 2 +- .../migration/M0005_AnimeTablesBatch2.kt | 2 +- .../extension/github/ExtensionGithubApi.kt | 5 +-- 25 files changed, 95 insertions(+), 46 deletions(-) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/AnimeCatalogueSource.kt (92%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/AnimeSource.kt (93%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/AnimeSourceFactory.kt (84%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/AnimeSourceManager.kt (91%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/ConfigurableAnimeSource.kt (80%) create mode 100644 server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt create mode 100644 server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilterList.kt rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/model/AnimesPage.kt (61%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/model/SAnime.kt (96%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/model/SAnimeImpl.kt (80%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/model/SEpisode.kt (91%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/model/SEpisodeImpl.kt (70%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/online/AnimeHttpSource.kt (97%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/online/AnimeHttpSourceFetcher.kt (93%) rename server/src/main/kotlin/eu/kanade/tachiyomi/{source => animesource}/online/ParsedAnimeHttpSource.kt (97%) diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeCatalogueSource.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeCatalogueSource.kt similarity index 92% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeCatalogueSource.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeCatalogueSource.kt index c932f90..ca312cd 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeCatalogueSource.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeCatalogueSource.kt @@ -1,6 +1,6 @@ -package eu.kanade.tachiyomi.source +package eu.kanade.tachiyomi.animesource -import eu.kanade.tachiyomi.source.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.AnimesPage import eu.kanade.tachiyomi.source.model.FilterList import rx.Observable diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSource.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSource.kt similarity index 93% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSource.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSource.kt index 3ca42de..3ac73ad 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSource.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSource.kt @@ -1,7 +1,7 @@ -package eu.kanade.tachiyomi.source +package eu.kanade.tachiyomi.animesource -import eu.kanade.tachiyomi.source.model.SAnime -import eu.kanade.tachiyomi.source.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode import rx.Observable /** diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceFactory.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceFactory.kt similarity index 84% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceFactory.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceFactory.kt index 72c0c96..ca5755b 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceFactory.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceFactory.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.source +package eu.kanade.tachiyomi.animesource /** * A factory for creating sources at runtime. diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceManager.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceManager.kt similarity index 91% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceManager.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceManager.kt index 2a2fbf3..9838e71 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/AnimeSourceManager.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSourceManager.kt @@ -1,9 +1,9 @@ -package eu.kanade.tachiyomi.source +package eu.kanade.tachiyomi.animesource import android.content.Context -import eu.kanade.tachiyomi.source.model.SAnime -import eu.kanade.tachiyomi.source.model.SEpisode -import eu.kanade.tachiyomi.source.online.AnimeHttpSource +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode +import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import rx.Observable open class AnimeSourceManager(private val context: Context) { diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/ConfigurableAnimeSource.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/ConfigurableAnimeSource.kt similarity index 80% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/ConfigurableAnimeSource.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/ConfigurableAnimeSource.kt index cdd2040..4358a7f 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/ConfigurableAnimeSource.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/ConfigurableAnimeSource.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.source +package eu.kanade.tachiyomi.animesource import android.support.v7.preference.PreferenceScreen diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt new file mode 100644 index 0000000..e19c2b7 --- /dev/null +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilter.kt @@ -0,0 +1,40 @@ +package eu.kanade.tachiyomi.animesource.model + +sealed class AnimeFilter(val name: String, var state: T) { + open class Header(name: String) : AnimeFilter(name, 0) + open class Separator(name: String = "") : AnimeFilter(name, 0) + abstract class Select(name: String, val values: Array, state: Int = 0) : AnimeFilter(name, state) + abstract class Text(name: String, state: String = "") : AnimeFilter(name, state) + abstract class CheckBox(name: String, state: Boolean = false) : AnimeFilter(name, state) + abstract class TriState(name: String, state: Int = STATE_IGNORE) : AnimeFilter(name, state) { + fun isIgnored() = state == STATE_IGNORE + fun isIncluded() = state == STATE_INCLUDE + fun isExcluded() = state == STATE_EXCLUDE + + companion object { + const val STATE_IGNORE = 0 + const val STATE_INCLUDE = 1 + const val STATE_EXCLUDE = 2 + } + } + + abstract class Group(name: String, state: List) : AnimeFilter>(name, state) + + abstract class Sort(name: String, val values: Array, state: Selection? = null) : + AnimeFilter(name, state) { + data class Selection(val index: Int, val ascending: Boolean) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is AnimeFilter<*>) return false + + return name == other.name && state == other.state + } + + override fun hashCode(): Int { + var result = name.hashCode() + result = 31 * result + (state?.hashCode() ?: 0) + return result + } +} diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilterList.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilterList.kt new file mode 100644 index 0000000..7747104 --- /dev/null +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeFilterList.kt @@ -0,0 +1,6 @@ +package eu.kanade.tachiyomi.animesource.model + +data class AnimeFilterList(val list: List>) : List> by list { + + constructor(vararg fs: AnimeFilter<*>) : this(if (fs.isNotEmpty()) fs.asList() else emptyList()) +} diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/AnimesPage.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimesPage.kt similarity index 61% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/model/AnimesPage.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimesPage.kt index f083eec..948b02e 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/AnimesPage.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimesPage.kt @@ -1,3 +1,3 @@ -package eu.kanade.tachiyomi.source.model +package eu.kanade.tachiyomi.animesource.model data class AnimesPage(val animes: List, val hasNextPage: Boolean) diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnime.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnime.kt similarity index 96% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnime.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnime.kt index d710775..15577f7 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnime.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnime.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.source.model +package eu.kanade.tachiyomi.animesource.model import java.io.Serializable diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnimeImpl.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnimeImpl.kt similarity index 80% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnimeImpl.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnimeImpl.kt index 2b47339..6e84f69 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SAnimeImpl.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SAnimeImpl.kt @@ -1,4 +1,6 @@ -package eu.kanade.tachiyomi.source.model +package eu.kanade.tachiyomi.animesource.model + +import eu.kanade.tachiyomi.animesource.model.SAnime class SAnimeImpl : SAnime { diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisode.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisode.kt similarity index 91% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisode.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisode.kt index 9bd4e0c..f1fac23 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisode.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisode.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.source.model +package eu.kanade.tachiyomi.animesource.model import java.io.Serializable diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisodeImpl.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisodeImpl.kt similarity index 70% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisodeImpl.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisodeImpl.kt index 3e4f53d..6503711 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/model/SEpisodeImpl.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/SEpisodeImpl.kt @@ -1,4 +1,6 @@ -package eu.kanade.tachiyomi.source.model +package eu.kanade.tachiyomi.animesource.model + +import eu.kanade.tachiyomi.animesource.model.SEpisode class SEpisodeImpl : SEpisode { diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSource.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSource.kt similarity index 97% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSource.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSource.kt index d4af126..960401f 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSource.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSource.kt @@ -1,15 +1,15 @@ -package eu.kanade.tachiyomi.source.online +package eu.kanade.tachiyomi.animesource.online +import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource +import eu.kanade.tachiyomi.animesource.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.newCallWithProgress -import eu.kanade.tachiyomi.source.AnimeCatalogueSource -import eu.kanade.tachiyomi.source.model.AnimesPage import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page -import eu.kanade.tachiyomi.source.model.SAnime -import eu.kanade.tachiyomi.source.model.SEpisode import okhttp3.Headers import okhttp3.OkHttpClient import okhttp3.Request diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSourceFetcher.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSourceFetcher.kt similarity index 93% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSourceFetcher.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSourceFetcher.kt index 71ffef7..a3f3dd4 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/AnimeHttpSourceFetcher.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/AnimeHttpSourceFetcher.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.source.online +import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import eu.kanade.tachiyomi.source.model.Page import rx.Observable diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/ParsedAnimeHttpSource.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/ParsedAnimeHttpSource.kt similarity index 97% rename from server/src/main/kotlin/eu/kanade/tachiyomi/source/online/ParsedAnimeHttpSource.kt rename to server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/ParsedAnimeHttpSource.kt index e773124..583df8b 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/source/online/ParsedAnimeHttpSource.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/animesource/online/ParsedAnimeHttpSource.kt @@ -1,9 +1,9 @@ -package eu.kanade.tachiyomi.source.online +package eu.kanade.tachiyomi.animesource.online -import eu.kanade.tachiyomi.source.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.AnimesPage import eu.kanade.tachiyomi.source.model.Page -import eu.kanade.tachiyomi.source.model.SAnime -import eu.kanade.tachiyomi.source.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode import eu.kanade.tachiyomi.util.asJsoup import okhttp3.Response import org.jsoup.nodes.Document diff --git a/server/src/main/kotlin/suwayomi/anime/impl/Anime.kt b/server/src/main/kotlin/suwayomi/anime/impl/Anime.kt index 13db967..6f92a7a 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/Anime.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/Anime.kt @@ -8,7 +8,7 @@ package suwayomi.anime.impl * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.source.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SAnime import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update diff --git a/server/src/main/kotlin/suwayomi/anime/impl/AnimeList.kt b/server/src/main/kotlin/suwayomi/anime/impl/AnimeList.kt index 36faaa3..627c8e3 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/AnimeList.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/AnimeList.kt @@ -7,7 +7,7 @@ package suwayomi.anime.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import eu.kanade.tachiyomi.source.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.AnimesPage import org.jetbrains.exposed.sql.insertAndGetId import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction diff --git a/server/src/main/kotlin/suwayomi/anime/impl/Episode.kt b/server/src/main/kotlin/suwayomi/anime/impl/Episode.kt index ab22a79..62e5140 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/Episode.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/Episode.kt @@ -7,8 +7,8 @@ package suwayomi.anime.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import eu.kanade.tachiyomi.source.model.SAnime -import eu.kanade.tachiyomi.source.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode import org.jetbrains.exposed.sql.SortOrder.DESC import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.deleteWhere diff --git a/server/src/main/kotlin/suwayomi/anime/impl/extension/Extension.kt b/server/src/main/kotlin/suwayomi/anime/impl/extension/Extension.kt index f02cc89..cab7584 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/extension/Extension.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/extension/Extension.kt @@ -10,9 +10,9 @@ package suwayomi.anime.impl.extension import android.net.Uri import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper -import eu.kanade.tachiyomi.source.AnimeCatalogueSource -import eu.kanade.tachiyomi.source.AnimeSource -import eu.kanade.tachiyomi.source.AnimeSourceFactory +import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource +import eu.kanade.tachiyomi.animesource.AnimeSource +import eu.kanade.tachiyomi.animesource.AnimeSourceFactory import mu.KotlinLogging import okhttp3.Request import okio.buffer diff --git a/server/src/main/kotlin/suwayomi/anime/impl/extension/github/ExtensionGithubApi.kt b/server/src/main/kotlin/suwayomi/anime/impl/extension/github/ExtensionGithubApi.kt index aeed1d3..043a821 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/extension/github/ExtensionGithubApi.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/extension/github/ExtensionGithubApi.kt @@ -13,6 +13,8 @@ import com.google.gson.JsonArray import com.google.gson.JsonParser import eu.kanade.tachiyomi.network.NetworkHelper import okhttp3.Request +import suwayomi.anime.impl.util.PackageTools.LIB_VERSION_MAX +import suwayomi.anime.impl.util.PackageTools.LIB_VERSION_MIN import suwayomi.anime.model.dataclass.AnimeExtensionDataClass import suwayomi.tachidesk.impl.util.network.UnzippingInterceptor import uy.kohesive.injekt.injectLazy @@ -21,15 +23,12 @@ object ExtensionGithubApi { const val BASE_URL = "https://raw.githubusercontent.com" const val REPO_URL_PREFIX = "$BASE_URL/jmir1/tachiyomi-extensions/repo" - private const val LIB_VERSION_MIN = 1.3 - private const val LIB_VERSION_MAX = 1.3 - private fun parseResponse(json: JsonArray): List { return json .map { it.asJsonObject } .filter { element -> val versionName = element["version"].string - val libVersion = versionName.substringBeforeLast('.').toDouble() + val libVersion = versionName.substringBeforeLast('.').toInt() libVersion in LIB_VERSION_MIN..LIB_VERSION_MAX } .map { element -> diff --git a/server/src/main/kotlin/suwayomi/anime/impl/util/GetAnimeHttpSource.kt b/server/src/main/kotlin/suwayomi/anime/impl/util/GetAnimeHttpSource.kt index 6889df5..f3bf58e 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/util/GetAnimeHttpSource.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/util/GetAnimeHttpSource.kt @@ -7,9 +7,9 @@ package suwayomi.anime.impl.util * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import eu.kanade.tachiyomi.source.AnimeSource -import eu.kanade.tachiyomi.source.AnimeSourceFactory -import eu.kanade.tachiyomi.source.online.AnimeHttpSource +import eu.kanade.tachiyomi.animesource.AnimeSource +import eu.kanade.tachiyomi.animesource.AnimeSourceFactory +import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.kodein.di.DI diff --git a/server/src/main/kotlin/suwayomi/anime/impl/util/PackageTools.kt b/server/src/main/kotlin/suwayomi/anime/impl/util/PackageTools.kt index 433db01..01bf36a 100644 --- a/server/src/main/kotlin/suwayomi/anime/impl/util/PackageTools.kt +++ b/server/src/main/kotlin/suwayomi/anime/impl/util/PackageTools.kt @@ -40,8 +40,8 @@ object PackageTools { const val METADATA_SOURCE_CLASS = "tachiyomi.animeextension.class" const val METADATA_SOURCE_FACTORY = "tachiyomi.animeextension.factory" const val METADATA_NSFW = "tachiyomi.animeextension.nsfw" - const val LIB_VERSION_MIN = 1.3 - const val LIB_VERSION_MAX = 1.3 + const val LIB_VERSION_MIN = 10 + const val LIB_VERSION_MAX = 10 private const val officialSignature = "50ab1d1e3a20d204d0ad6d334c7691c632e41b98dfa132bf385695fdfa63839c" // jmir1's key var trustedSignatures = mutableSetOf() + officialSignature diff --git a/server/src/main/kotlin/suwayomi/anime/model/table/AnimeTable.kt b/server/src/main/kotlin/suwayomi/anime/model/table/AnimeTable.kt index 2faa3c6..fbfd7a2 100644 --- a/server/src/main/kotlin/suwayomi/anime/model/table/AnimeTable.kt +++ b/server/src/main/kotlin/suwayomi/anime/model/table/AnimeTable.kt @@ -7,7 +7,7 @@ package suwayomi.anime.model.table * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import eu.kanade.tachiyomi.source.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SAnime import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow import suwayomi.tachidesk.impl.MangaList.proxyThumbnailUrl diff --git a/server/src/main/kotlin/suwayomi/server/database/migration/M0005_AnimeTablesBatch2.kt b/server/src/main/kotlin/suwayomi/server/database/migration/M0005_AnimeTablesBatch2.kt index a5321a2..9169cf3 100644 --- a/server/src/main/kotlin/suwayomi/server/database/migration/M0005_AnimeTablesBatch2.kt +++ b/server/src/main/kotlin/suwayomi/server/database/migration/M0005_AnimeTablesBatch2.kt @@ -1,6 +1,6 @@ package suwayomi.server.database.migration -import eu.kanade.tachiyomi.source.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SAnime import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.SchemaUtils import org.jetbrains.exposed.sql.transactions.transaction diff --git a/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt index 1439cb9..98fb6e5 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt @@ -13,6 +13,8 @@ import com.google.gson.JsonArray import com.google.gson.JsonParser import eu.kanade.tachiyomi.network.NetworkHelper import okhttp3.Request +import suwayomi.tachidesk.impl.util.PackageTools.LIB_VERSION_MAX +import suwayomi.tachidesk.impl.util.PackageTools.LIB_VERSION_MIN import suwayomi.tachidesk.impl.util.network.UnzippingInterceptor import suwayomi.tachidesk.model.dataclass.ExtensionDataClass import uy.kohesive.injekt.injectLazy @@ -21,9 +23,6 @@ object ExtensionGithubApi { const val BASE_URL = "https://raw.githubusercontent.com" const val REPO_URL_PREFIX = "$BASE_URL/tachiyomiorg/tachiyomi-extensions/repo" - private const val LIB_VERSION_MIN = 1.2 - private const val LIB_VERSION_MAX = 1.2 - private fun parseResponse(json: JsonArray): List { return json .map { it.asJsonObject }