no dependenct on tachidesk

This commit is contained in:
Aria Moradi 2021-05-27 03:33:56 +04:30
parent 781428a690
commit 994ae97256
3 changed files with 37 additions and 3 deletions

View File

@ -38,10 +38,10 @@ import suwayomi.anime.impl.util.PackageTools.getSignatureHash
import suwayomi.anime.impl.util.PackageTools.loadExtensionSources
import suwayomi.anime.impl.util.PackageTools.trustedSignatures
import suwayomi.anime.model.table.AnimeExtensionTable
import suwayomi.anime.model.table.AnimeSourceTable
import suwayomi.server.ApplicationDirs
import suwayomi.tachidesk.impl.util.network.await
import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse
import suwayomi.tachidesk.model.table.SourceTable
import uy.kohesive.injekt.injectLazy
import java.io.File
import java.io.InputStream
@ -162,7 +162,7 @@ object Extension {
val extensionId = AnimeExtensionTable.select { AnimeExtensionTable.pkgName eq pkgName }.first()[AnimeExtensionTable.id].value
sources.forEach { httpSource ->
SourceTable.insert {
AnimeSourceTable.insert {
it[id] = httpSource.id
it[name] = httpSource.name
it[lang] = httpSource.lang
@ -201,7 +201,7 @@ object Extension {
transaction {
val extensionId = extensionRecord[AnimeExtensionTable.id].value
SourceTable.deleteWhere { SourceTable.extension eq extensionId }
AnimeSourceTable.deleteWhere { AnimeSourceTable.extension eq extensionId }
if (extensionRecord[AnimeExtensionTable.isObsolete])
AnimeExtensionTable.deleteWhere { AnimeExtensionTable.pkgName eq pkgName }
else

View File

@ -0,0 +1,16 @@
package suwayomi.anime.model.dataclass
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
data class AnimeSourceDataClass(
val id: String,
val name: String?,
val lang: String?,
val iconUrl: String?,
val supportsLatest: Boolean?
)

View File

@ -0,0 +1,18 @@
package suwayomi.anime.model.table
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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 org.jetbrains.exposed.dao.id.IdTable
object AnimeSourceTable : IdTable<Long>() {
override val id = long("id").entityId()
val name = varchar("name", 128)
val lang = varchar("lang", 10)
val extension = reference("extension", AnimeExtensionTable)
val partOfFactorySource = bool("part_of_factory_source").default(false)
}