Compare commits

..

4 Commits

Author SHA1 Message Date
Syer10
5561761020 Remove asDataFetcherResult 2026-05-10 12:32:24 -04:00
Syer10
a210153ed1 Fixes 2026-05-09 15:41:21 -04:00
Syer10
b40447c4f9 Update to the v10 alpha due to nullability issues in v9 2026-05-09 15:29:34 -04:00
renovate[bot]
193dd1ee84 Update graphqlkotlin to v9 2026-05-09 18:54:15 +00:00
134 changed files with 798 additions and 1312 deletions

View File

@@ -67,7 +67,7 @@ jobs:
export LD_PRELOAD="$(pwd)/scripts/resources/catch_abort.so" export LD_PRELOAD="$(pwd)/scripts/resources/catch_abort.so"
JAR=$(ls ./server/build/*.jar| head -1) JAR=$(ls ./server/build/*.jar| head -1)
set +e set +e
timeout 30s java \ timeout 30s java -DcrashOnFailedMigration=true \
-Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \ -Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \
-Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \ -Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \
-Dsuwayomi.tachidesk.config.server.databaseType=POSTGRESQL \ -Dsuwayomi.tachidesk.config.server.databaseType=POSTGRESQL \
@@ -83,7 +83,7 @@ jobs:
exit "$ecode" exit "$ecode"
fi fi
timeout 30s java \ timeout 30s java -DcrashOnFailedMigration=true \
-Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \ -Dsuwayomi.tachidesk.config.server.systemTrayEnabled=false \
-Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \ -Dsuwayomi.tachidesk.config.server.initialOpenInBrowserEnabled=false \
-jar "$JAR" -jar "$JAR"

View File

@@ -1,7 +1,6 @@
name: GitHub Wiki upload name: GitHub Wiki upload
on: on:
workflow_dispatch:
push: push:
branches: branches:
- master - master

View File

@@ -9,9 +9,6 @@ package xyz.nulldev.androidcompat.util
// adopted from: https://github.com/tachiyomiorg/tachiyomi/blob/4cefbce7c34e724b409b6ba127f3c6c5c346ad8d/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt // adopted from: https://github.com/tachiyomiorg/tachiyomi/blob/4cefbce7c34e724b409b6ba127f3c6c5c346ad8d/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt
object SafePath { object SafePath {
private const val MAX_FILENAME_CHARS = 240
private const val MAX_FILENAME_UTF8_BYTES = 240
/** /**
* Mutate the given filename to make it valid for a FAT filesystem, * Mutate the given filename to make it valid for a FAT filesystem,
* replacing any invalid characters with "_". This method doesn't allow hidden files (starting * replacing any invalid characters with "_". This method doesn't allow hidden files (starting
@@ -30,39 +27,9 @@ object SafePath {
sb.append('_') sb.append('_')
} }
} }
// Even though vfat allows 255 UCS-2 chars, we might eventually write to
return truncateFilename(sb.toString()) // ext4 through a FUSE layer, so use that limit minus 15 reserved characters.
} return sb.toString().take(240)
private fun truncateFilename(filename: String): String {
// Keep a safety margin under common filesystem limits and satisfy both
// character count and UTF-8 byte-length constraints.
val output = StringBuilder(minOf(filename.length, MAX_FILENAME_CHARS))
var usedBytes = 0
var index = 0
while (index < filename.length && output.length < MAX_FILENAME_CHARS) {
val codePoint = Character.codePointAt(filename, index)
val codePointBytes = utf8ByteCount(codePoint)
if (usedBytes + codePointBytes > MAX_FILENAME_UTF8_BYTES) {
break
}
output.appendCodePoint(codePoint)
usedBytes += codePointBytes
index += Character.charCount(codePoint)
}
return output.toString()
}
private fun utf8ByteCount(codePoint: Int): Int =
when {
codePoint <= 0x7f -> 1
codePoint <= 0x7ff -> 2
codePoint <= 0xffff -> 3
else -> 4
} }
/** /**

View File

@@ -55,6 +55,7 @@ import dev.datlag.kcef.KCEF
import dev.datlag.kcef.KCEFBrowser import dev.datlag.kcef.KCEFBrowser
import dev.datlag.kcef.KCEFClient import dev.datlag.kcef.KCEFClient
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.cef.CefSettings import org.cef.CefSettings
import org.cef.browser.CefBrowser import org.cef.browser.CefBrowser
@@ -87,6 +88,7 @@ import java.io.BufferedWriter
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.concurrent.Executor import java.util.concurrent.Executor
import kotlin.collections.Map
import kotlin.reflect.KClass import kotlin.reflect.KClass
import kotlin.reflect.KFunction import kotlin.reflect.KFunction
import kotlin.reflect.full.declaredMemberFunctions import kotlin.reflect.full.declaredMemberFunctions

View File

@@ -10,18 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- . - .
### Changed ### Changed
- (Database/H2) Use the latest H2 database engine - .
- (Startup) Crash on startup if an unrecoverable error happens
### Fixed ### Fixed
- (**CloudFlareInterceptor**) Don't send the `cf_clearance` cookie back to Flaresolverr - (WebUI) Handle serving non-default webui with "bundled"
- (**WebUI**) Handle serving non-default webui with "bundled"
- (**WebUI**) Wait until WebUI is ready to open in browser
- (**Downloads**) Truncate filenames by byte length to prevent "File name too long" IO errors
- (**Extension**) Do not indicate an update is available when the extension is not installed
- (**Chapter**) Fix losing chapter data on failed chapter list update
- (**Chapter**) Fix database error when fetching chapter updates
- (**Manga/API**) Fix "mangas" graphql query with active sorting and using a postgresql database (QUERY "mangas")
## [v2.2.2100] + [WebUI: v20260508.01] - 2026-05-08 ## [v2.2.2100] + [WebUI: v20260508.01] - 2026-05-08

View File

@@ -1,69 +1,19 @@
# Troubleshooting
This page is laid out in several sections, where each section describes a specific problem, followed by one or more possible solutions.
At the end, you will find a General section, which is the nuclear option if nothing else works.
For further support, visit the [official Suwayomi Discord server](https://discord.gg/DDZdqZWaHA).
In such cases, it will be helpful to have logs ready. You can find them in [The Data Directory](./The-Data-Directory) in the logs directory.
**All steps below assume that you have stopped Suwayomi**.
## Broken database
- `failed due to
org.jetbrains.exposed.exceptions.ExposedSQLException: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "CATEGORY.SORT_ORDER" not found`
- `org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "CHAPTER.KOREADER_HASH" not found`
- `java.lang.IllegalStateException: Unable to read the page at position 96170708817765466`
- Any other error text that includes "SQL Statement"
Your database is either corrupted or incompatible.
One of these is the cause:
- You were running a preview version and decided to downgrade to stable.
- You did not shut down Suwayomi properly.
- Suwayomi crashed in an unexpected way.
Solutions:
- If you downgraded, upgrade to preview again.
- Otherwise, you will need to reset and restore from a backup. See [General Troubleshooting](#general-troubleshooting) below.
## `HTTP error 429`
The source (or, if trackers are enabled, possibly the tracker) has blocked you for sending too many requests.
Note that Mass-Migration can result in an unexpectedly high number of requests to both the source and any configured trackers.
Solution: Use other/more sources, download less, and wait between request-heavy actions.
## Extension times out
- `Timed out waiting for 20000 ms…`
- `Timed out waiting for page list`
First, check if this is an extension issue or a Suwayomi issue.
On the manga page of the problematic entry, click "Open in WebView".
Solutions:
- If the WebView loads: The issue is with the extension. Search [the issues](https://github.com/Suwayomi/Suwayomi-Server/issues) and discord if there are known problems with that extension.
- If the WebView errors: Go to [The Data Directory](./The-Data-Directory) and remove the `bin` and `cache` folders.
- If the WebView still does not work after a restart, your installation is incomplete. On Linux, refer to [the README](https://github.com/Suwayomi/Suwayomi-Server#webview-support-gnulinux).
## General Troubleshooting ## General Troubleshooting
This guide will try to fix Suwayomi by reseting it to a clean installation state. This guide will try to fix Suwayomi by reseting it to a clean installation state.
> [!WARNING]
> This will remove all your data, including the library.
> Make sure you have copied your backups as described above!
- Make sure you have a recent backup of your library or create one in the app (if possible) because we **are going to wipe all Suwayomi data**. - Make sure you have a recent backup of your library or create one in the app (if possible) because we **are going to wipe all Suwayomi data**.
- Make sure Suwayomi is not running (right click on tray icon and quit or kill it through the way your Operating System provides) - Make sure Suwayomi is not running (right click on tray icon and quit or kill it through the way your Operating System provides)
- Clear all browsing data on your browser if you use Suwayomi from a browser. - Clear all browsing data on your browser if you use Suwayomi from a browser.
- Delete the Suwayomi data directory located below and re-run the app. See the article [The Data Directory](./The-Data-Directory) for information on how to find it. - Delete the Suwayomi data directory located below and re-run the app.
- If you wish to keep your downloads, you may also attempt to surgically remove only parts. You will need to remove `database.mv.db`, `database.trace.db`, `bin`, `cache`, `extensions`, `settings`, `webUI`. Removing only a subset of these files and folders may fail to resolve the problem.
- Open Suwayomi and go to Settings > Backup > Restore Backup, and select the latest backup you have. Note: Replace `<Account>` with the currently logged in account/username on your pc.
- Restoring from backup does not restore your downloads. If you chose to keep them in the above step, you will now need to re-download all manga. Suwayomi will pick up on the existing files and not actually download anything that isn't new.
On Mac OS X : `/Users/<Account>/Library/Application Support/Tachidesk`
On Windows XP : `C:\Documents and Settings\<Account>\Application Data\Local Settings\Tachidesk`
On Windows 7 and later : `C:\Users\<Account>\AppData\Local\Tachidesk`
On Unix/Linux : `/home/<account>/.local/share/Tachidesk`
- In the case that you have to periodically perform this fix or the problem persists or the method failed to fix it, open an issue or Join the [Suwayomi discord server](https://discord.gg/DDZdqZWaHA) to hang out with the community and to receive support and help. - In the case that you have to periodically perform this fix or the problem persists or the method failed to fix it, open an issue or Join the [Suwayomi discord server](https://discord.gg/DDZdqZWaHA) to hang out with the community and to receive support and help.

View File

@@ -4,10 +4,10 @@ coroutines = "1.11.0"
serialization = "1.11.0" serialization = "1.11.0"
jvmTarget = "21" jvmTarget = "21"
okhttp = "5.3.2" # Major version is locked by Tachiyomi extensions okhttp = "5.3.2" # Major version is locked by Tachiyomi extensions
javalin = "7.2.2" javalin = "7.2.0"
jte = "3.2.4" jte = "3.2.4"
jackson = "3.1.3" # jackson version locked by javalin, ref: `io.javalin.core.util.OptionalDependency` jackson = "3.1.2" # jackson version locked by javalin, ref: `io.javalin.core.util.OptionalDependency`
exposed = "1.2.0" exposed = "0.61.0"
dex2jar = "2.4.36" dex2jar = "2.4.36"
polyglot = "25.0.3" polyglot = "25.0.3"
settings = "1.3.0" settings = "1.3.0"
@@ -37,7 +37,7 @@ serialization-xml-core = { module = "io.github.pdvrieze.xmlutil:core", version.r
serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization-jvm", version.ref = "xmlserialization" } serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization-jvm", version.ref = "xmlserialization" }
# Logging # Logging
slf4japi = "org.slf4j:slf4j-api:2.0.18" slf4japi = "org.slf4j:slf4j-api:2.0.17"
logback = "ch.qos.logback:logback-classic:1.5.32" logback = "ch.qos.logback:logback-classic:1.5.32"
kotlinlogging = "io.github.oshai:kotlin-logging-jvm:8.0.02" kotlinlogging = "io.github.oshai:kotlin-logging-jvm:8.0.02"
@@ -54,7 +54,7 @@ javalin-openapi = { module = "io.javalin:javalin-openapi", version.ref = "javali
javalin-rendering = { module = "io.javalin:javalin-rendering-jte", version.ref = "javalin" } javalin-rendering = { module = "io.javalin:javalin-rendering-jte", version.ref = "javalin" }
jackson-databind = { module = "tools.jackson.core:jackson-databind", version.ref = "jackson" } jackson-databind = { module = "tools.jackson.core:jackson-databind", version.ref = "jackson" }
jackson-kotlin = { module = "tools.jackson.module:jackson-module-kotlin", version.ref = "jackson" } jackson-kotlin = { module = "tools.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
jackson-annotations = "com.fasterxml.jackson.core:jackson-annotations:2.21" jackson-annotations = "com.fasterxml.jackson.core:jackson-annotations:2.20"
jte = { module = "gg.jte:jte", version.ref = "jte" } jte = { module = "gg.jte:jte", version.ref = "jte" }
kte = { module = "gg.jte:jte-kotlin", version.ref = "jte" } kte = { module = "gg.jte:jte-kotlin", version.ref = "jte" }
@@ -68,13 +68,12 @@ exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "e
exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" } exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" }
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" } exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
exposed-javatime = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" } exposed-javatime = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" }
exposed-kotlintime = { module = "org.jetbrains.exposed:exposed-kotlin-datetime", version.ref = "exposed" }
postgres = "org.postgresql:postgresql:42.7.11" postgres = "org.postgresql:postgresql:42.7.11"
h2 = "com.h2database:h2:2.4.240" h2 = "com.h2database:h2:1.4.200" # current database driver, can't update to h2 v2 without sql migration
hikaricp = "com.zaxxer:HikariCP:7.0.2" hikaricp = "com.zaxxer:HikariCP:7.0.2"
# Exposed Migrations # Exposed Migrations
exposed-migrations = "com.github.Suwayomi:exposed-migrations:3.10.1" exposed-migrations = "com.github.Suwayomi:exposed-migrations:3.8.0"
# Dependency Injection # Dependency Injection
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
@@ -116,7 +115,7 @@ appdirs = "ca.gosyer:kotlin-multiplatform-appdirs:2.0.0"
cache4k = "io.github.reactivecircus.cache4k:cache4k:0.14.0" cache4k = "io.github.reactivecircus.cache4k:cache4k:0.14.0"
zip4j = "net.lingala.zip4j:zip4j:2.11.6" zip4j = "net.lingala.zip4j:zip4j:2.11.6"
commonscompress = "org.apache.commons:commons-compress:1.28.0" commonscompress = "org.apache.commons:commons-compress:1.28.0"
junrar = "com.github.junrar:junrar:7.6.0" junrar = "com.github.junrar:junrar:7.5.10"
# AES/CBC/PKCS7Padding Cypher provider # AES/CBC/PKCS7Padding Cypher provider
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.84" bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.84"
@@ -243,7 +242,6 @@ exposed = [
"exposed-dao", "exposed-dao",
"exposed-jdbc", "exposed-jdbc",
"exposed-javatime", "exposed-javatime",
"exposed-kotlintime",
] ]
systemtray = [ systemtray = [
"systemtray-core", "systemtray-core",

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000 networkTimeout=10000
retries=0 retries=0
retryBackOffMs=500 retryBackOffMs=500

View File

@@ -171,7 +171,6 @@ tasks {
"Implementation-Vendor" to "The Suwayomi Project", "Implementation-Vendor" to "The Suwayomi Project",
"Specification-Version" to getTachideskVersion(), "Specification-Version" to getTachideskVersion(),
"Implementation-Version" to getTachideskRevision(), "Implementation-Version" to getTachideskRevision(),
"Multi-Release" to true, // needed for polyglot
) )
} }
archiveBaseName.set(rootProject.name) archiveBaseName.set(rootProject.name)

View File

@@ -2,6 +2,7 @@ package suwayomi.tachidesk.server.settings.generation
import suwayomi.tachidesk.server.settings.SettingsRegistry import suwayomi.tachidesk.server.settings.SettingsRegistry
import java.io.File import java.io.File
import kotlin.text.appendLine
object SettingsBackupServerSettingsGenerator { object SettingsBackupServerSettingsGenerator {
fun generate( fun generate(

View File

@@ -2,6 +2,7 @@ package suwayomi.tachidesk.server.settings.generation
import suwayomi.tachidesk.server.settings.SettingsRegistry import suwayomi.tachidesk.server.settings.SettingsRegistry
import java.io.File import java.io.File
import kotlin.text.appendLine
object SettingsBackupSettingsHandlerGenerator { object SettingsBackupSettingsHandlerGenerator {
fun generate( fun generate(

View File

@@ -2,6 +2,7 @@ package suwayomi.tachidesk.server.settings.generation
import suwayomi.tachidesk.server.settings.SettingsRegistry import suwayomi.tachidesk.server.settings.SettingsRegistry
import java.io.File import java.io.File
import kotlin.text.appendLine
object SettingsGraphqlTypeGenerator { object SettingsGraphqlTypeGenerator {
fun generate( fun generate(

View File

@@ -25,7 +25,7 @@ import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.mapLatest import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import suwayomi.tachidesk.graphql.types.AuthMode import suwayomi.tachidesk.graphql.types.AuthMode
import suwayomi.tachidesk.graphql.types.CbzMediaType import suwayomi.tachidesk.graphql.types.CbzMediaType
import suwayomi.tachidesk.graphql.types.DatabaseType import suwayomi.tachidesk.graphql.types.DatabaseType
@@ -56,14 +56,16 @@ import suwayomi.tachidesk.server.settings.PathSetting
import suwayomi.tachidesk.server.settings.SettingGroup import suwayomi.tachidesk.server.settings.SettingGroup
import suwayomi.tachidesk.server.settings.SettingsRegistry import suwayomi.tachidesk.server.settings.SettingsRegistry
import suwayomi.tachidesk.server.settings.StringSetting import suwayomi.tachidesk.server.settings.StringSetting
import uy.kohesive.injekt.injectLazy
import xyz.nulldev.ts.config.GlobalConfigManager import xyz.nulldev.ts.config.GlobalConfigManager
import xyz.nulldev.ts.config.SystemPropertyOverridableConfigModule import xyz.nulldev.ts.config.SystemPropertyOverridableConfigModule
import kotlin.collections.associate
import kotlin.getValue
import kotlin.time.Duration import kotlin.time.Duration
import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds import kotlin.time.Duration.Companion.seconds
import uy.kohesive.injekt.injectLazy
val mutableConfigValueScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) val mutableConfigValueScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
@@ -580,7 +582,7 @@ class ServerConfig(
privacySafe = true, privacySafe = true,
defaultValue = SortOrder.DESC, defaultValue = SortOrder.DESC,
enumClass = SortOrder::class, enumClass = SortOrder::class,
typeInfo = SettingsRegistry.PartialTypeInfo(imports = listOf("org.jetbrains.exposed.v1.core.SortOrder")), typeInfo = SettingsRegistry.PartialTypeInfo(imports = listOf("org.jetbrains.exposed.sql.SortOrder")),
) )
val authMode: MutableStateFlow<AuthMode> by EnumSetting( val authMode: MutableStateFlow<AuthMode> by EnumSetting(

View File

@@ -2,6 +2,7 @@ package suwayomi.tachidesk.server.settings
import com.typesafe.config.ConfigValue import com.typesafe.config.ConfigValue
import com.typesafe.config.parser.ConfigDocument import com.typesafe.config.parser.ConfigDocument
import kotlin.collections.find
import kotlin.reflect.KClass import kotlin.reflect.KClass
/** /**

View File

@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.network
import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.okio.decodeFromBufferedSource import kotlinx.serialization.json.okio.decodeFromBufferedSource
import kotlinx.serialization.serializer import kotlinx.serialization.serializer

View File

@@ -103,7 +103,7 @@ class CloudflareInterceptor(
companion object { companion object {
private val ERROR_CODES = listOf(403, 503) private val ERROR_CODES = listOf(403, 503)
private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare") private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare")
val COOKIE_NAMES = listOf("cf_clearance") private val COOKIE_NAMES = listOf("cf_clearance")
private val CHROME_IMAGE_TEMPLATE_REGEX = Regex("""<title>(.*?) \(\d+×\d+\)</title>""") private val CHROME_IMAGE_TEMPLATE_REGEX = Regex("""<title>(.*?) \(\d+×\d+\)</title>""")
} }
} }
@@ -205,11 +205,8 @@ object CFClearance {
session = serverConfig.flareSolverrSessionName.value, session = serverConfig.flareSolverrSessionName.value,
sessionTtlMinutes = serverConfig.flareSolverrSessionTtl.value, sessionTtlMinutes = serverConfig.flareSolverrSessionTtl.value,
cookies = cookies =
network.cookieStore network.cookieStore.get(originalRequest.url).map {
.get(originalRequest.url) FlareSolverCookie(it.name, it.value)
.filter { it.name !in CloudflareInterceptor.COOKIE_NAMES }
.map { cookie ->
FlareSolverCookie(cookie.name, cookie.value)
}, },
returnOnlyCookies = onlyCookies, returnOnlyCookies = onlyCookies,
maxTimeout = timeout.inWholeMilliseconds.toInt(), maxTimeout = timeout.inWholeMilliseconds.toInt(),

View File

@@ -36,11 +36,10 @@ import nl.adaptivity.xmlutil.ExperimentalXmlUtilApi
import nl.adaptivity.xmlutil.core.KtXmlReader import nl.adaptivity.xmlutil.core.KtXmlReader
import nl.adaptivity.xmlutil.serialization.XML import nl.adaptivity.xmlutil.serialization.XML
import org.apache.commons.compress.archivers.zip.ZipFile import org.apache.commons.compress.archivers.zip.ZipFile
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.v1.jdbc.insert import org.jetbrains.exposed.sql.insertAndGetId
import org.jetbrains.exposed.v1.jdbc.insertAndGetId import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.registerCatalogueSource import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.registerCatalogueSource
import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil import suwayomi.tachidesk.manga.impl.util.storage.ImageUtil
import suwayomi.tachidesk.manga.model.table.ExtensionTable import suwayomi.tachidesk.manga.model.table.ExtensionTable

View File

@@ -1,12 +1,10 @@
package suwayomi.tachidesk.global.impl package suwayomi.tachidesk.global.impl
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.global.model.table.GlobalMetaTable import suwayomi.tachidesk.global.model.table.GlobalMetaTable
/* /*
@@ -34,14 +32,13 @@ object GlobalMeta {
val (existingMeta, newMeta) = meta.toList().partition { (key) -> key in dbMetaMap.keys } val (existingMeta, newMeta) = meta.toList().partition { (key) -> key in dbMetaMap.keys }
if (existingMeta.isNotEmpty()) { if (existingMeta.isNotEmpty()) {
BatchUpdateStatement(GlobalMetaTable) BatchUpdateStatement(GlobalMetaTable).apply {
.apply {
existingMeta.forEach { (key, value) -> existingMeta.forEach { (key, value) ->
addBatch(EntityID(dbMetaMap[key]!![GlobalMetaTable.id].value, GlobalMetaTable)) addBatch(EntityID(dbMetaMap[key]!![GlobalMetaTable.id].value, GlobalMetaTable))
this[GlobalMetaTable.value] = value this[GlobalMetaTable.value] = value
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
if (newMeta.isNotEmpty()) { if (newMeta.isNotEmpty()) {

View File

@@ -7,12 +7,12 @@ package suwayomi.tachidesk.global.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.dao.id.IntIdTable
/** /**
* Metadata storage for clients, server/global level. * Metadata storage for clients, server/global level.
*/ */
object GlobalMetaTable : IntIdTable() { object GlobalMetaTable : IntIdTable() {
val key = varchar("meta_key", 256) val key = varchar("key", 256)
val value = varchar("value", 4096) val value = varchar("value", 4096)
} }

View File

@@ -11,10 +11,10 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.types.CategoryNodeList import suwayomi.tachidesk.graphql.types.CategoryNodeList
import suwayomi.tachidesk.graphql.types.CategoryNodeList.Companion.toNodeList import suwayomi.tachidesk.graphql.types.CategoryNodeList.Companion.toNodeList
import suwayomi.tachidesk.graphql.types.CategoryType import suwayomi.tachidesk.graphql.types.CategoryType

View File

@@ -11,17 +11,13 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.core.count import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.count
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.greaterEq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.core.inList
import org.jetbrains.exposed.v1.jdbc.select
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.graphql.types.ChapterNodeList import suwayomi.tachidesk.graphql.types.ChapterNodeList
import suwayomi.tachidesk.graphql.types.ChapterNodeList.Companion.toNodeList import suwayomi.tachidesk.graphql.types.ChapterNodeList.Companion.toNodeList
import suwayomi.tachidesk.graphql.types.ChapterType import suwayomi.tachidesk.graphql.types.ChapterType

View File

@@ -11,10 +11,10 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.types.ExtensionType import suwayomi.tachidesk.graphql.types.ExtensionType
import suwayomi.tachidesk.manga.model.table.ExtensionTable import suwayomi.tachidesk.manga.model.table.ExtensionTable
import suwayomi.tachidesk.manga.model.table.SourceTable import suwayomi.tachidesk.manga.model.table.SourceTable

View File

@@ -12,13 +12,11 @@ import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.dataloader.DataLoaderOptions import org.dataloader.DataLoaderOptions
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.andWhere
import org.jetbrains.exposed.v1.core.isNull import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.andWhere import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.graphql.cache.CustomCacheMap import suwayomi.tachidesk.graphql.cache.CustomCacheMap
import suwayomi.tachidesk.graphql.types.MangaNodeList import suwayomi.tachidesk.graphql.types.MangaNodeList
import suwayomi.tachidesk.graphql.types.MangaNodeList.Companion.toNodeList import suwayomi.tachidesk.graphql.types.MangaNodeList.Companion.toNodeList

View File

@@ -4,10 +4,10 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.global.model.table.GlobalMetaTable import suwayomi.tachidesk.global.model.table.GlobalMetaTable
import suwayomi.tachidesk.graphql.types.CategoryMetaType import suwayomi.tachidesk.graphql.types.CategoryMetaType
import suwayomi.tachidesk.graphql.types.ChapterMetaType import suwayomi.tachidesk.graphql.types.ChapterMetaType

View File

@@ -11,10 +11,10 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.types.SourceNodeList import suwayomi.tachidesk.graphql.types.SourceNodeList
import suwayomi.tachidesk.graphql.types.SourceNodeList.Companion.toNodeList import suwayomi.tachidesk.graphql.types.SourceNodeList.Companion.toNodeList
import suwayomi.tachidesk.graphql.types.SourceType import suwayomi.tachidesk.graphql.types.SourceType

View File

@@ -11,10 +11,10 @@ import com.expediagroup.graphql.dataloader.KotlinDataLoader
import graphql.GraphQLContext import graphql.GraphQLContext
import org.dataloader.DataLoader import org.dataloader.DataLoader
import org.dataloader.DataLoaderFactory import org.dataloader.DataLoaderFactory
import org.jetbrains.exposed.v1.core.Slf4jSqlDebugLogger import org.jetbrains.exposed.sql.Slf4jSqlDebugLogger
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.types.TrackRecordNodeList import suwayomi.tachidesk.graphql.types.TrackRecordNodeList
import suwayomi.tachidesk.graphql.types.TrackRecordNodeList.Companion.toNodeList import suwayomi.tachidesk.graphql.types.TrackRecordNodeList.Companion.toNodeList
import suwayomi.tachidesk.graphql.types.TrackRecordType import suwayomi.tachidesk.graphql.types.TrackRecordType

View File

@@ -2,22 +2,21 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import org.jetbrains.exposed.v1.core.LikePattern import graphql.execution.DataFetcherResult
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.greaterEq import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
import org.jetbrains.exposed.v1.core.lessEq import org.jetbrains.exposed.sql.SqlExpressionBuilder.minus
import org.jetbrains.exposed.v1.core.like import org.jetbrains.exposed.sql.SqlExpressionBuilder.plus
import org.jetbrains.exposed.v1.core.minus import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.core.plus import org.jetbrains.exposed.sql.insertAndGetId
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.jdbc.insertAndGetId import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.CategoryMetaType import suwayomi.tachidesk.graphql.types.CategoryMetaType
import suwayomi.tachidesk.graphql.types.CategoryType import suwayomi.tachidesk.graphql.types.CategoryType

View File

@@ -4,21 +4,19 @@ package suwayomi.tachidesk.graphql.mutations
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jetbrains.exposed.v1.core.LikePattern import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
import org.jetbrains.exposed.v1.core.like import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.ChapterMetaType import suwayomi.tachidesk.graphql.types.ChapterMetaType
import suwayomi.tachidesk.graphql.types.ChapterType import suwayomi.tachidesk.graphql.types.ChapterType
@@ -92,8 +90,7 @@ class ChapterMutation {
if (patch.isRead != null || patch.isBookmarked != null || patch.lastPageRead != null) { if (patch.isRead != null || patch.isBookmarked != null || patch.lastPageRead != null) {
val now = Instant.now().epochSecond val now = Instant.now().epochSecond
BatchUpdateStatement(ChapterTable) BatchUpdateStatement(ChapterTable).apply {
.apply {
ids.forEach { chapterId -> ids.forEach { chapterId ->
addBatch(EntityID(chapterId, ChapterTable)) addBatch(EntityID(chapterId, ChapterTable))
patch.isRead?.also { patch.isRead?.also {
@@ -107,8 +104,8 @@ class ChapterMutation {
this[ChapterTable.lastReadAt] = now this[ChapterTable.lastReadAt] = now
} }
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
} }

View File

@@ -2,12 +2,11 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import graphql.execution.DataFetcherResult
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeout
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.ChapterType import suwayomi.tachidesk.graphql.types.ChapterType
import suwayomi.tachidesk.graphql.types.DownloadStatus import suwayomi.tachidesk.graphql.types.DownloadStatus

View File

@@ -3,12 +3,10 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import eu.kanade.tachiyomi.source.local.LocalSource import eu.kanade.tachiyomi.source.local.LocalSource
import graphql.execution.DataFetcherResult
import io.javalin.http.UploadedFile import io.javalin.http.UploadedFile
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.transactions.transaction
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 import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.ExtensionType import suwayomi.tachidesk.graphql.types.ExtensionType
import suwayomi.tachidesk.manga.impl.extension.Extension import suwayomi.tachidesk.manga.impl.extension.Extension

View File

@@ -2,6 +2,7 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import graphql.execution.DataFetcherResult
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeout
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth

View File

@@ -2,10 +2,10 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import org.jetbrains.exposed.v1.core.eq import graphql.execution.DataFetcherResult
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.ChapterType import suwayomi.tachidesk.graphql.types.ChapterType
import suwayomi.tachidesk.graphql.types.KoSyncConnectPayload import suwayomi.tachidesk.graphql.types.KoSyncConnectPayload

View File

@@ -2,17 +2,17 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import org.jetbrains.exposed.v1.core.LikePattern import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
import org.jetbrains.exposed.v1.core.like import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.MangaMetaType import suwayomi.tachidesk.graphql.types.MangaMetaType
import suwayomi.tachidesk.graphql.types.MangaType import suwayomi.tachidesk.graphql.types.MangaType

View File

@@ -2,15 +2,16 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import org.jetbrains.exposed.v1.core.LikePattern import graphql.execution.DataFetcherResult
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.like import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.global.impl.GlobalMeta import suwayomi.tachidesk.global.impl.GlobalMeta
import suwayomi.tachidesk.global.model.table.GlobalMetaTable import suwayomi.tachidesk.global.model.table.GlobalMetaTable
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth

View File

@@ -7,16 +7,16 @@ import androidx.preference.EditTextPreference
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.MultiSelectListPreference import androidx.preference.MultiSelectListPreference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import org.jetbrains.exposed.v1.core.LikePattern import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
import org.jetbrains.exposed.v1.core.like import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.FilterChange import suwayomi.tachidesk.graphql.types.FilterChange
import suwayomi.tachidesk.graphql.types.MangaType import suwayomi.tachidesk.graphql.types.MangaType

View File

@@ -4,10 +4,10 @@ package suwayomi.tachidesk.graphql.mutations
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.generator.annotations.GraphQLDescription import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import org.jetbrains.exposed.v1.core.and import graphql.execution.DataFetcherResult
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.types.TrackRecordType import suwayomi.tachidesk.graphql.types.TrackRecordType
import suwayomi.tachidesk.graphql.types.TrackerType import suwayomi.tachidesk.graphql.types.TrackerType

View File

@@ -2,6 +2,7 @@
package suwayomi.tachidesk.graphql.mutations package suwayomi.tachidesk.graphql.mutations
import graphql.execution.DataFetcherResult
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeout
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth

View File

@@ -4,6 +4,7 @@ package suwayomi.tachidesk.graphql.mutations
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import suwayomi.tachidesk.global.impl.util.Jwt import suwayomi.tachidesk.global.impl.util.Jwt
import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.server.getAttribute import suwayomi.tachidesk.graphql.server.getAttribute
import suwayomi.tachidesk.server.JavalinSetup.Attribute import suwayomi.tachidesk.server.JavalinSetup.Attribute
import suwayomi.tachidesk.server.serverConfig import suwayomi.tachidesk.server.serverConfig

View File

@@ -10,13 +10,13 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.Filter import suwayomi.tachidesk.graphql.queries.filter.Filter

View File

@@ -10,14 +10,14 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.jdbc.andWhere import org.jetbrains.exposed.sql.andWhere
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.DoubleFilter import suwayomi.tachidesk.graphql.queries.filter.DoubleFilter

View File

@@ -11,14 +11,14 @@ import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import eu.kanade.tachiyomi.source.local.LocalSource import eu.kanade.tachiyomi.source.local.LocalSource
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.core.neq import org.jetbrains.exposed.sql.SqlExpressionBuilder.neq
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.Filter import suwayomi.tachidesk.graphql.queries.filter.Filter

View File

@@ -10,17 +10,12 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.core.inSubQuery import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.core.less
import org.jetbrains.exposed.v1.core.like
import org.jetbrains.exposed.v1.jdbc.select
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.ComparableScalarFilter import suwayomi.tachidesk.graphql.queries.filter.ComparableScalarFilter
@@ -245,16 +240,13 @@ class MangaQuery {
): MangaNodeList { ): MangaNodeList {
val queryResults = val queryResults =
transaction { transaction {
val mangaIdsQuery = val res =
MangaTable MangaTable
.leftJoin(CategoryMangaTable) .leftJoin(CategoryMangaTable)
.select(MangaTable.id) .select(MangaTable.columns)
.withDistinct() .withDistinctOn(MangaTable.id)
mangaIdsQuery.applyOps(condition, filter) res.applyOps(condition, filter)
val res =
MangaTable.selectAll().where { MangaTable.id inSubQuery mangaIdsQuery }
if (order != null || orderBy != null || (last != null || before != null)) { if (order != null || orderBy != null || (last != null || before != null)) {
val baseSort = listOf(MangaOrder(MangaOrderBy.ID, SortOrder.ASC)) val baseSort = listOf(MangaOrder(MangaOrderBy.ID, SortOrder.ASC))

View File

@@ -10,13 +10,13 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.global.model.table.GlobalMetaTable import suwayomi.tachidesk.global.model.table.GlobalMetaTable
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.Filter import suwayomi.tachidesk.graphql.queries.filter.Filter

View File

@@ -10,13 +10,13 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.Filter import suwayomi.tachidesk.graphql.queries.filter.Filter

View File

@@ -3,13 +3,13 @@ package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.directives.RequireAuth import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter import suwayomi.tachidesk.graphql.queries.filter.BooleanFilter
import suwayomi.tachidesk.graphql.queries.filter.DoubleFilter import suwayomi.tachidesk.graphql.queries.filter.DoubleFilter

View File

@@ -1,33 +1,21 @@
package suwayomi.tachidesk.graphql.queries.filter package suwayomi.tachidesk.graphql.queries.filter
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.ComparisonOp import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.Expression import org.jetbrains.exposed.sql.ComparisonOp
import org.jetbrains.exposed.v1.core.ExpressionWithColumnType import org.jetbrains.exposed.sql.Expression
import org.jetbrains.exposed.v1.core.LikePattern import org.jetbrains.exposed.sql.ExpressionWithColumnType
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.LikePattern
import org.jetbrains.exposed.v1.core.QueryBuilder import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.Query
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.QueryBuilder
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.greaterEq import org.jetbrains.exposed.sql.andWhere
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.not
import org.jetbrains.exposed.v1.core.isNotNull import org.jetbrains.exposed.sql.or
import org.jetbrains.exposed.v1.core.isNull import org.jetbrains.exposed.sql.stringParam
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.upperCase
import org.jetbrains.exposed.v1.core.lessEq
import org.jetbrains.exposed.v1.core.like
import org.jetbrains.exposed.v1.core.neq
import org.jetbrains.exposed.v1.core.not
import org.jetbrains.exposed.v1.core.notInList
import org.jetbrains.exposed.v1.core.notLike
import org.jetbrains.exposed.v1.core.or
import org.jetbrains.exposed.v1.core.stringParam
import org.jetbrains.exposed.v1.core.upperCase
import org.jetbrains.exposed.v1.core.wrap
import org.jetbrains.exposed.v1.jdbc.Query
import org.jetbrains.exposed.v1.jdbc.andWhere
class ILikeEscapeOp( class ILikeEscapeOp(
expr1: Expression<*>, expr1: Expression<*>,
@@ -100,7 +88,9 @@ class DistinctFromOp(
): DistinctFromOp = ): DistinctFromOp =
DistinctFromOp( DistinctFromOp(
expression, expression,
expression.wrap(t), with(SqlExpressionBuilder) {
expression.wrap(t)
},
false, false,
) )
@@ -110,7 +100,9 @@ class DistinctFromOp(
): DistinctFromOp = ): DistinctFromOp =
DistinctFromOp( DistinctFromOp(
expression, expression,
expression.wrap(t), with(SqlExpressionBuilder) {
expression.wrap(t)
},
true, true,
) )
@@ -120,7 +112,9 @@ class DistinctFromOp(
): DistinctFromOp = ): DistinctFromOp =
DistinctFromOp( DistinctFromOp(
expression, expression,
expression.wrap(t), with(SqlExpressionBuilder) {
expression.wrap(t)
},
false, false,
) )
@@ -130,7 +124,9 @@ class DistinctFromOp(
): DistinctFromOp = ): DistinctFromOp =
DistinctFromOp( DistinctFromOp(
expression, expression,
expression.wrap(t), with(SqlExpressionBuilder) {
expression.wrap(t)
},
true, true,
) )
} }
@@ -509,26 +505,26 @@ class OpAnd(
) { ) {
fun <T> andWhere( fun <T> andWhere(
value: T?, value: T?,
andPart: (T & Any) -> Op<Boolean>, andPart: SqlExpressionBuilder.(T & Any) -> Op<Boolean>,
) { ) {
value ?: return value ?: return
val expr = andPart(value) val expr = Op.build { andPart(value) }
op = if (op == null) expr else (op!! and expr) op = if (op == null) expr else (op!! and expr)
} }
fun <T : Any> andWhere( fun <T : Any> andWhere(
values: List<T>?, values: List<T>?,
andPart: (List<T>) -> Op<Boolean>, andPart: SqlExpressionBuilder.(List<T>) -> Op<Boolean>,
) { ) {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
return andWhere(values as T?, andPart as (Any) -> Op<Boolean>) return andWhere(values as T?, andPart as SqlExpressionBuilder.(Any) -> Op<Boolean>)
} }
fun <T : Any> andWhere( fun <T : Any> andWhere(
valueDefault: T?, valueDefault: T?,
valueAll: List<T>?, valueAll: List<T>?,
valueAny: List<T>?, valueAny: List<T>?,
expr: (T) -> Op<Boolean>, expr: SqlExpressionBuilder.(T) -> Op<Boolean>,
) { ) {
andWhere(valueDefault, expr) andWhere(valueDefault, expr)
andWhereAll(valueAll, expr) andWhereAll(valueAll, expr)
@@ -537,17 +533,17 @@ class OpAnd(
fun <T : Any> andWhereAll( fun <T : Any> andWhereAll(
values: List<T>?, values: List<T>?,
andPart: (T) -> Op<Boolean>, andPart: SqlExpressionBuilder.(T) -> Op<Boolean>,
) { ) {
values?.map { andWhere(it, andPart) } values?.map { andWhere(it, andPart) }
} }
fun <T : Any> andWhereAny( fun <T : Any> andWhereAny(
values: List<T>?, values: List<T>?,
andPart: (T) -> Op<Boolean>, andPart: SqlExpressionBuilder.(T) -> Op<Boolean>,
) { ) {
values ?: return values ?: return
val expr = values.map { andPart(it) }.reduce { acc, op -> acc or op } val expr = values.map { Op.build { andPart(it) } }.reduce { acc, op -> acc or op }
op = if (op == null) expr else (op!! and expr) op = if (op == null) expr else (op!! and expr)
} }

View File

@@ -14,6 +14,7 @@ import com.expediagroup.graphql.server.types.GraphQLServerRequest
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import io.javalin.http.Context import io.javalin.http.Context
import io.javalin.http.UploadedFile import io.javalin.http.UploadedFile
import io.javalin.json.JavalinJackson
import io.javalin.json.fromJsonStream import io.javalin.json.fromJsonStream
import io.javalin.json.fromJsonString import io.javalin.json.fromJsonString
import java.io.IOException import java.io.IOException

View File

@@ -15,6 +15,7 @@ import graphql.GraphQL
import graphql.execution.AsyncExecutionStrategy import graphql.execution.AsyncExecutionStrategy
import graphql.execution.DataFetcherExceptionHandler import graphql.execution.DataFetcherExceptionHandler
import graphql.execution.DataFetcherExceptionHandlerResult import graphql.execution.DataFetcherExceptionHandlerResult
import graphql.schema.idl.RuntimeWiring
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import io.javalin.http.Context import io.javalin.http.Context
import io.javalin.websocket.WsCloseContext import io.javalin.websocket.WsCloseContext

View File

@@ -1,16 +1,16 @@
package suwayomi.tachidesk.graphql.server.primitives package suwayomi.tachidesk.graphql.server.primitives
import org.jetbrains.exposed.v1.core.Column import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.Query
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.v1.core.or import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.jdbc.Query import org.jetbrains.exposed.sql.andWhere
import org.jetbrains.exposed.v1.jdbc.andWhere import org.jetbrains.exposed.sql.or
interface OrderBy<T> { interface OrderBy<T> {
val column: Column<*> val column: Column<*>

View File

@@ -1,6 +1,6 @@
package suwayomi.tachidesk.graphql.server.primitives package suwayomi.tachidesk.graphql.server.primitives
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
data class QueryResults<T>( data class QueryResults<T>(
val total: Long, val total: Long,

View File

@@ -9,7 +9,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge
import suwayomi.tachidesk.graphql.server.primitives.Node import suwayomi.tachidesk.graphql.server.primitives.Node

View File

@@ -9,7 +9,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge
import suwayomi.tachidesk.graphql.server.primitives.Node import suwayomi.tachidesk.graphql.server.primitives.Node

View File

@@ -9,7 +9,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge
import suwayomi.tachidesk.graphql.server.primitives.Node import suwayomi.tachidesk.graphql.server.primitives.Node

View File

@@ -10,7 +10,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.source.model.UpdateStrategy
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.graphql.cache.CustomCacheMap import suwayomi.tachidesk.graphql.cache.CustomCacheMap
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge

View File

@@ -2,7 +2,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.global.model.table.GlobalMetaTable import suwayomi.tachidesk.global.model.table.GlobalMetaTable
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge

View File

@@ -13,9 +13,8 @@ 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.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge
import suwayomi.tachidesk.graphql.server.primitives.Node import suwayomi.tachidesk.graphql.server.primitives.Node

View File

@@ -2,7 +2,7 @@ package suwayomi.tachidesk.graphql.types
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
import graphql.schema.DataFetchingEnvironment import graphql.schema.DataFetchingEnvironment
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.graphql.server.primitives.Cursor import suwayomi.tachidesk.graphql.server.primitives.Cursor
import suwayomi.tachidesk.graphql.server.primitives.Edge import suwayomi.tachidesk.graphql.server.primitives.Edge
import suwayomi.tachidesk.graphql.server.primitives.Node import suwayomi.tachidesk.graphql.server.primitives.Node

View File

@@ -12,9 +12,8 @@ import io.javalin.http.HttpStatus
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.CategoryManga import suwayomi.tachidesk.manga.impl.CategoryManga
import suwayomi.tachidesk.manga.impl.Chapter import suwayomi.tachidesk.manga.impl.Chapter
import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper

View File

@@ -7,27 +7,25 @@ package suwayomi.tachidesk.manga.impl
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.andWhere
import org.jetbrains.exposed.v1.core.isNull import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.neq import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.andWhere import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
import suwayomi.tachidesk.manga.model.table.CategoryMangaTable import suwayomi.tachidesk.manga.model.table.CategoryMangaTable
import suwayomi.tachidesk.manga.model.table.CategoryMetaTable import suwayomi.tachidesk.manga.model.table.CategoryMetaTable
import suwayomi.tachidesk.manga.model.table.CategoryTable import suwayomi.tachidesk.manga.model.table.CategoryTable
import suwayomi.tachidesk.manga.model.table.MangaTable import suwayomi.tachidesk.manga.model.table.MangaTable
import suwayomi.tachidesk.manga.model.table.toDataClass import suwayomi.tachidesk.manga.model.table.toDataClass
import kotlin.collections.component1
import kotlin.collections.orEmpty
object Category { object Category {
/** /**
@@ -250,14 +248,13 @@ object Category {
} }
if (existingMetaByMetaId.isNotEmpty()) { if (existingMetaByMetaId.isNotEmpty()) {
BatchUpdateStatement(CategoryMetaTable) BatchUpdateStatement(CategoryMetaTable).apply {
.apply {
existingMetaByMetaId.forEach { (metaId, entry) -> existingMetaByMetaId.forEach { (metaId, entry) ->
addBatch(EntityID(metaId, CategoryMetaTable)) addBatch(EntityID(metaId, CategoryMetaTable))
this[CategoryMetaTable.value] = entry.value this[CategoryMetaTable.value] = entry.value
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
if (newMetaByCategoryId.isNotEmpty()) { if (newMetaByCategoryId.isNotEmpty()) {

View File

@@ -7,22 +7,19 @@ package suwayomi.tachidesk.manga.impl
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.alias import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.alias
import org.jetbrains.exposed.v1.core.count import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.count
import org.jetbrains.exposed.v1.core.isNull import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.core.leftJoin import org.jetbrains.exposed.sql.leftJoin
import org.jetbrains.exposed.v1.core.max import org.jetbrains.exposed.sql.max
import org.jetbrains.exposed.v1.core.wrapAsExpression import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.wrapAsExpression
import org.jetbrains.exposed.v1.jdbc.select
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.Category.DEFAULT_CATEGORY_ID import suwayomi.tachidesk.manga.impl.Category.DEFAULT_CATEGORY_ID
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass

View File

@@ -17,21 +17,17 @@ import io.github.reactivecircus.cache4k.Cache
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.greater import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.less import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.Manga.getManga import suwayomi.tachidesk.manga.impl.Manga.getManga
import suwayomi.tachidesk.manga.impl.download.DownloadManager import suwayomi.tachidesk.manga.impl.download.DownloadManager
import suwayomi.tachidesk.manga.impl.download.DownloadManager.EnqueueInput import suwayomi.tachidesk.manga.impl.download.DownloadManager.EnqueueInput
@@ -262,14 +258,16 @@ object Chapter {
} }
} }
transaction {
// we got some clean up due // we got some clean up due
if (chaptersIdsToDelete.isNotEmpty()) { if (chaptersIdsToDelete.isNotEmpty()) {
DownloadManager.dequeue(chaptersIdsToDelete) DownloadManager.dequeue(chaptersIdsToDelete)
transaction {
PageTable.deleteWhere { chapter inList chaptersIdsToDelete } PageTable.deleteWhere { chapter inList chaptersIdsToDelete }
ChapterTable.deleteWhere { id inList chaptersIdsToDelete } ChapterTable.deleteWhere { id inList chaptersIdsToDelete }
} }
}
transaction {
if (chaptersToInsert.isNotEmpty()) { if (chaptersToInsert.isNotEmpty()) {
ChapterTable ChapterTable
.batchInsert(chaptersToInsert) { chapter -> .batchInsert(chaptersToInsert) { chapter ->
@@ -285,7 +283,6 @@ object Chapter {
this[ChapterTable.isRead] = false this[ChapterTable.isRead] = false
this[ChapterTable.isBookmarked] = false this[ChapterTable.isBookmarked] = false
this[ChapterTable.isDownloaded] = false this[ChapterTable.isDownloaded] = false
this[ChapterTable.pageCount] = -1
// is recognized chapter number // is recognized chapter number
if (chapter.chapterNumber >= 0f && chapter.chapterNumber in deletedChapterNumbers) { if (chapter.chapterNumber >= 0f && chapter.chapterNumber in deletedChapterNumbers) {
@@ -309,8 +306,7 @@ object Chapter {
} }
if (chaptersToUpdate.isNotEmpty()) { if (chaptersToUpdate.isNotEmpty()) {
BatchUpdateStatement(ChapterTable) BatchUpdateStatement(ChapterTable).apply {
.apply {
chaptersToUpdate.forEach { chaptersToUpdate.forEach {
addBatch(EntityID(it.id, ChapterTable)) addBatch(EntityID(it.id, ChapterTable))
this[ChapterTable.name] = it.name this[ChapterTable.name] = it.name
@@ -320,8 +316,8 @@ object Chapter {
this[ChapterTable.sourceOrder] = it.index this[ChapterTable.sourceOrder] = it.index
this[ChapterTable.realUrl] = it.realUrl this[ChapterTable.realUrl] = it.realUrl
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
MangaTable.update({ MangaTable.id eq mangaId }) { MangaTable.update({ MangaTable.id eq mangaId }) {
@@ -521,11 +517,11 @@ object Chapter {
// mangaId is not null, scope query under manga // mangaId is not null, scope query under manga
when { when {
input.chapterIds != null -> { input.chapterIds != null -> {
(ChapterTable.manga eq mangaId) and (ChapterTable.id inList input.chapterIds) Op.build { (ChapterTable.manga eq mangaId) and (ChapterTable.id inList input.chapterIds) }
} }
input.chapterIndexes != null -> { input.chapterIndexes != null -> {
(ChapterTable.manga eq mangaId) and (ChapterTable.sourceOrder inList input.chapterIndexes) Op.build { (ChapterTable.manga eq mangaId) and (ChapterTable.sourceOrder inList input.chapterIndexes) }
} }
else -> { else -> {
@@ -538,7 +534,7 @@ object Chapter {
// mangaId is null, only chapterIndexes is valid for this case // mangaId is null, only chapterIndexes is valid for this case
when { when {
input.chapterIds != null -> { input.chapterIds != null -> {
(ChapterTable.id inList input.chapterIds) Op.build { (ChapterTable.id inList input.chapterIds) }
} }
else -> { else -> {
@@ -654,14 +650,13 @@ object Chapter {
} }
if (existingMetaByMetaId.isNotEmpty()) { if (existingMetaByMetaId.isNotEmpty()) {
BatchUpdateStatement(ChapterMetaTable) BatchUpdateStatement(ChapterMetaTable).apply {
.apply {
existingMetaByMetaId.forEach { (metaId, entry) -> existingMetaByMetaId.forEach { (metaId, entry) ->
addBatch(EntityID(metaId, ChapterMetaTable)) addBatch(EntityID(metaId, ChapterMetaTable))
this[ChapterMetaTable.value] = entry.value this[ChapterMetaTable.value] = entry.value
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
if (newMetaByChapterId.isNotEmpty()) { if (newMetaByChapterId.isNotEmpty()) {

View File

@@ -1,9 +1,7 @@
package suwayomi.tachidesk.manga.impl package suwayomi.tachidesk.manga.impl
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.select
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady
import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider
import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.ArchiveProvider import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.ArchiveProvider

View File

@@ -12,14 +12,11 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.v1.core.neq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.insert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.Manga.getManga import suwayomi.tachidesk.manga.impl.Manga.getManga
import suwayomi.tachidesk.manga.model.table.CategoryMangaTable import suwayomi.tachidesk.manga.model.table.CategoryMangaTable
import suwayomi.tachidesk.manga.model.table.CategoryTable import suwayomi.tachidesk.manga.model.table.CategoryTable

View File

@@ -20,18 +20,15 @@ import io.github.oshai.kotlinlogging.KotlinLogging
import io.javalin.http.HttpStatus import io.javalin.http.HttpStatus
import okhttp3.CacheControl import okhttp3.CacheControl
import okhttp3.Response import okhttp3.Response
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl
import suwayomi.tachidesk.manga.impl.Source.getSource import suwayomi.tachidesk.manga.impl.Source.getSource
import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.MissingThumbnailException import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.MissingThumbnailException
@@ -298,14 +295,13 @@ object Manga {
} }
if (existingMetaByMetaId.isNotEmpty()) { if (existingMetaByMetaId.isNotEmpty()) {
BatchUpdateStatement(MangaMetaTable) BatchUpdateStatement(MangaMetaTable).apply {
.apply {
existingMetaByMetaId.forEach { (metaId, entry) -> existingMetaByMetaId.forEach { (metaId, entry) ->
addBatch(EntityID(metaId, MangaMetaTable)) addBatch(EntityID(metaId, MangaMetaTable))
this[MangaMetaTable.value] = entry.value this[MangaMetaTable.value] = entry.value
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
if (newMetaByMangaId.isNotEmpty()) { if (newMetaByMangaId.isNotEmpty()) {

View File

@@ -9,15 +9,12 @@ package suwayomi.tachidesk.manga.impl
import eu.kanade.tachiyomi.source.local.LocalSource import eu.kanade.tachiyomi.source.local.LocalSource
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
import suwayomi.tachidesk.manga.model.dataclass.PagedMangaListDataClass import suwayomi.tachidesk.manga.model.dataclass.PagedMangaListDataClass
import suwayomi.tachidesk.manga.model.table.MangaTable import suwayomi.tachidesk.manga.model.table.MangaTable
@@ -91,8 +88,7 @@ object MangaList {
} }
if (mangaToUpdate.isNotEmpty()) { if (mangaToUpdate.isNotEmpty()) {
BatchUpdateStatement(MangaTable) BatchUpdateStatement(MangaTable).apply {
.apply {
mangaToUpdate.forEach { (sManga, manga) -> mangaToUpdate.forEach { (sManga, manga) ->
addBatch(EntityID(manga[MangaTable.id].value, MangaTable)) addBatch(EntityID(manga[MangaTable.id].value, MangaTable))
this[MangaTable.title] = sManga.title this[MangaTable.title] = sManga.title
@@ -111,8 +107,8 @@ object MangaList {
manga[MangaTable.thumbnailUrlLastFetched] manga[MangaTable.thumbnailUrlLastFetched]
} }
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
val mangaUrlsToId = val mangaUrlsToId =

View File

@@ -13,12 +13,11 @@ import eu.kanade.tachiyomi.source.online.HttpSource
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import libcore.net.MimeUtils import libcore.net.MimeUtils
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.graphql.types.DownloadConversion import suwayomi.tachidesk.graphql.types.DownloadConversion
import suwayomi.tachidesk.manga.impl.util.getChapterCachePath import suwayomi.tachidesk.manga.impl.util.getChapterCachePath
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub

View File

@@ -15,16 +15,12 @@ import eu.kanade.tachiyomi.source.sourcePreferences
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import io.javalin.json.JsonMapper import io.javalin.json.JsonMapper
import io.javalin.json.fromJsonString import io.javalin.json.fromJsonString
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.Source.preferenceScreenMap
import suwayomi.tachidesk.manga.impl.extension.Extension.getExtensionIconUrl import suwayomi.tachidesk.manga.impl.extension.Extension.getExtensionIconUrl
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrNull import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrNull
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
@@ -214,14 +210,13 @@ object Source {
} }
if (existingMetaByMetaId.isNotEmpty()) { if (existingMetaByMetaId.isNotEmpty()) {
BatchUpdateStatement(SourceMetaTable) BatchUpdateStatement(SourceMetaTable).apply {
.apply {
existingMetaByMetaId.forEach { (metaId, entry) -> existingMetaByMetaId.forEach { (metaId, entry) ->
addBatch(EntityID(metaId, SourceMetaTable)) addBatch(EntityID(metaId, SourceMetaTable))
this[SourceMetaTable.value] = entry.value this[SourceMetaTable.value] = entry.value
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
if (newMetaBySourceId.isNotEmpty()) { if (newMetaBySourceId.isNotEmpty()) {

View File

@@ -19,7 +19,7 @@ import okio.Buffer
import okio.Sink import okio.Sink
import okio.buffer import okio.buffer
import okio.gzip import okio.gzip
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.manga.impl.backup.BackupFlags import suwayomi.tachidesk.manga.impl.backup.BackupFlags
import suwayomi.tachidesk.manga.impl.backup.proto.handlers.BackupCategoryHandler import suwayomi.tachidesk.manga.impl.backup.proto.handlers.BackupCategoryHandler
import suwayomi.tachidesk.manga.impl.backup.proto.handlers.BackupGlobalMetaHandler import suwayomi.tachidesk.manga.impl.backup.proto.handlers.BackupGlobalMetaHandler

View File

@@ -11,9 +11,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import okio.buffer import okio.buffer
import okio.gzip import okio.gzip
import okio.source import okio.source
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.backup.proto.models.Backup import suwayomi.tachidesk.manga.impl.backup.proto.models.Backup
import suwayomi.tachidesk.manga.impl.track.tracker.TrackerManager import suwayomi.tachidesk.manga.impl.track.tracker.TrackerManager
import suwayomi.tachidesk.manga.model.table.SourceTable import suwayomi.tachidesk.manga.model.table.SourceTable

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.impl.backup.proto.handlers
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import suwayomi.tachidesk.manga.impl.Category import suwayomi.tachidesk.manga.impl.Category
import suwayomi.tachidesk.manga.impl.Category.modifyCategoriesMetas import suwayomi.tachidesk.manga.impl.Category.modifyCategoriesMetas
import suwayomi.tachidesk.manga.impl.backup.BackupFlags import suwayomi.tachidesk.manga.impl.backup.BackupFlags

View File

@@ -8,18 +8,16 @@ package suwayomi.tachidesk.manga.impl.backup.proto.handlers
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.source.model.UpdateStrategy
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.insertAndGetId
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.insertAndGetId import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.CategoryManga import suwayomi.tachidesk.manga.impl.CategoryManga
import suwayomi.tachidesk.manga.impl.Chapter import suwayomi.tachidesk.manga.impl.Chapter
import suwayomi.tachidesk.manga.impl.Chapter.modifyChaptersMetas import suwayomi.tachidesk.manga.impl.Chapter.modifyChaptersMetas
@@ -345,8 +343,7 @@ object BackupMangaHandler {
} }
if (chaptersToUpdateToDbChapter.isNotEmpty()) { if (chaptersToUpdateToDbChapter.isNotEmpty()) {
BatchUpdateStatement(ChapterTable) BatchUpdateStatement(ChapterTable).apply {
.apply {
chaptersToUpdateToDbChapter.forEach { (backupChapter, dbChapter) -> chaptersToUpdateToDbChapter.forEach { (backupChapter, dbChapter) ->
addBatch(EntityID(dbChapter[ChapterTable.id].value, ChapterTable)) addBatch(EntityID(dbChapter[ChapterTable.id].value, ChapterTable))
if (flags.includeChapters) { if (flags.includeChapters) {
@@ -362,8 +359,8 @@ object BackupMangaHandler {
.coerceAtLeast(dbChapter[ChapterTable.lastReadAt]) .coerceAtLeast(dbChapter[ChapterTable.lastReadAt])
} }
} }
}.toExecutable() execute(this@dbTransaction)
.execute(this@dbTransaction) }
} }
if (flags.includeClientData) { if (flags.includeClientData) {

View File

@@ -7,8 +7,7 @@ package suwayomi.tachidesk.manga.impl.backup.proto.handlers
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll
import suwayomi.tachidesk.manga.impl.Source import suwayomi.tachidesk.manga.impl.Source
import suwayomi.tachidesk.manga.impl.Source.modifySourceMetas import suwayomi.tachidesk.manga.impl.Source.modifySourceMetas
import suwayomi.tachidesk.manga.impl.backup.BackupFlags import suwayomi.tachidesk.manga.impl.backup.BackupFlags

View File

@@ -14,14 +14,14 @@ import io.github.oshai.kotlinlogging.KotlinLogging
import io.github.reactivecircus.cache4k.Cache import io.github.reactivecircus.cache4k.Cache
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass

View File

@@ -27,12 +27,9 @@ import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.sample import kotlinx.coroutines.flow.sample
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.select
import org.jetbrains.exposed.v1.jdbc.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter
import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem
import suwayomi.tachidesk.manga.impl.download.model.DownloadState.Error import suwayomi.tachidesk.manga.impl.download.model.DownloadState.Error
@@ -346,7 +343,7 @@ object DownloadManager {
transaction { transaction {
ChapterTable ChapterTable
.select(ChapterTable.id) .select(ChapterTable.id)
.where { (ChapterTable.manga eq mangaId) and (ChapterTable.sourceOrder eq chapterIndex) } .where { ChapterTable.manga.eq(mangaId) and ChapterTable.sourceOrder.eq(chapterIndex) }
.first() .first()
} }
enqueue(EnqueueInput(chapterIds = listOf(chapter[ChapterTable.id].value))) enqueue(EnqueueInput(chapterIds = listOf(chapter[ChapterTable.id].value)))

View File

@@ -17,9 +17,8 @@ import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReadyById import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReadyById
import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem

View File

@@ -11,10 +11,10 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.sample import kotlinx.coroutines.flow.sample
import libcore.net.MimeUtils import libcore.net.MimeUtils
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update import suwayomi.tachidesk.graphql.types.DownloadConversion
import suwayomi.tachidesk.manga.impl.Page import suwayomi.tachidesk.manga.impl.Page
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady
import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem import suwayomi.tachidesk.manga.impl.download.model.DownloadQueueItem
@@ -26,8 +26,14 @@ import suwayomi.tachidesk.manga.impl.util.getChapterDownloadPath
import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse
import suwayomi.tachidesk.manga.model.table.ChapterTable import suwayomi.tachidesk.manga.model.table.ChapterTable
import suwayomi.tachidesk.manga.model.table.MangaTable import suwayomi.tachidesk.manga.model.table.MangaTable
import suwayomi.tachidesk.server.serverConfig
import suwayomi.tachidesk.util.ConversionUtil
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream
import javax.imageio.IIOImage
import javax.imageio.ImageIO
import javax.imageio.ImageWriteParam
import javax.imageio.ImageWriter
sealed class FileType { sealed class FileType {
data class RegularFile( data class RegularFile(

View File

@@ -6,9 +6,8 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
import org.apache.commons.compress.archivers.zip.ZipFile import org.apache.commons.compress.archivers.zip.ZipFile
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider
import suwayomi.tachidesk.manga.impl.download.fileProvider.FileType import suwayomi.tachidesk.manga.impl.download.fileProvider.FileType
import suwayomi.tachidesk.manga.impl.util.getChapterCachePath import suwayomi.tachidesk.manga.impl.util.getChapterCachePath

View File

@@ -2,9 +2,8 @@ package suwayomi.tachidesk.manga.impl.download.fileProvider.impl
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider
import suwayomi.tachidesk.manga.impl.download.fileProvider.FileType.RegularFile import suwayomi.tachidesk.manga.impl.download.fileProvider.FileType.RegularFile
import suwayomi.tachidesk.manga.impl.util.getChapterCachePath import suwayomi.tachidesk.manga.impl.util.getChapterCachePath

View File

@@ -20,12 +20,12 @@ import okhttp3.CacheControl
import okio.buffer import okio.buffer
import okio.sink import okio.sink
import okio.source import okio.source
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.insert import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList.extensionTableAsDataClass import suwayomi.tachidesk.manga.impl.extension.ExtensionsList.extensionTableAsDataClass
import suwayomi.tachidesk.manga.impl.extension.github.ExtensionGithubApi import suwayomi.tachidesk.manga.impl.extension.github.ExtensionGithubApi
import suwayomi.tachidesk.manga.impl.util.PackageTools import suwayomi.tachidesk.manga.impl.util.PackageTools
@@ -55,6 +55,7 @@ import java.util.zip.ZipOutputStream
import kotlin.io.path.Path import kotlin.io.path.Path
import kotlin.io.path.absolutePathString import kotlin.io.path.absolutePathString
import kotlin.io.path.outputStream import kotlin.io.path.outputStream
import kotlin.io.path.relativeTo
object Extension { object Extension {
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
@@ -358,7 +359,6 @@ object Extension {
} else { } else {
ExtensionTable.update({ ExtensionTable.pkgName eq pkgName }) { ExtensionTable.update({ ExtensionTable.pkgName eq pkgName }) {
it[isInstalled] = false it[isInstalled] = false
it[hasUpdate] = false
} }
} }

View File

@@ -11,16 +11,15 @@ import eu.kanade.tachiyomi.source.local.LocalSource
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.manga.impl.extension.Extension.getExtensionIconUrl import suwayomi.tachidesk.manga.impl.extension.Extension.getExtensionIconUrl
import suwayomi.tachidesk.manga.impl.extension.github.ExtensionGithubApi import suwayomi.tachidesk.manga.impl.extension.github.ExtensionGithubApi
import suwayomi.tachidesk.manga.impl.extension.github.OnlineExtension import suwayomi.tachidesk.manga.impl.extension.github.OnlineExtension
@@ -126,8 +125,7 @@ object ExtensionsList {
.groupBy { it.second[ExtensionTable.isInstalled] } .groupBy { it.second[ExtensionTable.isInstalled] }
val installedExtensionsToUpdate = extensionsInstalled[true].orEmpty() val installedExtensionsToUpdate = extensionsInstalled[true].orEmpty()
if (installedExtensionsToUpdate.isNotEmpty()) { if (installedExtensionsToUpdate.isNotEmpty()) {
BatchUpdateStatement(ExtensionTable) BatchUpdateStatement(ExtensionTable).apply {
.apply {
installedExtensionsToUpdate.forEach { (foundExtension, extensionRecord) -> installedExtensionsToUpdate.forEach { (foundExtension, extensionRecord) ->
addBatch(EntityID(extensionRecord[ExtensionTable.id].value, ExtensionTable)) addBatch(EntityID(extensionRecord[ExtensionTable.id].value, ExtensionTable))
// Always update icon url and repo // Always update icon url and repo
@@ -158,13 +156,12 @@ object ExtensionsList {
} }
} }
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
val extensionsToFullyUpdate = extensionsInstalled[false].orEmpty() val extensionsToFullyUpdate = extensionsInstalled[false].orEmpty()
if (extensionsToFullyUpdate.isNotEmpty()) { if (extensionsToFullyUpdate.isNotEmpty()) {
BatchUpdateStatement(ExtensionTable) BatchUpdateStatement(ExtensionTable).apply {
.apply {
extensionsToFullyUpdate.forEach { (foundExtension, extensionRecord) -> extensionsToFullyUpdate.forEach { (foundExtension, extensionRecord) ->
addBatch(EntityID(extensionRecord[ExtensionTable.id].value, ExtensionTable)) addBatch(EntityID(extensionRecord[ExtensionTable.id].value, ExtensionTable))
// extension is not installed, so we can overwrite the data without a care // extension is not installed, so we can overwrite the data without a care
@@ -177,8 +174,8 @@ object ExtensionsList {
this[ExtensionTable.apkName] = foundExtension.apkName this[ExtensionTable.apkName] = foundExtension.apkName
this[ExtensionTable.iconUrl] = foundExtension.iconUrl this[ExtensionTable.iconUrl] = foundExtension.iconUrl
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
} }
if (extensionsToInsert.isNotEmpty()) { if (extensionsToInsert.isNotEmpty()) {

View File

@@ -14,10 +14,8 @@ import kotlinx.serialization.json.put
import okhttp3.MediaType.Companion.toMediaType import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Request import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.update
import suwayomi.tachidesk.graphql.types.KoSyncStatusPayload import suwayomi.tachidesk.graphql.types.KoSyncStatusPayload
import suwayomi.tachidesk.graphql.types.KoreaderSyncChecksumMethod import suwayomi.tachidesk.graphql.types.KoreaderSyncChecksumMethod
import suwayomi.tachidesk.graphql.types.KoreaderSyncConflictStrategy import suwayomi.tachidesk.graphql.types.KoreaderSyncConflictStrategy

View File

@@ -6,17 +6,16 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.v1.jdbc.deleteWhere import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jsoup.Jsoup import org.jsoup.Jsoup
import suwayomi.tachidesk.manga.impl.track.tracker.DeletableTracker import suwayomi.tachidesk.manga.impl.track.tracker.DeletableTracker
import suwayomi.tachidesk.manga.impl.track.tracker.TrackerManager import suwayomi.tachidesk.manga.impl.track.tracker.TrackerManager
@@ -428,8 +427,7 @@ object Track {
fun updateTrackRecords(tracks: List<Track>) = fun updateTrackRecords(tracks: List<Track>) =
transaction { transaction {
if (tracks.isNotEmpty()) { if (tracks.isNotEmpty()) {
BatchUpdateStatement(TrackRecordTable) BatchUpdateStatement(TrackRecordTable).apply {
.apply {
tracks.forEach { tracks.forEach {
addBatch(EntityID(it.id!!, TrackRecordTable)) addBatch(EntityID(it.id!!, TrackRecordTable))
this[remoteId] = it.remote_id this[remoteId] = it.remote_id
@@ -444,8 +442,8 @@ object Track {
this[finishDate] = it.finished_reading_date this[finishDate] = it.finished_reading_date
this[private] = it.private this[private] = it.private
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
} }

View File

@@ -1,9 +1,11 @@
package suwayomi.tachidesk.manga.impl.track.tracker.model package suwayomi.tachidesk.manga.impl.track.tracker.model
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.manga.impl.backup.proto.models.BackupTracking import suwayomi.tachidesk.manga.impl.backup.proto.models.BackupTracking
import suwayomi.tachidesk.manga.model.dataclass.TrackRecordDataClass import suwayomi.tachidesk.manga.model.dataclass.TrackRecordDataClass
import suwayomi.tachidesk.manga.model.table.TrackRecordTable import suwayomi.tachidesk.manga.model.table.TrackRecordTable
import suwayomi.tachidesk.manga.model.table.TrackRecordTable.lastChapterRead
import suwayomi.tachidesk.manga.model.table.TrackRecordTable.remoteUrl
import suwayomi.tachidesk.manga.model.table.TrackSearchTable import suwayomi.tachidesk.manga.model.table.TrackSearchTable
fun ResultRow.toTrackRecordDataClass(): TrackRecordDataClass = fun ResultRow.toTrackRecordDataClass(): TrackRecordDataClass =

View File

@@ -7,10 +7,10 @@ package suwayomi.tachidesk.manga.impl.util
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
import suwayomi.tachidesk.manga.model.table.ChapterTable import suwayomi.tachidesk.manga.model.table.ChapterTable
import suwayomi.tachidesk.manga.model.table.MangaTable import suwayomi.tachidesk.manga.model.table.MangaTable

View File

@@ -4,11 +4,10 @@ import eu.kanade.tachiyomi.source.local.metadata.COMIC_INFO_FILE
import eu.kanade.tachiyomi.source.local.metadata.ComicInfo import eu.kanade.tachiyomi.source.local.metadata.ComicInfo
import eu.kanade.tachiyomi.source.local.metadata.ComicInfoPublishingStatus import eu.kanade.tachiyomi.source.local.metadata.ComicInfoPublishingStatus
import nl.adaptivity.xmlutil.serialization.XML import nl.adaptivity.xmlutil.serialization.XML
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.model.table.CategoryMangaTable import suwayomi.tachidesk.manga.model.table.CategoryMangaTable
import suwayomi.tachidesk.manga.model.table.CategoryTable import suwayomi.tachidesk.manga.model.table.CategoryTable
import suwayomi.tachidesk.manga.model.table.ChapterTable import suwayomi.tachidesk.manga.model.table.ChapterTable

View File

@@ -7,7 +7,7 @@ package suwayomi.tachidesk.manga.impl.util.lang
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.jdbc.Query import org.jetbrains.exposed.sql.Query
fun Query.isEmpty() = this.empty() fun Query.isEmpty() = this.empty()

View File

@@ -12,9 +12,8 @@ import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.KotlinLogging
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.util.PackageTools.loadExtensionSources import suwayomi.tachidesk.manga.impl.util.PackageTools.loadExtensionSources
import suwayomi.tachidesk.manga.model.table.ExtensionTable import suwayomi.tachidesk.manga.model.table.ExtensionTable
import suwayomi.tachidesk.manga.model.table.SourceTable import suwayomi.tachidesk.manga.model.table.SourceTable

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
object CategoryMangaTable : IntIdTable() { object CategoryMangaTable : IntIdTable() {
val category = reference("category", CategoryTable, ReferenceOption.CASCADE) val category = reference("category", CategoryTable, ReferenceOption.CASCADE)

View File

@@ -7,15 +7,15 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
import suwayomi.tachidesk.manga.model.table.CategoryMetaTable.ref import suwayomi.tachidesk.manga.model.table.CategoryMetaTable.ref
/** /**
* Metadata storage for clients, about Category with id == [ref]. * Metadata storage for clients, about Category with id == [ref].
*/ */
object CategoryMetaTable : IntIdTable() { object CategoryMetaTable : IntIdTable() {
val key = varchar("meta_key", 256) val key = varchar("key", 256)
val value = varchar("value", 4096) val value = varchar("value", 4096)
val ref = reference("category_ref", CategoryTable, ReferenceOption.CASCADE) val ref = reference("category_ref", CategoryTable, ReferenceOption.CASCADE)
} }

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.manga.impl.Category import suwayomi.tachidesk.manga.impl.Category
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
import suwayomi.tachidesk.manga.model.dataclass.IncludeOrExclude import suwayomi.tachidesk.manga.model.dataclass.IncludeOrExclude

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
import suwayomi.tachidesk.manga.model.table.ChapterMetaTable.ref import suwayomi.tachidesk.manga.model.table.ChapterMetaTable.ref
/** /**
@@ -26,7 +26,7 @@ import suwayomi.tachidesk.manga.model.table.ChapterMetaTable.ref
* } * }
*/ */
object ChapterMetaTable : IntIdTable() { object ChapterMetaTable : IntIdTable() {
val key = varchar("meta_key", 256) val key = varchar("key", 256)
val value = varchar("value", 4096) val value = varchar("value", 4096)
val ref = reference("chapter_ref", ChapterTable, ReferenceOption.CASCADE) val ref = reference("chapter_ref", ChapterTable, ReferenceOption.CASCADE)
} }

View File

@@ -7,12 +7,11 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.sql.ReferenceOption
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.Chapter.getChapterMetaMap import suwayomi.tachidesk.manga.impl.Chapter.getChapterMetaMap
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar

View File

@@ -7,7 +7,7 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.dao.id.IntIdTable
object ExtensionTable : IntIdTable() { object ExtensionTable : IntIdTable() {
val apkName = varchar("apk_name", 1024) val apkName = varchar("apk_name", 1024)

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
import suwayomi.tachidesk.manga.model.table.MangaMetaTable.ref import suwayomi.tachidesk.manga.model.table.MangaMetaTable.ref
/** /**
@@ -26,7 +26,7 @@ import suwayomi.tachidesk.manga.model.table.MangaMetaTable.ref
* } * }
*/ */
object MangaMetaTable : IntIdTable() { object MangaMetaTable : IntIdTable() {
val key = varchar("meta_key", 256) val key = varchar("key", 256)
val value = varchar("value", 4096) val value = varchar("value", 4096)
val ref = reference("manga_ref", MangaTable, ReferenceOption.CASCADE) val ref = reference("manga_ref", MangaTable, ReferenceOption.CASCADE)
} }

View File

@@ -9,8 +9,8 @@ package suwayomi.tachidesk.manga.model.table
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.source.model.UpdateStrategy
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.manga.impl.Manga.getMangaMetaMap import suwayomi.tachidesk.manga.impl.Manga.getMangaMetaMap
import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl import suwayomi.tachidesk.manga.impl.MangaList.proxyThumbnailUrl
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
import suwayomi.tachidesk.manga.model.table.columns.unlimitedVarchar import suwayomi.tachidesk.manga.model.table.columns.unlimitedVarchar
object PageTable : IntIdTable() { object PageTable : IntIdTable() {

View File

@@ -7,14 +7,14 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.dao.id.IntIdTable
import suwayomi.tachidesk.manga.model.table.SourceMetaTable.ref import suwayomi.tachidesk.manga.model.table.ChapterMetaTable.ref
/** /**
* Metadata storage for clients, about Source with id == [ref]. * Metadata storage for clients, about Source with id == [ref].
*/ */
object SourceMetaTable : IntIdTable() { object SourceMetaTable : IntIdTable() {
val key = varchar("meta_key", 256) val key = varchar("key", 256)
val value = varchar("value", 4096) val value = varchar("value", 4096)
val ref = long("source_ref") val ref = long("source_ref")
} }

View File

@@ -7,7 +7,7 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.dao.id.IdTable import org.jetbrains.exposed.dao.id.IdTable
object SourceTable : IdTable<Long>() { object SourceTable : IdTable<Long>() {
override val id = long("id").entityId() override val id = long("id").entityId()

View File

@@ -7,8 +7,8 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ReferenceOption import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.ReferenceOption
import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar
object TrackRecordTable : IntIdTable() { object TrackRecordTable : IntIdTable() {

View File

@@ -7,16 +7,14 @@ package suwayomi.tachidesk.manga.model.table
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.v1.core.ResultRow import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.v1.core.statements.BatchUpdateStatement import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.v1.jdbc.batchInsert import org.jetbrains.exposed.sql.statements.BatchUpdateStatement
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.statements.toExecutable
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import suwayomi.tachidesk.manga.impl.track.tracker.model.TrackSearch import suwayomi.tachidesk.manga.impl.track.tracker.model.TrackSearch
import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar
@@ -71,8 +69,7 @@ fun List<TrackSearch>.insertAll(): List<ResultRow> {
val toUpdate = grouped[true] val toUpdate = grouped[true]
val toInsert = grouped[false]?.map { it.second } val toInsert = grouped[false]?.map { it.second }
if (!toUpdate.isNullOrEmpty()) { if (!toUpdate.isNullOrEmpty()) {
BatchUpdateStatement(TrackSearchTable) BatchUpdateStatement(TrackSearchTable).apply {
.apply {
toUpdate.forEach { (id, trackSearch) -> toUpdate.forEach { (id, trackSearch) ->
id ?: return@forEach id ?: return@forEach
addBatch(EntityID(id, TrackSearchTable)) addBatch(EntityID(id, TrackSearchTable))
@@ -94,8 +91,8 @@ fun List<TrackSearch>.insertAll(): List<ResultRow> {
this[TrackSearchTable.authors] = trackSearch.authors.ifEmpty { null }?.joinToString(",") this[TrackSearchTable.authors] = trackSearch.authors.ifEmpty { null }?.joinToString(",")
this[TrackSearchTable.artists] = trackSearch.artists.ifEmpty { null }?.joinToString(",") this[TrackSearchTable.artists] = trackSearch.artists.ifEmpty { null }?.joinToString(",")
} }
}.toExecutable() execute(this@transaction)
.execute(this@transaction) }
} }
val insertedRows = val insertedRows =
if (!toInsert.isNullOrEmpty()) { if (!toInsert.isNullOrEmpty()) {

Some files were not shown because too many files have changed in this diff Show More