mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 09:24:34 -05:00
Compare commits
4 Commits
4ace76f508
...
70a027f6f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70a027f6f0 | ||
|
|
650c075723 | ||
|
|
a69e29d1a5 | ||
|
|
eec0951a75 |
@@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import okhttp3.Cache
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.brotli.BrotliInterceptor
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
||||
import java.net.CookieHandler
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.greater
|
||||
import org.jetbrains.exposed.v1.core.greaterEq
|
||||
import org.jetbrains.exposed.v1.core.less
|
||||
import org.jetbrains.exposed.v1.core.neq
|
||||
import org.jetbrains.exposed.v1.jdbc.selectAll
|
||||
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
|
||||
import suwayomi.tachidesk.graphql.directives.RequireAuth
|
||||
|
||||
@@ -45,7 +45,6 @@ import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse.clearCachedImage
|
||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse.getImageResponse
|
||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse.saveImage
|
||||
import suwayomi.tachidesk.manga.model.dataclass.ContentWarning
|
||||
import suwayomi.tachidesk.manga.model.table.ExtensionTable
|
||||
import suwayomi.tachidesk.manga.model.table.SourceTable
|
||||
import suwayomi.tachidesk.server.ApplicationDirs
|
||||
|
||||
@@ -45,7 +45,8 @@ data class NetworkExtensionStore(
|
||||
@ProtoNumber(4) val extensionLib: String,
|
||||
@ProtoNumber(5) val versionCode: Long,
|
||||
@ProtoNumber(6) val versionName: String,
|
||||
@ProtoNumber(7) val sources: List<Source>,
|
||||
@ProtoNumber(7) val contentWarning: ContentWarning,
|
||||
@ProtoNumber(8) val sources: List<Source>,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@@ -61,21 +62,25 @@ data class NetworkExtensionStore(
|
||||
@ProtoNumber(3) val language: String,
|
||||
@ProtoNumber(4) val homeUrl: String = "",
|
||||
@ProtoNumber(5) val mirrorUrls: List<String> = emptyList(),
|
||||
@ProtoNumber(6) val contentWarning: ContentWarning = ContentWarning.SAFE,
|
||||
// @ProtoNumber(6) val contentWarning: ContentWarning = ContentWarning.SAFE,
|
||||
@ProtoNumber(7) val message: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
enum class ContentWarning {
|
||||
@ProtoNumber(0)
|
||||
@JsonNames("CONTENT_WARNING_UNSPECIFIED")
|
||||
UNSPECIFIED,
|
||||
|
||||
@ProtoNumber(1)
|
||||
@JsonNames("CONTENT_WARNING_SAFE")
|
||||
SAFE,
|
||||
|
||||
@ProtoNumber(1)
|
||||
@ProtoNumber(2)
|
||||
@JsonNames("CONTENT_WARNING_MIXED")
|
||||
MIXED,
|
||||
|
||||
@ProtoNumber(2)
|
||||
@ProtoNumber(3)
|
||||
@JsonNames("CONTENT_WARNING_NSFW")
|
||||
NSFW,
|
||||
}
|
||||
@@ -110,11 +115,14 @@ fun NetworkExtensionStore.ExtensionList.toExtensionInfos(store: ExtensionStore):
|
||||
versionName = extension.versionName,
|
||||
lang = if (lang.size == 1) lang.first() else "all",
|
||||
contentWarning =
|
||||
when (extension.sources.maxOfOrNull { it.contentWarning }) {
|
||||
NetworkExtensionStore.ContentWarning.SAFE -> ContentWarning.SAFE
|
||||
when (extension.contentWarning) {
|
||||
NetworkExtensionStore.ContentWarning.SAFE,
|
||||
NetworkExtensionStore.ContentWarning.UNSPECIFIED,
|
||||
-> ContentWarning.SAFE
|
||||
|
||||
NetworkExtensionStore.ContentWarning.MIXED -> ContentWarning.MIXED
|
||||
|
||||
NetworkExtensionStore.ContentWarning.NSFW -> ContentWarning.NSFW
|
||||
null -> ContentWarning.SAFE
|
||||
},
|
||||
sources =
|
||||
extension.sources.map { source ->
|
||||
@@ -125,9 +133,13 @@ fun NetworkExtensionStore.ExtensionList.toExtensionInfos(store: ExtensionStore):
|
||||
homeUrl = source.homeUrl,
|
||||
message = source.message,
|
||||
contentWarning =
|
||||
when (source.contentWarning) {
|
||||
NetworkExtensionStore.ContentWarning.SAFE -> ContentWarning.SAFE
|
||||
when (extension.contentWarning) { // todo source.contentWarning
|
||||
NetworkExtensionStore.ContentWarning.SAFE,
|
||||
NetworkExtensionStore.ContentWarning.UNSPECIFIED,
|
||||
-> ContentWarning.SAFE
|
||||
|
||||
NetworkExtensionStore.ContentWarning.MIXED -> ContentWarning.MIXED
|
||||
|
||||
NetworkExtensionStore.ContentWarning.NSFW -> ContentWarning.NSFW
|
||||
},
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user