mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-21 03:33:32 -05:00
Extension API 1.6 (#2120)
* Non-Extension Index changes for 1.6 * Changelog * Minor fixes * Implement extension store * Test build fix * Docs * Simplify fetching manga and chapters * Use EMPTY JsonObject * Update docs/Configuring-Suwayomi‐Server.md Co-authored-by: Constantin Piber <59023762+cpiber@users.noreply.github.com> * Improve Fetch Extension Store * Fixes * Simplify deprecated isNsfw in SourceQuery * Simplify ContentRating in Source.kt * Simplify isNsfw in SourceType * No magic numbers for ContentRating, improves safety for future versions of extension api * Fix SearchTest * Lint * Lint * Optimize imports and fix unchecked cast warning * Proper extension store queries * Optimize import fixes * Add ContentRatingFilter * Improve extension store sync * fix: re-sync (#2121) * Lint * Add ExtenionStores to the fetchExtensions result since its possible for the stores to change. * Use a single version of ContentRating * Exclude ServerConfig.extensionStores from GraphQL * Use syncDbToPrefs in ExtensionStoreMutation * Optimize Imports * Update server/server-config/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt Co-authored-by: Constantin Piber <59023762+cpiber@users.noreply.github.com> * Remove replaceWith and add specific description for GQL APIs * Include OkHttp ZSTD * Update to latest Mihon extension lib * Fix latest Mihon Extension Lib * Lint * Optimize imports * Lint * Review fixes * Add a index to extesnion table store url * Lint --------- Co-authored-by: Constantin Piber <59023762+cpiber@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package suwayomi.tachidesk.opds.impl
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import org.jetbrains.exposed.v1.core.SortOrder
|
||||
import suwayomi.tachidesk.i18n.MR
|
||||
import suwayomi.tachidesk.manga.impl.Manga
|
||||
import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl
|
||||
import suwayomi.tachidesk.manga.model.table.ChapterTable
|
||||
import suwayomi.tachidesk.opds.constants.OpdsConstants
|
||||
@@ -17,7 +18,6 @@ import suwayomi.tachidesk.opds.repository.ChapterRepository
|
||||
import suwayomi.tachidesk.opds.repository.MangaRepository
|
||||
import suwayomi.tachidesk.opds.repository.NavigationRepository
|
||||
import suwayomi.tachidesk.opds.util.OpdsDateUtil
|
||||
import suwayomi.tachidesk.opds.util.OpdsStringUtil
|
||||
import suwayomi.tachidesk.opds.util.OpdsXmlUtil
|
||||
import suwayomi.tachidesk.server.serverConfig
|
||||
import java.util.Locale
|
||||
@@ -657,8 +657,7 @@ object OpdsFeedBuilder {
|
||||
// If no chapters are found in the database, attempt to fetch them from the source.
|
||||
if (chapterEntries.isEmpty() && totalChapters == 0L) {
|
||||
try {
|
||||
suwayomi.tachidesk.manga.impl.Chapter
|
||||
.fetchChapterList(mangaId)
|
||||
Manga.updateMangaAndChapters(mangaId, updateManga = false)
|
||||
|
||||
// Re-query after fetching.
|
||||
val (refetchedChapters, refetchedTotal) =
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.jetbrains.exposed.v1.core.SortOrder
|
||||
import org.jetbrains.exposed.v1.core.alias
|
||||
import org.jetbrains.exposed.v1.core.and
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.greater
|
||||
import org.jetbrains.exposed.v1.core.inList
|
||||
import org.jetbrains.exposed.v1.core.inSubQuery
|
||||
import org.jetbrains.exposed.v1.core.intLiteral
|
||||
|
||||
@@ -4,7 +4,6 @@ import dev.icerock.moko.resources.StringResource
|
||||
import org.jetbrains.exposed.v1.core.JoinType
|
||||
import org.jetbrains.exposed.v1.core.SortOrder
|
||||
import org.jetbrains.exposed.v1.core.alias
|
||||
import org.jetbrains.exposed.v1.core.count
|
||||
import org.jetbrains.exposed.v1.core.countDistinct
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.jdbc.select
|
||||
@@ -138,9 +137,9 @@ object NavigationRepository {
|
||||
val query =
|
||||
SourceTable
|
||||
.join(ExtensionTable, JoinType.LEFT, onColumn = SourceTable.extension, otherColumn = ExtensionTable.id)
|
||||
.select(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.apkName)
|
||||
.select(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.pkgName)
|
||||
.where { ExtensionTable.isInstalled eq true }
|
||||
.groupBy(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.apkName)
|
||||
.groupBy(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.pkgName)
|
||||
.orderBy(SourceTable.name to SortOrder.ASC)
|
||||
|
||||
val totalCount = query.count()
|
||||
@@ -152,7 +151,7 @@ object NavigationRepository {
|
||||
OpdsSourceNavEntry(
|
||||
id = it[SourceTable.id].value,
|
||||
name = formatSourceName(it[SourceTable.name], it[SourceTable.lang]),
|
||||
iconUrl = it[ExtensionTable.apkName].let { apkName -> Extension.getExtensionIconUrl(apkName) },
|
||||
iconUrl = it[ExtensionTable.pkgName].let { pkgName -> Extension.proxyExtensionIconUrl(pkgName) },
|
||||
mangaCount = null,
|
||||
)
|
||||
}
|
||||
@@ -177,13 +176,13 @@ object NavigationRepository {
|
||||
|
||||
val query =
|
||||
baseJoin
|
||||
.select(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.apkName, mangaCount)
|
||||
.select(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.pkgName, mangaCount)
|
||||
.where { MangaTable.inLibrary eq true }
|
||||
|
||||
query.applyOpdsMangaFilter(activeFilters, excludeField = "source_id")
|
||||
|
||||
query
|
||||
.groupBy(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.apkName)
|
||||
.groupBy(SourceTable.id, SourceTable.name, SourceTable.lang, ExtensionTable.pkgName)
|
||||
.orderBy(SourceTable.name to SortOrder.ASC)
|
||||
|
||||
val totalCount = query.count()
|
||||
@@ -199,7 +198,7 @@ object NavigationRepository {
|
||||
OpdsSourceNavEntry(
|
||||
id = it[SourceTable.id].value,
|
||||
name = formatSourceName(it[SourceTable.name], it[SourceTable.lang]),
|
||||
iconUrl = it[ExtensionTable.apkName].let { apkName -> Extension.getExtensionIconUrl(apkName) },
|
||||
iconUrl = it[ExtensionTable.pkgName].let { pkgName -> Extension.proxyExtensionIconUrl(pkgName) },
|
||||
mangaCount = it[mangaCount],
|
||||
)
|
||||
}
|
||||
@@ -210,12 +209,12 @@ object NavigationRepository {
|
||||
transaction {
|
||||
SourceTable
|
||||
.join(ExtensionTable, JoinType.LEFT, onColumn = SourceTable.extension, otherColumn = ExtensionTable.id)
|
||||
.select(SourceTable.name, SourceTable.lang, ExtensionTable.apkName)
|
||||
.select(SourceTable.name, SourceTable.lang, ExtensionTable.pkgName)
|
||||
.where { SourceTable.id eq sourceId }
|
||||
.firstOrNull()
|
||||
?.let {
|
||||
val name = formatSourceName(it[SourceTable.name], it[SourceTable.lang])
|
||||
val icon = Extension.getExtensionIconUrl(it[ExtensionTable.apkName])
|
||||
val icon = Extension.proxyExtensionIconUrl(it[ExtensionTable.pkgName])
|
||||
Pair(name, icon)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user