From 1729847937c1f657cc634ef71ebedb02f63b1aa8 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Tue, 25 May 2021 18:09:25 -0400 Subject: [PATCH 1/7] Allow building without git access (#98) Just something SY needs... --- server/build.gradle.kts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/build.gradle.kts b/server/build.gradle.kts index a055204..a7665af 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -96,7 +96,8 @@ sourceSets { val tachideskVersion = "v0.3.9" // counts commit count on master -val tachideskRevision = Runtime +val tachideskRevision = runCatching { + Runtime .getRuntime() .exec("git rev-list HEAD --count") .let { process -> @@ -108,6 +109,7 @@ val tachideskRevision = Runtime "r" + output.trim() } +}.getOrDefault("r0") buildConfig { clsName = "BuildConfig" From f3999cf2d9b54b53bdce9b489cf7185ef1ef573c Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Wed, 26 May 2021 02:48:13 +0430 Subject: [PATCH 2/7] [SKIP CI] update docker info --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91276ed..3db9755 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ yay -S tachidesk ``` ### Docker -Check [arbuilder's repo](https://github.com/arbuilder/Tachidesk-docker) out for more details and the dockerfile. +Check this [github package](https://github.com/orgs/Suwayomi/packages/container/package/tachidesk) or our [dockerhub](https://hub.docker.com/repository/docker/suwayomi/tachidesk) for installation. Source code for containers is available at [this repository](https://github.com/Suwayomi/docker-tachidesk). ### Using Tachidesk Remotely You can run Tachidesk on your computer or a server and connect to it remotely through the web interface with a web browser on any device including a mobile or tablet or even your smart TV!, this method of using Tachidesk is only recommended if you are a power user and know what you are doing. From ef07b9b4ce113c597a3d6daa95267d6cff75b59f Mon Sep 17 00:00:00 2001 From: arbuilder <78140816+arbuilder@users.noreply.github.com> Date: Wed, 26 May 2021 12:00:13 +0530 Subject: [PATCH 3/7] [SKIP CI] Update Docker info (#99) * Update README.md update docker info * [SKIP CI] update docker info * [SKIP CI] Update Readme change to small case --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3db9755..63258d1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,16 @@ yay -S tachidesk ``` ### Docker -Check this [github package](https://github.com/orgs/Suwayomi/packages/container/package/tachidesk) or our [dockerhub](https://hub.docker.com/repository/docker/suwayomi/tachidesk) for installation. Source code for containers is available at [this repository](https://github.com/Suwayomi/docker-tachidesk). +Check our Offical Docker release [Tachidesk Container](https://github.com/orgs/Suwayomi/packages/container/package/tachidesk) or use [arbuilder's](https://github.com/arbuilder/Tachidesk-docker) tachidesk docker repo for installation. Source code for our container is available at [docker-tachidesk](https://github.com/Suwayomi/docker-tachidesk). By default the server will be running on http://localhost:4567 open this url in your browser. + +Install from the command line: +``` + $ docker pull ghcr.io/suwayomi/tachidesk +``` +Run Container from the command line: +``` + $ docker run -p 4567:4567 ghcr.io/suwayomi/tachidesk +``` ### Using Tachidesk Remotely You can run Tachidesk on your computer or a server and connect to it remotely through the web interface with a web browser on any device including a mobile or tablet or even your smart TV!, this method of using Tachidesk is only recommended if you are a power user and know what you are doing. From 0ffbe194fac882ff37d270290a33d1fb5eda36aa Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 27 May 2021 01:55:21 +0430 Subject: [PATCH 4/7] move packages --- server/build.gradle.kts | 8 +- .../{ir/armor/tachidesk => suwayomi}/Main.kt | 6 +- .../kotlin/suwayomi/server/JavalinSetup.kt | 79 ++++++++ .../server/ServerConfig.kt | 2 +- .../server/ServerSetup.kt | 8 +- .../server/impl}/About.kt | 4 +- .../server/util/AppExit.kt | 2 +- .../server/util/AppMutex.kt | 20 +- .../server/util/Browser.kt | 4 +- .../server/util/SystemTray.kt | 12 +- .../tachidesk/TachideskAPI.kt} | 185 ++++++------------ .../tachidesk/impl/Category.kt | 12 +- .../tachidesk/impl/CategoryManga.kt | 14 +- .../tachidesk/impl/Chapter.kt | 18 +- .../tachidesk/impl/Library.kt | 14 +- .../tachidesk/impl/Manga.kt | 24 +-- .../tachidesk/impl/MangaList.kt | 14 +- .../armor => suwayomi}/tachidesk/impl/Page.kt | 18 +- .../tachidesk/impl/Search.kt | 10 +- .../tachidesk/impl/Source.kt | 12 +- .../tachidesk/impl/backup/BackupFlags.kt | 2 +- .../impl/backup/legacy/LegacyBackupBase.kt | 22 +-- .../impl/backup/legacy/LegacyBackupExport.kt | 26 +-- .../impl/backup/legacy/LegacyBackupImport.kt | 34 ++-- .../backup/legacy/LegacyBackupValidator.kt | 6 +- .../impl/backup/legacy/models/Backup.kt | 2 +- .../impl/backup/legacy/models/DHistory.kt | 2 +- .../legacy/serializer/CategoryTypeAdapter.kt | 4 +- .../legacy/serializer/ChapterTypeAdapter.kt | 4 +- .../legacy/serializer/HistoryTypeAdapter.kt | 4 +- .../legacy/serializer/MangaTypeAdapter.kt | 4 +- .../legacy/serializer/TrackTypeAdapter.kt | 4 +- .../tachidesk/impl/backup/models/Category.kt | 2 +- .../impl/backup/models/CategoryImpl.kt | 2 +- .../tachidesk/impl/backup/models/Chapter.kt | 2 +- .../impl/backup/models/ChapterImpl.kt | 4 +- .../tachidesk/impl/backup/models/History.kt | 2 +- .../impl/backup/models/HistoryImpl.kt | 2 +- .../impl/backup/models/LibraryManga.kt | 2 +- .../tachidesk/impl/backup/models/Manga.kt | 3 +- .../impl/backup/models/MangaCategory.kt | 2 +- .../impl/backup/models/MangaChapter.kt | 2 +- .../impl/backup/models/MangaChapterHistory.kt | 2 +- .../tachidesk/impl/backup/models/MangaImpl.kt | 4 +- .../tachidesk/impl/backup/models/Track.kt | 2 +- .../tachidesk/impl/backup/models/TrackImpl.kt | 2 +- .../tachidesk/impl/download/Downloader.kt | 2 +- .../tachidesk/impl/extension/Extension.kt | 36 ++-- .../impl/extension/ExtensionsList.kt | 12 +- .../github/AnimeExtensionGithubApi.kt | 80 ++++++++ .../extension/github/ExtensionGithubApi.kt | 53 +---- .../impl/extension/github/OnlineExtension.kt | 2 +- .../tachidesk/impl/util/GetHttpSource.kt | 10 +- .../tachidesk/impl/util/PackageTools.kt | 9 +- .../impl/util/lang/RxCoroutineBridge.kt | 2 +- .../tachidesk/impl/util/network}/OkHttp.kt | 3 +- .../impl/util/network/UnzippingInterceptor.kt | 49 +++++ .../impl/util/storage/CachedImageResponse.kt | 2 +- .../tachidesk/impl/util/storage/ImageUtil.kt | 14 +- .../impl/util/storage/OkioExtensions.kt | 2 +- .../tachidesk/impl/util/storage/SafePath.kt | 2 +- .../tachidesk/model/database/DBManager.kt | 10 +- .../model/database/migration/M0001_Initial.kt | 12 +- .../M0002_ChapterTableIndexRename.kt | 4 +- .../migration/M0003_DefaultCategory.kt | 12 +- .../model/database/migration/lib/LICENSE | 0 .../model/database/migration/lib/Migration.kt | 2 +- .../database/migration/lib/MigrationEntity.kt | 2 +- .../database/migration/lib/runMigrations.kt | 4 +- .../database/table/CategoryMangaTable.kt | 2 +- .../model/database/table/CategoryTable.kt | 10 +- .../model/database/table/ChapterTable.kt | 24 +-- .../model/database/table/ExtensionTable.kt | 2 +- .../model/database/table/MangaTable.kt | 27 +-- .../model/database/table/PageTable.kt | 2 +- .../model/database/table/SourceTable.kt | 2 +- .../model/dataclass/CategoryDataClass.kt | 2 +- .../model/dataclass/ChapterDataClass.kt | 2 +- .../model/dataclass/ExtensionDataClass.kt | 2 +- .../model/dataclass/MangaDataClass.kt | 4 +- .../model/dataclass/PageDataClass.kt | 2 +- .../model/dataclass/SourceDataClass.kt | 2 +- .../ir/armor/tachidesk/TestExtensions.kt | 2 +- 83 files changed, 568 insertions(+), 454 deletions(-) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/Main.kt (70%) create mode 100644 server/src/main/kotlin/suwayomi/server/JavalinSetup.kt rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/ServerConfig.kt (96%) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/ServerSetup.kt (94%) rename server/src/main/kotlin/{ir/armor/tachidesk/server/impl_internal => suwayomi/server/impl}/About.kt (89%) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/util/AppExit.kt (90%) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/util/AppMutex.kt (77%) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/util/Browser.kt (93%) rename server/src/main/kotlin/{ir/armor/tachidesk => suwayomi}/server/util/SystemTray.kt (83%) rename server/src/main/kotlin/{ir/armor/tachidesk/server/JavalinSetup.kt => suwayomi/tachidesk/TachideskAPI.kt} (69%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Category.kt (88%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/CategoryManga.kt (86%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Chapter.kt (94%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Library.kt (85%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Manga.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/MangaList.kt (90%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Page.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Search.kt (90%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/Source.kt (82%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/BackupFlags.kt (92%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/LegacyBackupBase.kt (66%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/LegacyBackupExport.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/LegacyBackupImport.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt (93%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/models/Backup.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/models/DHistory.kt (52%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt (85%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt (93%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt (85%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt (88%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt (94%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/Category.kt (88%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/CategoryImpl.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/Chapter.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/ChapterImpl.kt (92%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/History.kt (94%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/HistoryImpl.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/LibraryManga.kt (66%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/Manga.kt (98%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/MangaCategory.kt (88%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/MangaChapter.kt (56%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/MangaChapterHistory.kt (85%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/MangaImpl.kt (95%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/Track.kt (94%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/backup/models/TrackImpl.kt (95%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/download/Downloader.kt (93%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/extension/Extension.kt (89%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/extension/ExtensionsList.kt (94%) create mode 100644 server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/AnimeExtensionGithubApi.kt rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/extension/github/ExtensionGithubApi.kt (61%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/extension/github/OnlineExtension.kt (82%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/GetHttpSource.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/PackageTools.kt (95%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/lang/RxCoroutineBridge.kt (98%) rename server/src/main/kotlin/{ir/armor/tachidesk/impl/util => suwayomi/tachidesk/impl/util/network}/OkHttp.kt (95%) create mode 100644 server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/UnzippingInterceptor.kt rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/storage/CachedImageResponse.kt (98%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/storage/ImageUtil.kt (82%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/storage/OkioExtensions.kt (96%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/impl/util/storage/SafePath.kt (97%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/DBManager.kt (74%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/M0001_Initial.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt (87%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/M0003_DefaultCategory.kt (86%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/lib/LICENSE (100%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/lib/Migration.kt (93%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/lib/MigrationEntity.kt (95%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/migration/lib/runMigrations.kt (97%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/CategoryMangaTable.kt (90%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/CategoryTable.kt (76%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/ChapterTable.kt (67%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/ExtensionTable.kt (96%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/MangaTable.kt (74%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/PageTable.kt (91%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/database/table/SourceTable.kt (92%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/CategoryDataClass.kt (89%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/ChapterDataClass.kt (95%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/ExtensionDataClass.kt (93%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/MangaDataClass.kt (89%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/PageDataClass.kt (88%) rename server/src/main/kotlin/{ir/armor => suwayomi}/tachidesk/model/dataclass/SourceDataClass.kt (90%) diff --git a/server/build.gradle.kts b/server/build.gradle.kts index a7665af..829836b 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -73,14 +73,14 @@ dependencies { testImplementation(kotlin("test-junit5")) } -val MainClass = "ir.armor.tachidesk.MainKt" +val MainClass = "suwayomi.MainKt" application { mainClass.set(MainClass) // for testing electron // applicationDefaultJvmArgs = listOf( -// "-Dir.armor.tachidesk.webInterface=electron", -// "-Dir.armor.tachidesk.electronPath=/usr/bin/electron" +// "-Dsuwayomi.tachidesk.webInterface=electron", +// "-Dsuwayomi.tachidesk.electronPath=/usr/bin/electron" // ) } @@ -113,7 +113,7 @@ val tachideskRevision = runCatching { buildConfig { clsName = "BuildConfig" - packageName = "ir.armor.tachidesk.server" + packageName = "suwayomi.server" buildConfigField("String", "NAME", rootProject.name) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/Main.kt b/server/src/main/kotlin/suwayomi/Main.kt similarity index 70% rename from server/src/main/kotlin/ir/armor/tachidesk/Main.kt rename to server/src/main/kotlin/suwayomi/Main.kt index c86e7b3..20e196a 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/Main.kt +++ b/server/src/main/kotlin/suwayomi/Main.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk +package suwayomi /* * Copyright (C) Contributors to the Suwayomi project @@ -7,8 +7,8 @@ package ir.armor.tachidesk * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.server.JavalinSetup.javalinSetup -import ir.armor.tachidesk.server.applicationSetup +import suwayomi.server.JavalinSetup.javalinSetup +import suwayomi.server.applicationSetup fun main() { applicationSetup() diff --git a/server/src/main/kotlin/suwayomi/server/JavalinSetup.kt b/server/src/main/kotlin/suwayomi/server/JavalinSetup.kt new file mode 100644 index 0000000..f87ff15 --- /dev/null +++ b/server/src/main/kotlin/suwayomi/server/JavalinSetup.kt @@ -0,0 +1,79 @@ +package suwayomi.server + +import io.javalin.Javalin +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.future.future +import mu.KotlinLogging +import suwayomi.server.util.Browser +import suwayomi.tachidesk.TachideskAPI +import java.io.IOException +import java.util.concurrent.CompletableFuture +import kotlin.concurrent.thread + +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +object JavalinSetup { + private val logger = KotlinLogging.logger {} + + private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO) + + fun future(block: suspend CoroutineScope.() -> T): CompletableFuture { + return scope.future(block = block) + } + + fun javalinSetup() { + var hasWebUiBundled = false + + val app = Javalin.create { config -> + try { + // if the bellow line throws an exception then webUI is not bundled + this::class.java.getResource("/react/index.html") + + // no exception so we can tell javalin to serve webUI + hasWebUiBundled = true + config.addStaticFiles("/react") + config.addSinglePageRoot("/", "/react/index.html") + } catch (e: RuntimeException) { + logger.warn("react build files are missing.") + hasWebUiBundled = false + } + config.enableCorsForAllOrigins() + }.events { event -> + event.serverStarted { + if (hasWebUiBundled && serverConfig.initialOpenInBrowserEnabled) { + Browser.openInBrowser() + } + } + }.start(serverConfig.ip, serverConfig.port) + + // when JVM is prompted to shutdown, stop javalin gracefully + Runtime.getRuntime().addShutdownHook( + thread(start = false) { + app.stop() + } + ) + + app.exception(NullPointerException::class.java) { e, ctx -> + logger.error("NullPointerException while handling the request", e) + ctx.status(404) + } + app.exception(NoSuchElementException::class.java) { e, ctx -> + logger.error("NoSuchElementException while handling the request", e) + ctx.status(404) + } + app.exception(IOException::class.java) { e, ctx -> + logger.error("IOException while handling the request", e) + ctx.status(500) + ctx.result(e.message ?: "Internal Server Error") + } + + TachideskAPI.defineEndpoints(app) + } +} diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerConfig.kt b/server/src/main/kotlin/suwayomi/server/ServerConfig.kt similarity index 96% rename from server/src/main/kotlin/ir/armor/tachidesk/server/ServerConfig.kt rename to server/src/main/kotlin/suwayomi/server/ServerConfig.kt index 1320ed4..640f573 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerConfig.kt +++ b/server/src/main/kotlin/suwayomi/server/ServerConfig.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server +package suwayomi.server /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt b/server/src/main/kotlin/suwayomi/server/ServerSetup.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt rename to server/src/main/kotlin/suwayomi/server/ServerSetup.kt index 699a518..0fc4227 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt +++ b/server/src/main/kotlin/suwayomi/server/ServerSetup.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server +package suwayomi.server /* * Copyright (C) Contributors to the Suwayomi project @@ -8,14 +8,14 @@ package ir.armor.tachidesk.server * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import eu.kanade.tachiyomi.App -import ir.armor.tachidesk.model.database.databaseUp -import ir.armor.tachidesk.server.util.AppMutex.handleAppMutex -import ir.armor.tachidesk.server.util.SystemTray.systemTray import mu.KotlinLogging import org.kodein.di.DI import org.kodein.di.bind import org.kodein.di.conf.global import org.kodein.di.singleton +import suwayomi.server.util.AppMutex.handleAppMutex +import suwayomi.server.util.SystemTray.systemTray +import suwayomi.tachidesk.model.database.databaseUp import xyz.nulldev.androidcompat.AndroidCompat import xyz.nulldev.androidcompat.AndroidCompatInitializer import xyz.nulldev.ts.config.ApplicationRootDir diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt b/server/src/main/kotlin/suwayomi/server/impl/About.kt similarity index 89% rename from server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt rename to server/src/main/kotlin/suwayomi/server/impl/About.kt index 113a674..e0148f7 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt +++ b/server/src/main/kotlin/suwayomi/server/impl/About.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server.impl_internal +package suwayomi.server.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,7 +7,7 @@ package ir.armor.tachidesk.server.impl_internal * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.server.BuildConfig +import suwayomi.server.BuildConfig data class AboutDataClass( val name: String, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/util/AppExit.kt b/server/src/main/kotlin/suwayomi/server/util/AppExit.kt similarity index 90% rename from server/src/main/kotlin/ir/armor/tachidesk/server/util/AppExit.kt rename to server/src/main/kotlin/suwayomi/server/util/AppExit.kt index 96ba1fc..1cb47eb 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/util/AppExit.kt +++ b/server/src/main/kotlin/suwayomi/server/util/AppExit.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server.util +package suwayomi.server.util import mu.KotlinLogging import kotlin.system.exitProcess diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/util/AppMutex.kt b/server/src/main/kotlin/suwayomi/server/util/AppMutex.kt similarity index 77% rename from server/src/main/kotlin/ir/armor/tachidesk/server/util/AppMutex.kt rename to server/src/main/kotlin/suwayomi/server/util/AppMutex.kt index afa6c7f..ae8b2d4 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/util/AppMutex.kt +++ b/server/src/main/kotlin/suwayomi/server/util/AppMutex.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server.util +package suwayomi.server.util /* * Copyright (C) Contributors to the Suwayomi project @@ -8,15 +8,17 @@ package ir.armor.tachidesk.server.util * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import io.javalin.plugin.json.JavalinJackson -import ir.armor.tachidesk.server.impl_internal.AboutDataClass -import ir.armor.tachidesk.server.serverConfig -import ir.armor.tachidesk.server.util.AppMutex.AppMutexStat.Clear -import ir.armor.tachidesk.server.util.AppMutex.AppMutexStat.OtherApplicationRunning -import ir.armor.tachidesk.server.util.AppMutex.AppMutexStat.TachideskInstanceRunning -import ir.armor.tachidesk.server.util.Browser.openInBrowser import mu.KotlinLogging import okhttp3.OkHttpClient import okhttp3.Request.Builder +import suwayomi.server.impl.AboutDataClass +import suwayomi.server.serverConfig +import suwayomi.server.util.AppMutex.AppMutexStat.Clear +import suwayomi.server.util.AppMutex.AppMutexStat.OtherApplicationRunning +import suwayomi.server.util.AppMutex.AppMutexStat.TachideskInstanceRunning +import suwayomi.server.util.Browser.openInBrowser +import suwayomi.server.util.ExitCode.MutexCheckFailedAnotherAppRunning +import suwayomi.server.util.ExitCode.MutexCheckFailedTachideskRunning import java.io.IOException import java.util.concurrent.TimeUnit @@ -67,11 +69,11 @@ object AppMutex { logger.info("Aborting startup.") - shutdownApp(ExitCode.MutexCheckFailedTachideskRunning) + shutdownApp(MutexCheckFailedTachideskRunning) } OtherApplicationRunning -> { logger.error("A non Tachidesk application is running on $appIP:${serverConfig.port}, aborting startup.") - shutdownApp(ExitCode.MutexCheckFailedAnotherAppRunning) + shutdownApp(MutexCheckFailedAnotherAppRunning) } } } diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/util/Browser.kt b/server/src/main/kotlin/suwayomi/server/util/Browser.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/server/util/Browser.kt rename to server/src/main/kotlin/suwayomi/server/util/Browser.kt index 6f916a0..6a04cf1 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/util/Browser.kt +++ b/server/src/main/kotlin/suwayomi/server/util/Browser.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server.util +package suwayomi.server.util /* * Copyright (C) Contributors to the Suwayomi project @@ -8,7 +8,7 @@ package ir.armor.tachidesk.server.util * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import dorkbox.util.Desktop -import ir.armor.tachidesk.server.serverConfig +import suwayomi.server.serverConfig object Browser { private val appIP = if (serverConfig.ip == "0.0.0.0") "127.0.0.1" else serverConfig.ip diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt b/server/src/main/kotlin/suwayomi/server/util/SystemTray.kt similarity index 83% rename from server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt rename to server/src/main/kotlin/suwayomi/server/util/SystemTray.kt index c6356e3..9b03a39 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt +++ b/server/src/main/kotlin/suwayomi/server/util/SystemTray.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.server.util +package suwayomi.server.util /* * Copyright (C) Contributors to the Suwayomi project @@ -10,11 +10,11 @@ package ir.armor.tachidesk.server.util import dorkbox.systemTray.MenuItem import dorkbox.systemTray.SystemTray import dorkbox.util.CacheUtil -import ir.armor.tachidesk.server.BuildConfig -import ir.armor.tachidesk.server.ServerConfig -import ir.armor.tachidesk.server.serverConfig -import ir.armor.tachidesk.server.util.Browser.openInBrowser -import ir.armor.tachidesk.server.util.ExitCode.Success +import suwayomi.server.BuildConfig +import suwayomi.server.ServerConfig +import suwayomi.server.serverConfig +import suwayomi.server.util.Browser.openInBrowser +import suwayomi.server.util.ExitCode.Success object SystemTray { fun systemTray(): SystemTray? { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt b/server/src/main/kotlin/suwayomi/tachidesk/TachideskAPI.kt similarity index 69% rename from server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt rename to server/src/main/kotlin/suwayomi/tachidesk/TachideskAPI.kt index 8e06c2a..6334c3b 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/TachideskAPI.kt @@ -1,116 +1,53 @@ -package ir.armor.tachidesk.server - -import io.javalin.Javalin -import ir.armor.tachidesk.impl.Category.createCategory -import ir.armor.tachidesk.impl.Category.getCategoryList -import ir.armor.tachidesk.impl.Category.removeCategory -import ir.armor.tachidesk.impl.Category.reorderCategory -import ir.armor.tachidesk.impl.Category.updateCategory -import ir.armor.tachidesk.impl.CategoryManga.addMangaToCategory -import ir.armor.tachidesk.impl.CategoryManga.getCategoryMangaList -import ir.armor.tachidesk.impl.CategoryManga.getMangaCategories -import ir.armor.tachidesk.impl.CategoryManga.removeMangaFromCategory -import ir.armor.tachidesk.impl.Chapter.getChapter -import ir.armor.tachidesk.impl.Chapter.getChapterList -import ir.armor.tachidesk.impl.Chapter.modifyChapter -import ir.armor.tachidesk.impl.Library -import ir.armor.tachidesk.impl.Library.getLibraryMangas -import ir.armor.tachidesk.impl.Manga.getManga -import ir.armor.tachidesk.impl.Manga.getMangaThumbnail -import ir.armor.tachidesk.impl.MangaList.getMangaList -import ir.armor.tachidesk.impl.Page.getPageImage -import ir.armor.tachidesk.impl.Search.sourceFilters -import ir.armor.tachidesk.impl.Search.sourceGlobalSearch -import ir.armor.tachidesk.impl.Search.sourceSearch -import ir.armor.tachidesk.impl.Source.getSource -import ir.armor.tachidesk.impl.Source.getSourceList -import ir.armor.tachidesk.impl.backup.BackupFlags -import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupExport.createLegacyBackup -import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupImport.restoreLegacyBackup -import ir.armor.tachidesk.impl.extension.Extension.getExtensionIcon -import ir.armor.tachidesk.impl.extension.Extension.installExtension -import ir.armor.tachidesk.impl.extension.Extension.uninstallExtension -import ir.armor.tachidesk.impl.extension.Extension.updateExtension -import ir.armor.tachidesk.impl.extension.ExtensionsList.getExtensionList -import ir.armor.tachidesk.server.impl_internal.About.getAbout -import ir.armor.tachidesk.server.util.Browser -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.future.future -import mu.KotlinLogging -import java.io.IOException -import java.text.SimpleDateFormat -import java.util.Date -import java.util.concurrent.CompletableFuture -import kotlin.concurrent.thread +package suwayomi.tachidesk /* * Copyright (C) Contributors to the Suwayomi project - * + * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -object JavalinSetup { - private val logger = KotlinLogging.logger {} - - private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO) - - private fun future(block: suspend CoroutineScope.() -> T): CompletableFuture { - return scope.future(block = block) - } - - fun javalinSetup() { - var hasWebUiBundled = false - - val app = Javalin.create { config -> - try { - // if the bellow line throws an exception then webUI is not bundled - this::class.java.getResource("/react/index.html") - - // no exception so we can tell javalin to serve webUI - hasWebUiBundled = true - config.addStaticFiles("/react") - config.addSinglePageRoot("/", "/react/index.html") - } catch (e: RuntimeException) { - logger.warn("react build files are missing.") - hasWebUiBundled = false - } - config.enableCorsForAllOrigins() - }.events { event -> - event.serverStarted { - if (hasWebUiBundled && serverConfig.initialOpenInBrowserEnabled) { - Browser.openInBrowser() - } - } - }.start(serverConfig.ip, serverConfig.port) - - // when JVM is prompted to shutdown, stop javalin gracefully - Runtime.getRuntime().addShutdownHook( - thread(start = false) { - app.stop() - } - ) - - app.exception(NullPointerException::class.java) { e, ctx -> - logger.error("NullPointerException while handling the request", e) - ctx.status(404) - } - app.exception(NoSuchElementException::class.java) { e, ctx -> - logger.error("NoSuchElementException while handling the request", e) - ctx.status(404) - } - app.exception(IOException::class.java) { e, ctx -> - logger.error("IOException while handling the request", e) - ctx.status(500) - ctx.result(e.message ?: "Internal Server Error") - } +import io.javalin.Javalin +import suwayomi.server.JavalinSetup +import suwayomi.server.JavalinSetup.future +import suwayomi.server.impl.About +import suwayomi.tachidesk.impl.Category +import suwayomi.tachidesk.impl.CategoryManga.addMangaToCategory +import suwayomi.tachidesk.impl.CategoryManga.getCategoryMangaList +import suwayomi.tachidesk.impl.CategoryManga.getMangaCategories +import suwayomi.tachidesk.impl.CategoryManga.removeMangaFromCategory +import suwayomi.tachidesk.impl.Chapter.getChapter +import suwayomi.tachidesk.impl.Chapter.getChapterList +import suwayomi.tachidesk.impl.Chapter.modifyChapter +import suwayomi.tachidesk.impl.Library.addMangaToLibrary +import suwayomi.tachidesk.impl.Library.getLibraryMangas +import suwayomi.tachidesk.impl.Library.removeMangaFromLibrary +import suwayomi.tachidesk.impl.Manga.getManga +import suwayomi.tachidesk.impl.Manga.getMangaThumbnail +import suwayomi.tachidesk.impl.MangaList.getMangaList +import suwayomi.tachidesk.impl.Page.getPageImage +import suwayomi.tachidesk.impl.Search.sourceFilters +import suwayomi.tachidesk.impl.Search.sourceGlobalSearch +import suwayomi.tachidesk.impl.Search.sourceSearch +import suwayomi.tachidesk.impl.Source.getSource +import suwayomi.tachidesk.impl.Source.getSourceList +import suwayomi.tachidesk.impl.backup.BackupFlags +import suwayomi.tachidesk.impl.backup.legacy.LegacyBackupExport.createLegacyBackup +import suwayomi.tachidesk.impl.backup.legacy.LegacyBackupImport.restoreLegacyBackup +import suwayomi.tachidesk.impl.extension.Extension.getExtensionIcon +import suwayomi.tachidesk.impl.extension.Extension.installExtension +import suwayomi.tachidesk.impl.extension.Extension.uninstallExtension +import suwayomi.tachidesk.impl.extension.Extension.updateExtension +import suwayomi.tachidesk.impl.extension.ExtensionsList.getExtensionList +import java.text.SimpleDateFormat +import java.util.Date +object TachideskAPI { + fun defineEndpoints(app: Javalin) { // list all extensions app.get("/api/v1/extension/list") { ctx -> ctx.json( - future { + JavalinSetup.future { getExtensionList() } ) @@ -121,7 +58,7 @@ object JavalinSetup { val pkgName = ctx.pathParam("pkgName") ctx.json( - future { + JavalinSetup.future { installExtension(pkgName) } ) @@ -132,7 +69,7 @@ object JavalinSetup { val pkgName = ctx.pathParam("pkgName") ctx.json( - future { + JavalinSetup.future { updateExtension(pkgName) } ) @@ -151,7 +88,7 @@ object JavalinSetup { val apkName = ctx.pathParam("apkName") ctx.result( - future { getExtensionIcon(apkName) } + JavalinSetup.future { getExtensionIcon(apkName) } .thenApply { ctx.header("content-type", it.second) it.first @@ -175,7 +112,7 @@ object JavalinSetup { val sourceId = ctx.pathParam("sourceId").toLong() val pageNum = ctx.pathParam("pageNum").toInt() ctx.json( - future { + JavalinSetup.future { getMangaList(sourceId, pageNum, popular = true) } ) @@ -186,7 +123,7 @@ object JavalinSetup { val sourceId = ctx.pathParam("sourceId").toLong() val pageNum = ctx.pathParam("pageNum").toInt() ctx.json( - future { + JavalinSetup.future { getMangaList(sourceId, pageNum, popular = false) } ) @@ -198,7 +135,7 @@ object JavalinSetup { val onlineFetch = ctx.queryParam("onlineFetch", "false").toBoolean() ctx.json( - future { + JavalinSetup.future { getManga(mangaId, onlineFetch) } ) @@ -209,7 +146,7 @@ object JavalinSetup { val mangaId = ctx.pathParam("mangaId").toInt() ctx.result( - future { getMangaThumbnail(mangaId) } + JavalinSetup.future { getMangaThumbnail(mangaId) } .thenApply { ctx.header("content-type", it.second) it.first @@ -245,14 +182,14 @@ object JavalinSetup { val onlineFetch = ctx.queryParam("onlineFetch")?.toBoolean() - ctx.json(future { getChapterList(mangaId, onlineFetch) }) + ctx.json(JavalinSetup.future { getChapterList(mangaId, onlineFetch) }) } // used to display a chapter, get a chapter in order to show it's pages app.get("/api/v1/manga/:mangaId/chapter/:chapterIndex") { ctx -> val chapterIndex = ctx.pathParam("chapterIndex").toInt() val mangaId = ctx.pathParam("mangaId").toInt() - ctx.json(future { getChapter(chapterIndex, mangaId) }) + ctx.json(JavalinSetup.future { getChapter(chapterIndex, mangaId) }) } // used to modify a chapter's parameters @@ -277,7 +214,7 @@ object JavalinSetup { val index = ctx.pathParam("index").toInt() ctx.result( - future { getPageImage(mangaId, chapterIndex, index) } + JavalinSetup.future { getPageImage(mangaId, chapterIndex, index) } .thenApply { ctx.header("content-type", it.second) it.first @@ -306,7 +243,7 @@ object JavalinSetup { val sourceId = ctx.pathParam("sourceId").toLong() val searchTerm = ctx.pathParam("searchTerm") val pageNum = ctx.pathParam("pageNum").toInt() - ctx.json(future { sourceSearch(sourceId, searchTerm, pageNum) }) + ctx.json(JavalinSetup.future { sourceSearch(sourceId, searchTerm, pageNum) }) } // source filter list @@ -320,7 +257,7 @@ object JavalinSetup { val mangaId = ctx.pathParam("mangaId").toInt() ctx.result( - future { Library.addMangaToLibrary(mangaId) } + JavalinSetup.future { addMangaToLibrary(mangaId) } ) } @@ -329,7 +266,7 @@ object JavalinSetup { val mangaId = ctx.pathParam("mangaId").toInt() ctx.result( - future { Library.removeMangaFromLibrary(mangaId) } + JavalinSetup.future { removeMangaFromLibrary(mangaId) } ) } @@ -340,19 +277,19 @@ object JavalinSetup { // category list app.get("/api/v1/category/") { ctx -> - ctx.json(getCategoryList()) + ctx.json(Category.getCategoryList()) } // category create app.post("/api/v1/category/") { ctx -> val name = ctx.formParam("name")!! - createCategory(name) + Category.createCategory(name) ctx.status(200) } // returns some static info of the current app build app.get("/api/v1/about/") { ctx -> - ctx.json(getAbout()) + ctx.json(About.getAbout()) } // category modification @@ -360,7 +297,7 @@ object JavalinSetup { val categoryId = ctx.pathParam("categoryId").toInt() val name = ctx.formParam("name") val isDefault = ctx.formParam("default")?.toBoolean() - updateCategory(categoryId, name, isDefault) + Category.updateCategory(categoryId, name, isDefault) ctx.status(200) } @@ -369,14 +306,14 @@ object JavalinSetup { val categoryId = ctx.pathParam("categoryId").toInt() val from = ctx.formParam("from")!!.toInt() val to = ctx.formParam("to")!!.toInt() - reorderCategory(categoryId, from, to) + Category.reorderCategory(categoryId, from, to) ctx.status(200) } // category delete app.delete("/api/v1/category/:categoryId") { ctx -> val categoryId = ctx.pathParam("categoryId").toInt() - removeCategory(categoryId) + Category.removeCategory(categoryId) ctx.status(200) } @@ -398,7 +335,7 @@ object JavalinSetup { // expects a Tachiyomi legacy backup json as a file upload, the file must be named "backup.json" app.post("/api/v1/backup/legacy/import/file") { ctx -> ctx.result( - future { + JavalinSetup.future { restoreLegacyBackup(ctx.uploadedFile("backup.json")!!.content) } ) @@ -408,7 +345,7 @@ object JavalinSetup { app.get("/api/v1/backup/legacy/export") { ctx -> ctx.contentType("application/json") ctx.result( - future { + JavalinSetup.future { createLegacyBackup( BackupFlags( includeManga = true, @@ -430,7 +367,7 @@ object JavalinSetup { ctx.header("Content-Disposition", "attachment; filename=\"tachidesk_$currentDate.json\"") ctx.result( - future { + JavalinSetup.future { createLegacyBackup( BackupFlags( includeManga = true, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Category.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Category.kt similarity index 88% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Category.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Category.kt index 004d437..a16ffea 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Category.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Category.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,11 +7,6 @@ package ir.armor.tachidesk.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.impl.CategoryManga.removeMangaFromCategory -import ir.armor.tachidesk.model.database.table.CategoryMangaTable -import ir.armor.tachidesk.model.database.table.CategoryTable -import ir.armor.tachidesk.model.database.table.toDataClass -import ir.armor.tachidesk.model.dataclass.CategoryDataClass import org.jetbrains.exposed.sql.SortOrder import org.jetbrains.exposed.sql.deleteWhere import org.jetbrains.exposed.sql.insert @@ -19,6 +14,11 @@ import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.impl.CategoryManga.removeMangaFromCategory +import suwayomi.tachidesk.model.database.table.CategoryMangaTable +import suwayomi.tachidesk.model.database.table.CategoryTable +import suwayomi.tachidesk.model.database.table.toDataClass +import suwayomi.tachidesk.model.dataclass.CategoryDataClass object Category { /** diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/CategoryManga.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/CategoryManga.kt similarity index 86% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/CategoryManga.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/CategoryManga.kt index 948eee5..50a8b92 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/CategoryManga.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/CategoryManga.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,12 +7,6 @@ package ir.armor.tachidesk.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.database.table.CategoryMangaTable -import ir.armor.tachidesk.model.database.table.CategoryTable -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.database.table.toDataClass -import ir.armor.tachidesk.model.dataclass.CategoryDataClass -import ir.armor.tachidesk.model.dataclass.MangaDataClass import org.jetbrains.exposed.sql.SortOrder import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.deleteWhere @@ -20,6 +14,12 @@ import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.model.database.table.CategoryMangaTable +import suwayomi.tachidesk.model.database.table.CategoryTable +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.database.table.toDataClass +import suwayomi.tachidesk.model.dataclass.CategoryDataClass +import suwayomi.tachidesk.model.dataclass.MangaDataClass object CategoryManga { fun addMangaToCategory(mangaId: Int, categoryId: Int) { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Chapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Chapter.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Chapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Chapter.kt index 4bb46f3..95d6e1e 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Chapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Chapter.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -9,14 +9,6 @@ package ir.armor.tachidesk.impl import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga -import ir.armor.tachidesk.impl.Manga.getManga -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.model.database.table.ChapterTable -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.database.table.PageTable -import ir.armor.tachidesk.model.database.table.toDataClass -import ir.armor.tachidesk.model.dataclass.ChapterDataClass import org.jetbrains.exposed.sql.SortOrder.DESC import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.deleteWhere @@ -24,6 +16,14 @@ import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.impl.Manga.getManga +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.model.database.table.ChapterTable +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.database.table.PageTable +import suwayomi.tachidesk.model.database.table.toDataClass +import suwayomi.tachidesk.model.dataclass.ChapterDataClass object Chapter { /** get chapter list when showing a manga */ diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Library.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Library.kt similarity index 85% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Library.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Library.kt index c08d39e..053a392 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Library.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Library.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,18 +7,18 @@ package ir.armor.tachidesk.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.impl.Manga.getManga -import ir.armor.tachidesk.model.database.table.CategoryMangaTable -import ir.armor.tachidesk.model.database.table.CategoryTable -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.database.table.toDataClass -import ir.armor.tachidesk.model.dataclass.MangaDataClass import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.deleteWhere import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.impl.Manga.getManga +import suwayomi.tachidesk.model.database.table.CategoryMangaTable +import suwayomi.tachidesk.model.database.table.CategoryTable +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.database.table.toDataClass +import suwayomi.tachidesk.model.dataclass.MangaDataClass object Library { // TODO: `Category.isLanding` is to handle the default categories a new library manga gets, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Manga.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Manga.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Manga.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Manga.kt index cbff693..797ebce 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Manga.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Manga.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -9,23 +9,23 @@ package ir.armor.tachidesk.impl import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.SManga -import ir.armor.tachidesk.impl.MangaList.proxyThumbnailUrl -import ir.armor.tachidesk.impl.Source.getSource -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.await -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.impl.util.storage.CachedImageResponse.clearCachedImage -import ir.armor.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse -import ir.armor.tachidesk.model.database.table.MangaStatus -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.dataclass.MangaDataClass -import ir.armor.tachidesk.server.ApplicationDirs import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update import org.kodein.di.DI import org.kodein.di.conf.global import org.kodein.di.instance +import suwayomi.server.ApplicationDirs +import suwayomi.tachidesk.impl.MangaList.proxyThumbnailUrl +import suwayomi.tachidesk.impl.Source.getSource +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.impl.util.network.await +import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.clearCachedImage +import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse +import suwayomi.tachidesk.model.database.table.MangaStatus +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.dataclass.MangaDataClass import java.io.InputStream object Manga { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/MangaList.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/MangaList.kt similarity index 90% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/MangaList.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/MangaList.kt index c2e4acb..bec7138 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/MangaList.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/MangaList.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -8,15 +8,15 @@ package ir.armor.tachidesk.impl * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import eu.kanade.tachiyomi.source.model.MangasPage -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.model.database.table.MangaStatus -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.dataclass.MangaDataClass -import ir.armor.tachidesk.model.dataclass.PagedMangaListDataClass import org.jetbrains.exposed.sql.insertAndGetId import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.model.database.table.MangaStatus +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.dataclass.MangaDataClass +import suwayomi.tachidesk.model.dataclass.PagedMangaListDataClass object MangaList { fun proxyThumbnailUrl(mangaId: Int): String { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Page.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Page.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Page.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Page.kt index ddba55d..18f71ae 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Page.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Page.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -9,14 +9,6 @@ package ir.armor.tachidesk.impl import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse -import ir.armor.tachidesk.impl.util.storage.SafePath -import ir.armor.tachidesk.model.database.table.ChapterTable -import ir.armor.tachidesk.model.database.table.MangaTable -import ir.armor.tachidesk.model.database.table.PageTable -import ir.armor.tachidesk.server.ApplicationDirs import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction @@ -24,6 +16,14 @@ import org.jetbrains.exposed.sql.update import org.kodein.di.DI import org.kodein.di.conf.global import org.kodein.di.instance +import suwayomi.server.ApplicationDirs +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse +import suwayomi.tachidesk.impl.util.storage.SafePath +import suwayomi.tachidesk.model.database.table.ChapterTable +import suwayomi.tachidesk.model.database.table.MangaTable +import suwayomi.tachidesk.model.database.table.PageTable import java.io.File import java.io.InputStream diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Search.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Search.kt similarity index 90% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Search.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Search.kt index eebc9ce..7d62892 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Search.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Search.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,10 +7,10 @@ package ir.armor.tachidesk.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.impl.MangaList.processEntries -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.model.dataclass.PagedMangaListDataClass +import suwayomi.tachidesk.impl.MangaList.processEntries +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.model.dataclass.PagedMangaListDataClass object Search { // TODO diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Source.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/Source.kt similarity index 82% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/Source.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/Source.kt index 68a1398..b405bd6 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Source.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/Source.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl +package suwayomi.tachidesk.impl /* * Copyright (C) Contributors to the Suwayomi project @@ -7,15 +7,15 @@ package ir.armor.tachidesk.impl * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.impl.extension.Extension.getExtensionIconUrl -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.model.database.table.ExtensionTable -import ir.armor.tachidesk.model.database.table.SourceTable -import ir.armor.tachidesk.model.dataclass.SourceDataClass import mu.KotlinLogging import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.model.database.table.ExtensionTable +import suwayomi.tachidesk.model.database.table.SourceTable +import suwayomi.tachidesk.model.dataclass.SourceDataClass object Source { private val logger = KotlinLogging.logger {} diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/BackupFlags.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/BackupFlags.kt similarity index 92% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/BackupFlags.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/BackupFlags.kt index 45c5014..66171bd 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/BackupFlags.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/BackupFlags.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup +package suwayomi.tachidesk.impl.backup /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupBase.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupBase.kt similarity index 66% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupBase.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupBase.kt index 205ff63..cf09ada 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupBase.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupBase.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.legacy +package suwayomi.tachidesk.impl.backup.legacy /* * Copyright (C) Contributors to the Suwayomi project @@ -11,16 +11,16 @@ import com.github.salomonbrys.kotson.registerTypeAdapter import com.github.salomonbrys.kotson.registerTypeHierarchyAdapter import com.google.gson.Gson import com.google.gson.GsonBuilder -import ir.armor.tachidesk.impl.backup.legacy.models.DHistory -import ir.armor.tachidesk.impl.backup.legacy.serializer.CategoryTypeAdapter -import ir.armor.tachidesk.impl.backup.legacy.serializer.ChapterTypeAdapter -import ir.armor.tachidesk.impl.backup.legacy.serializer.HistoryTypeAdapter -import ir.armor.tachidesk.impl.backup.legacy.serializer.MangaTypeAdapter -import ir.armor.tachidesk.impl.backup.legacy.serializer.TrackTypeAdapter -import ir.armor.tachidesk.impl.backup.models.CategoryImpl -import ir.armor.tachidesk.impl.backup.models.ChapterImpl -import ir.armor.tachidesk.impl.backup.models.MangaImpl -import ir.armor.tachidesk.impl.backup.models.TrackImpl +import suwayomi.tachidesk.impl.backup.legacy.models.DHistory +import suwayomi.tachidesk.impl.backup.legacy.serializer.CategoryTypeAdapter +import suwayomi.tachidesk.impl.backup.legacy.serializer.ChapterTypeAdapter +import suwayomi.tachidesk.impl.backup.legacy.serializer.HistoryTypeAdapter +import suwayomi.tachidesk.impl.backup.legacy.serializer.MangaTypeAdapter +import suwayomi.tachidesk.impl.backup.legacy.serializer.TrackTypeAdapter +import suwayomi.tachidesk.impl.backup.models.CategoryImpl +import suwayomi.tachidesk.impl.backup.models.ChapterImpl +import suwayomi.tachidesk.impl.backup.models.MangaImpl +import suwayomi.tachidesk.impl.backup.models.TrackImpl import java.util.Date open class LegacyBackupBase { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupExport.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupExport.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupExport.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupExport.kt index c8593b4..c873e39 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupExport.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupExport.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.legacy +package suwayomi.tachidesk.impl.backup.legacy /* * Copyright (C) Contributors to the Suwayomi project @@ -12,20 +12,20 @@ import com.google.gson.JsonArray import com.google.gson.JsonElement import com.google.gson.JsonObject import eu.kanade.tachiyomi.source.LocalSource -import ir.armor.tachidesk.impl.Category.getCategoryList -import ir.armor.tachidesk.impl.CategoryManga.getMangaCategories -import ir.armor.tachidesk.impl.backup.BackupFlags -import ir.armor.tachidesk.impl.backup.legacy.models.Backup -import ir.armor.tachidesk.impl.backup.legacy.models.Backup.CURRENT_VERSION -import ir.armor.tachidesk.impl.backup.models.CategoryImpl -import ir.armor.tachidesk.impl.backup.models.ChapterImpl -import ir.armor.tachidesk.impl.backup.models.Manga -import ir.armor.tachidesk.impl.backup.models.MangaImpl -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.model.database.table.ChapterTable -import ir.armor.tachidesk.model.database.table.MangaTable import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.tachidesk.impl.Category.getCategoryList +import suwayomi.tachidesk.impl.CategoryManga.getMangaCategories +import suwayomi.tachidesk.impl.backup.BackupFlags +import suwayomi.tachidesk.impl.backup.legacy.models.Backup +import suwayomi.tachidesk.impl.backup.legacy.models.Backup.CURRENT_VERSION +import suwayomi.tachidesk.impl.backup.models.CategoryImpl +import suwayomi.tachidesk.impl.backup.models.ChapterImpl +import suwayomi.tachidesk.impl.backup.models.Manga +import suwayomi.tachidesk.impl.backup.models.MangaImpl +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.model.database.table.ChapterTable +import suwayomi.tachidesk.model.database.table.MangaTable object LegacyBackupExport : LegacyBackupBase() { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupImport.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupImport.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupImport.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupImport.kt index ace19f2..27c280f 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupImport.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupImport.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.legacy +package suwayomi.tachidesk.impl.backup.legacy import com.github.salomonbrys.kotson.fromJson import com.google.gson.JsonArray @@ -7,28 +7,28 @@ import com.google.gson.JsonObject import com.google.gson.JsonParser import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.model.SManga -import ir.armor.tachidesk.impl.Category.createCategory -import ir.armor.tachidesk.impl.Category.getCategoryList -import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupValidator.ValidationResult -import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupValidator.validate -import ir.armor.tachidesk.impl.backup.legacy.models.Backup -import ir.armor.tachidesk.impl.backup.legacy.models.DHistory -import ir.armor.tachidesk.impl.backup.models.CategoryImpl -import ir.armor.tachidesk.impl.backup.models.Chapter -import ir.armor.tachidesk.impl.backup.models.ChapterImpl -import ir.armor.tachidesk.impl.backup.models.Manga -import ir.armor.tachidesk.impl.backup.models.MangaImpl -import ir.armor.tachidesk.impl.backup.models.Track -import ir.armor.tachidesk.impl.backup.models.TrackImpl -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.model.database.table.MangaTable import mu.KotlinLogging import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.impl.Category.createCategory +import suwayomi.tachidesk.impl.Category.getCategoryList +import suwayomi.tachidesk.impl.backup.legacy.LegacyBackupValidator.ValidationResult +import suwayomi.tachidesk.impl.backup.legacy.LegacyBackupValidator.validate +import suwayomi.tachidesk.impl.backup.legacy.models.Backup +import suwayomi.tachidesk.impl.backup.legacy.models.DHistory +import suwayomi.tachidesk.impl.backup.models.CategoryImpl +import suwayomi.tachidesk.impl.backup.models.Chapter +import suwayomi.tachidesk.impl.backup.models.ChapterImpl +import suwayomi.tachidesk.impl.backup.models.Manga +import suwayomi.tachidesk.impl.backup.models.MangaImpl +import suwayomi.tachidesk.impl.backup.models.Track +import suwayomi.tachidesk.impl.backup.models.TrackImpl +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.model.database.table.MangaTable import java.io.InputStream import java.util.Date diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt index a50ff06..2140a54 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/LegacyBackupValidator.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.legacy +package suwayomi.tachidesk.impl.backup.legacy /* * Copyright (C) Contributors to the Suwayomi project @@ -8,10 +8,10 @@ package ir.armor.tachidesk.impl.backup.legacy * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import com.google.gson.JsonObject -import ir.armor.tachidesk.impl.backup.legacy.models.Backup -import ir.armor.tachidesk.model.database.table.SourceTable import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.tachidesk.impl.backup.legacy.models.Backup +import suwayomi.tachidesk.model.database.table.SourceTable object LegacyBackupValidator { data class ValidationResult(val missingSources: List, val missingTrackers: List) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/Backup.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/Backup.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/Backup.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/Backup.kt index 7ff54b2..9ec848d 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/Backup.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/Backup.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.legacy.models +package suwayomi.tachidesk.impl.backup.legacy.models import java.text.SimpleDateFormat import java.util.Date diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/DHistory.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/DHistory.kt similarity index 52% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/DHistory.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/DHistory.kt index d8483be..ffb1ca6 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/models/DHistory.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/models/DHistory.kt @@ -1,3 +1,3 @@ -package ir.armor.tachidesk.impl.backup.legacy.models +package suwayomi.tachidesk.impl.backup.legacy.models data class DHistory(val url: String, val lastRead: Long) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt similarity index 85% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt index 5440a30..de9d377 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/CategoryTypeAdapter.kt @@ -1,8 +1,8 @@ -package ir.armor.tachidesk.impl.backup.legacy.serializer +package suwayomi.tachidesk.impl.backup.legacy.serializer import com.github.salomonbrys.kotson.typeAdapter import com.google.gson.TypeAdapter -import ir.armor.tachidesk.impl.backup.models.CategoryImpl +import suwayomi.tachidesk.impl.backup.models.CategoryImpl /** * JSON Serializer used to write / read [CategoryImpl] to / from json diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt index 0a0fd3f..202f8d0 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/ChapterTypeAdapter.kt @@ -1,9 +1,9 @@ -package ir.armor.tachidesk.impl.backup.legacy.serializer +package suwayomi.tachidesk.impl.backup.legacy.serializer import com.github.salomonbrys.kotson.typeAdapter import com.google.gson.TypeAdapter import com.google.gson.stream.JsonToken -import ir.armor.tachidesk.impl.backup.models.ChapterImpl +import suwayomi.tachidesk.impl.backup.models.ChapterImpl /** * JSON Serializer used to write / read [ChapterImpl] to / from json diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt similarity index 85% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt index d6709da..91b78f7 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/HistoryTypeAdapter.kt @@ -1,8 +1,8 @@ -package ir.armor.tachidesk.impl.backup.legacy.serializer +package suwayomi.tachidesk.impl.backup.legacy.serializer import com.github.salomonbrys.kotson.typeAdapter import com.google.gson.TypeAdapter -import ir.armor.tachidesk.impl.backup.legacy.models.DHistory +import suwayomi.tachidesk.impl.backup.legacy.models.DHistory /** * JSON Serializer used to write / read [DHistory] to / from json diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt similarity index 88% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt index 331ba27..ccda807 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/MangaTypeAdapter.kt @@ -1,8 +1,8 @@ -package ir.armor.tachidesk.impl.backup.legacy.serializer +package suwayomi.tachidesk.impl.backup.legacy.serializer import com.github.salomonbrys.kotson.typeAdapter import com.google.gson.TypeAdapter -import ir.armor.tachidesk.impl.backup.models.MangaImpl +import suwayomi.tachidesk.impl.backup.models.MangaImpl /** * JSON Serializer used to write / read [MangaImpl] to / from json diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt index 1b57655..f9254d4 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/legacy/serializer/TrackTypeAdapter.kt @@ -1,9 +1,9 @@ -package ir.armor.tachidesk.impl.backup.legacy.serializer +package suwayomi.tachidesk.impl.backup.legacy.serializer import com.github.salomonbrys.kotson.typeAdapter import com.google.gson.TypeAdapter import com.google.gson.stream.JsonToken -import ir.armor.tachidesk.impl.backup.models.TrackImpl +import suwayomi.tachidesk.impl.backup.models.TrackImpl /** * JSON Serializer used to write / read [TrackImpl] to / from json diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Category.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Category.kt similarity index 88% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Category.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Category.kt index b403d92..8e1afa0 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Category.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Category.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models import java.io.Serializable diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/CategoryImpl.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/CategoryImpl.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/CategoryImpl.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/CategoryImpl.kt index 20c0c4e..fc07b2d 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/CategoryImpl.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/CategoryImpl.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models class CategoryImpl : Category { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Chapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Chapter.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Chapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Chapter.kt index 99e21b3..77d8198 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Chapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Chapter.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models import eu.kanade.tachiyomi.source.model.SChapter import java.io.Serializable diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/ChapterImpl.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/ChapterImpl.kt similarity index 92% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/ChapterImpl.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/ChapterImpl.kt index 3b8edad..eaaae6c 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/ChapterImpl.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/ChapterImpl.kt @@ -1,7 +1,7 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models -import ir.armor.tachidesk.model.database.table.ChapterTable import org.jetbrains.exposed.sql.ResultRow +import suwayomi.tachidesk.model.database.table.ChapterTable class ChapterImpl : Chapter { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/History.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/History.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/History.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/History.kt index 25b0f42..a3aa5d0 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/History.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/History.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models import java.io.Serializable diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/HistoryImpl.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/HistoryImpl.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/HistoryImpl.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/HistoryImpl.kt index eb6036d..5caa1df 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/HistoryImpl.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/HistoryImpl.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models /** * Object containing the history statistics of a chapter diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/LibraryManga.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/LibraryManga.kt similarity index 66% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/LibraryManga.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/LibraryManga.kt index 9a5c102..84be436 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/LibraryManga.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/LibraryManga.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models class LibraryManga : MangaImpl() { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Manga.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Manga.kt similarity index 98% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Manga.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Manga.kt index cfa3d06..a9b3f16 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Manga.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Manga.kt @@ -1,6 +1,7 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models import eu.kanade.tachiyomi.source.model.SManga + // import tachiyomi.source.model.MangaInfo interface Manga : SManga { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaCategory.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaCategory.kt similarity index 88% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaCategory.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaCategory.kt index a385edd..34cfcbd 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaCategory.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaCategory.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models class MangaCategory { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapter.kt similarity index 56% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapter.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapter.kt index d77f0e6..9ab3fe4 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapter.kt @@ -1,3 +1,3 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models class MangaChapter(val manga: Manga, val chapter: Chapter) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapterHistory.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapterHistory.kt similarity index 85% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapterHistory.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapterHistory.kt index eb1360f..57b00dd 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaChapterHistory.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaChapterHistory.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models /** * Object containing manga, chapter and history diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaImpl.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaImpl.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaImpl.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaImpl.kt index 13e95ef..6db0b50 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/MangaImpl.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/MangaImpl.kt @@ -1,7 +1,7 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models -import ir.armor.tachidesk.model.database.table.MangaTable import org.jetbrains.exposed.sql.ResultRow +import suwayomi.tachidesk.model.database.table.MangaTable open class MangaImpl : Manga { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Track.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Track.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Track.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Track.kt index a2080a1..155054a 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/Track.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/Track.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models import java.io.Serializable diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/TrackImpl.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/TrackImpl.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/TrackImpl.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/TrackImpl.kt index 9ad51aa..1a54030 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/backup/models/TrackImpl.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/backup/models/TrackImpl.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.backup.models +package suwayomi.tachidesk.impl.backup.models class TrackImpl : Track { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/download/Downloader.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/download/Downloader.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/download/Downloader.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/download/Downloader.kt index b6c83cd..d5e5be6 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/download/Downloader.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/download/Downloader.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.download +package suwayomi.tachidesk.impl.download import org.jetbrains.exposed.sql.ResultRow import java.util.concurrent.LinkedBlockingQueue diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/Extension.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/Extension.kt similarity index 89% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/extension/Extension.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/extension/Extension.kt index 536299e..9e00bb2 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/Extension.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/Extension.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.extension +package suwayomi.tachidesk.impl.extension /* * Copyright (C) Contributors to the Suwayomi project @@ -13,23 +13,6 @@ import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceFactory -import ir.armor.tachidesk.impl.extension.ExtensionsList.extensionTableAsDataClass -import ir.armor.tachidesk.impl.extension.github.ExtensionGithubApi -import ir.armor.tachidesk.impl.util.PackageTools.EXTENSION_FEATURE -import ir.armor.tachidesk.impl.util.PackageTools.LIB_VERSION_MAX -import ir.armor.tachidesk.impl.util.PackageTools.LIB_VERSION_MIN -import ir.armor.tachidesk.impl.util.PackageTools.METADATA_NSFW -import ir.armor.tachidesk.impl.util.PackageTools.METADATA_SOURCE_CLASS -import ir.armor.tachidesk.impl.util.PackageTools.dex2jar -import ir.armor.tachidesk.impl.util.PackageTools.getPackageInfo -import ir.armor.tachidesk.impl.util.PackageTools.getSignatureHash -import ir.armor.tachidesk.impl.util.PackageTools.loadExtensionSources -import ir.armor.tachidesk.impl.util.PackageTools.trustedSignatures -import ir.armor.tachidesk.impl.util.await -import ir.armor.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse -import ir.armor.tachidesk.model.database.table.ExtensionTable -import ir.armor.tachidesk.model.database.table.SourceTable -import ir.armor.tachidesk.server.ApplicationDirs import mu.KotlinLogging import okhttp3.Request import okio.buffer @@ -42,6 +25,23 @@ import org.jetbrains.exposed.sql.update import org.kodein.di.DI import org.kodein.di.conf.global import org.kodein.di.instance +import suwayomi.server.ApplicationDirs +import suwayomi.tachidesk.impl.extension.ExtensionsList.extensionTableAsDataClass +import suwayomi.tachidesk.impl.extension.github.ExtensionGithubApi +import suwayomi.tachidesk.impl.util.PackageTools.EXTENSION_FEATURE +import suwayomi.tachidesk.impl.util.PackageTools.LIB_VERSION_MAX +import suwayomi.tachidesk.impl.util.PackageTools.LIB_VERSION_MIN +import suwayomi.tachidesk.impl.util.PackageTools.METADATA_NSFW +import suwayomi.tachidesk.impl.util.PackageTools.METADATA_SOURCE_CLASS +import suwayomi.tachidesk.impl.util.PackageTools.dex2jar +import suwayomi.tachidesk.impl.util.PackageTools.getPackageInfo +import suwayomi.tachidesk.impl.util.PackageTools.getSignatureHash +import suwayomi.tachidesk.impl.util.PackageTools.loadExtensionSources +import suwayomi.tachidesk.impl.util.PackageTools.trustedSignatures +import suwayomi.tachidesk.impl.util.network.await +import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse +import suwayomi.tachidesk.model.database.table.ExtensionTable +import suwayomi.tachidesk.model.database.table.SourceTable import uy.kohesive.injekt.injectLazy import java.io.File import java.io.InputStream diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/ExtensionsList.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/ExtensionsList.kt similarity index 94% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/extension/ExtensionsList.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/extension/ExtensionsList.kt index f807412..a17b777 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/ExtensionsList.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/ExtensionsList.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.extension +package suwayomi.tachidesk.impl.extension /* * Copyright (C) Contributors to the Suwayomi project @@ -7,11 +7,6 @@ package ir.armor.tachidesk.impl.extension * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.impl.extension.Extension.getExtensionIconUrl -import ir.armor.tachidesk.impl.extension.github.ExtensionGithubApi -import ir.armor.tachidesk.impl.extension.github.OnlineExtension -import ir.armor.tachidesk.model.database.table.ExtensionTable -import ir.armor.tachidesk.model.dataclass.ExtensionDataClass import mu.KotlinLogging import org.jetbrains.exposed.sql.deleteWhere import org.jetbrains.exposed.sql.insert @@ -19,6 +14,11 @@ import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.update +import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl +import suwayomi.tachidesk.impl.extension.github.ExtensionGithubApi +import suwayomi.tachidesk.impl.extension.github.OnlineExtension +import suwayomi.tachidesk.model.database.table.ExtensionTable +import suwayomi.tachidesk.model.dataclass.ExtensionDataClass import java.util.concurrent.ConcurrentHashMap object ExtensionsList { diff --git a/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/AnimeExtensionGithubApi.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/AnimeExtensionGithubApi.kt new file mode 100644 index 0000000..50920d8 --- /dev/null +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/AnimeExtensionGithubApi.kt @@ -0,0 +1,80 @@ +package suwayomi.tachidesk.impl.extension.github + +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +import com.github.salomonbrys.kotson.int +import com.github.salomonbrys.kotson.string +import com.google.gson.JsonArray +import com.google.gson.JsonParser +import eu.kanade.tachiyomi.network.NetworkHelper +import okhttp3.Request +import suwayomi.tachidesk.impl.util.network.UnzippingInterceptor +import suwayomi.tachidesk.model.dataclass.ExtensionDataClass +import uy.kohesive.injekt.injectLazy + +object AnimeExtensionGithubApi { + const val BASE_URL = "https://raw.githubusercontent.com" + const val REPO_URL_PREFIX = "$BASE_URL/jmir1/tachiyomi-extensions/repo" + + private const val LIB_VERSION_MIN = 1.3 + private const val LIB_VERSION_MAX = 1.3 + + private fun parseResponse(json: JsonArray): List { + return json + .map { it.asJsonObject } + .filter { element -> + val versionName = element["version"].string + val libVersion = versionName.substringBeforeLast('.').toDouble() + libVersion in LIB_VERSION_MIN..LIB_VERSION_MAX + } + .map { element -> + val name = element["name"].string.substringAfter("Tachiyomi: ") + val pkgName = element["pkg"].string + val apkName = element["apk"].string + val versionName = element["version"].string + val versionCode = element["code"].int + val lang = element["lang"].string + val nsfw = element["nsfw"].int == 1 + val icon = "$REPO_URL_PREFIX/icon/${apkName.replace(".apk", ".png")}" + + OnlineExtension(name, pkgName, versionName, versionCode, lang, nsfw, apkName, icon) + } + } + + suspend fun findExtensions(): List { + val response = getRepo() + return parseResponse(response) + } + + fun getApkUrl(extension: ExtensionDataClass): String { + return "$REPO_URL_PREFIX/apk/${extension.apkName}" + } + + private val client by lazy { + val network: NetworkHelper by injectLazy() + network.client.newBuilder() + .addNetworkInterceptor { chain -> + val originalResponse = chain.proceed(chain.request()) + originalResponse.newBuilder() + .header("Content-Encoding", "gzip") + .header("Content-Type", "application/json") + .build() + } + .addInterceptor(UnzippingInterceptor()) + .build() + } + + private fun getRepo(): com.google.gson.JsonArray { + val request = Request.Builder() + .url("$REPO_URL_PREFIX/index.json.gz") + .build() + + val response = client.newCall(request).execute().use { response -> response.body!!.string() } + return JsonParser.parseString(response).asJsonArray + } +} diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/ExtensionGithubApi.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt similarity index 61% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/ExtensionGithubApi.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt index ab3d81e..1439cb9 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/ExtensionGithubApi.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/ExtensionGithubApi.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.extension.github +package suwayomi.tachidesk.impl.extension.github /* * Copyright (C) Contributors to the Suwayomi project @@ -12,32 +12,25 @@ import com.github.salomonbrys.kotson.string import com.google.gson.JsonArray import com.google.gson.JsonParser import eu.kanade.tachiyomi.network.NetworkHelper -import ir.armor.tachidesk.model.dataclass.ExtensionDataClass -import okhttp3.Headers -import okhttp3.Interceptor -import okhttp3.Interceptor.Chain import okhttp3.Request -import okhttp3.Response -import okhttp3.internal.http.RealResponseBody -import okio.GzipSource -import okio.buffer +import suwayomi.tachidesk.impl.util.network.UnzippingInterceptor +import suwayomi.tachidesk.model.dataclass.ExtensionDataClass import uy.kohesive.injekt.injectLazy -import java.io.IOException object ExtensionGithubApi { const val BASE_URL = "https://raw.githubusercontent.com" const val REPO_URL_PREFIX = "$BASE_URL/tachiyomiorg/tachiyomi-extensions/repo" - private const val LIB_VERSION_MIN = "1.2" - private const val LIB_VERSION_MAX = "1.2" + private const val LIB_VERSION_MIN = 1.2 + private const val LIB_VERSION_MAX = 1.2 private fun parseResponse(json: JsonArray): List { return json .map { it.asJsonObject } .filter { element -> val versionName = element["version"].string - val libVersion = versionName.substringBeforeLast('.') - libVersion == LIB_VERSION_MAX + val libVersion = versionName.substringBeforeLast('.').toDouble() + libVersion in LIB_VERSION_MIN..LIB_VERSION_MAX } .map { element -> val name = element["name"].string.substringAfter("Tachiyomi: ") @@ -85,35 +78,3 @@ object ExtensionGithubApi { return JsonParser.parseString(response).asJsonArray } } - -// ref: https://stackoverflow.com/questions/51901333/okhttp-3-how-to-decompress-gzip-deflate-response-manually-using-java-android -private class UnzippingInterceptor : Interceptor { - @Throws(IOException::class) - override fun intercept(chain: Chain): Response { - val response: Response = chain.proceed(chain.request()) - return unzip(response) - } - - @Throws(IOException::class) - private fun unzip(response: Response): Response { - if (response.body == null) { - return response - } - - // check if we have gzip response - val contentEncoding: String? = response.headers["Content-Encoding"] - - // this is used to decompress gzipped responses - return if (contentEncoding != null && contentEncoding == "gzip") { - val body = response.body!! - val contentLength: Long = body.contentLength() - val responseBody = GzipSource(body.source()) - val strippedHeaders: Headers = response.headers.newBuilder().build() - response.newBuilder().headers(strippedHeaders) - .body(RealResponseBody(body.contentType().toString(), contentLength, responseBody.buffer())) - .build() - } else { - response - } - } -} diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/OnlineExtension.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/OnlineExtension.kt similarity index 82% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/OnlineExtension.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/OnlineExtension.kt index 12f9a27..920cf9e 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/extension/github/OnlineExtension.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/extension/github/OnlineExtension.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.extension.github +package suwayomi.tachidesk.impl.extension.github data class OnlineExtension( val name: String, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/GetHttpSource.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/GetHttpSource.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/GetHttpSource.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/GetHttpSource.kt index f309343..40f8651 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/GetHttpSource.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/GetHttpSource.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util +package suwayomi.tachidesk.impl.util /* * Copyright (C) Contributors to the Suwayomi project @@ -10,15 +10,15 @@ package ir.armor.tachidesk.impl.util import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceFactory import eu.kanade.tachiyomi.source.online.HttpSource -import ir.armor.tachidesk.impl.util.PackageTools.loadExtensionSources -import ir.armor.tachidesk.model.database.table.ExtensionTable -import ir.armor.tachidesk.model.database.table.SourceTable -import ir.armor.tachidesk.server.ApplicationDirs import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction import org.kodein.di.DI import org.kodein.di.conf.global import org.kodein.di.instance +import suwayomi.server.ApplicationDirs +import suwayomi.tachidesk.impl.util.PackageTools.loadExtensionSources +import suwayomi.tachidesk.model.database.table.ExtensionTable +import suwayomi.tachidesk.model.database.table.SourceTable import java.util.concurrent.ConcurrentHashMap object GetHttpSource { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/PackageTools.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/PackageTools.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/PackageTools.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/PackageTools.kt index 5382e2c..5e1648a 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/PackageTools.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/PackageTools.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util +package suwayomi.tachidesk.impl.util import android.content.pm.PackageInfo import android.content.pm.Signature @@ -7,7 +7,6 @@ import com.googlecode.d2j.dex.Dex2jar import com.googlecode.d2j.reader.MultiDexFileReader import com.googlecode.dex2jar.tools.BaksmaliBaseDexExceptionHandler import eu.kanade.tachiyomi.util.lang.Hash -import ir.armor.tachidesk.server.ApplicationDirs import mu.KotlinLogging import net.dongliu.apk.parser.ApkFile import net.dongliu.apk.parser.ApkParsers @@ -16,6 +15,7 @@ import org.kodein.di.conf.global import org.kodein.di.instance import org.w3c.dom.Element import org.w3c.dom.Node +import suwayomi.server.ApplicationDirs import xyz.nulldev.androidcompat.pm.InstalledPackage.Companion.toList import xyz.nulldev.androidcompat.pm.toPackageInfo import java.io.File @@ -41,11 +41,12 @@ object PackageTools { const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory" const val METADATA_NSFW = "tachiyomi.extension.nsfw" const val LIB_VERSION_MIN = 1.2 - const val LIB_VERSION_MAX = 1.2 + const val LIB_VERSION_MAX = 1.3 private const val officialSignature = "7ce04da7773d41b489f4693a366c36bcd0a11fc39b547168553c285bd7348e23" // inorichi's key + private const val animeSignature = "50ab1d1e3a20d204d0ad6d334c7691c632e41b98dfa132bf385695fdfa63839c" // jmir1's key private const val unofficialSignature = "64feb21075ba97ebc9cc981243645b331595c111cef1b0d084236a0403b00581" // ArMor's key - var trustedSignatures = mutableSetOf() + officialSignature + unofficialSignature + var trustedSignatures = mutableSetOf() + officialSignature + animeSignature + unofficialSignature /** * Convert dex to jar, a wrapper for the dex2jar library diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/lang/RxCoroutineBridge.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/lang/RxCoroutineBridge.kt similarity index 98% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/lang/RxCoroutineBridge.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/lang/RxCoroutineBridge.kt index cc6c9c6..bd11224 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/lang/RxCoroutineBridge.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/lang/RxCoroutineBridge.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util.lang +package suwayomi.tachidesk.impl.util.lang /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/OkHttp.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/OkHttp.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/OkHttp.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/OkHttp.kt index 5ee5e6e..346f7ac 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/OkHttp.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/OkHttp.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util +package suwayomi.tachidesk.impl.util.network /* * Copyright (C) Contributors to the Suwayomi project @@ -13,7 +13,6 @@ import okhttp3.Callback import okhttp3.Response import okhttp3.internal.closeQuietly import java.io.IOException -import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException // Based on https://github.com/gildor/kotlin-coroutines-okhttp diff --git a/server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/UnzippingInterceptor.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/UnzippingInterceptor.kt new file mode 100644 index 0000000..7efaad8 --- /dev/null +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/network/UnzippingInterceptor.kt @@ -0,0 +1,49 @@ +package suwayomi.tachidesk.impl.util.network + +import okhttp3.Headers +import okhttp3.Interceptor +import okhttp3.Interceptor.Chain +import okhttp3.Response +import okhttp3.internal.http.RealResponseBody +import okio.GzipSource +import okio.buffer +import java.io.IOException + +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// ref: https://stackoverflow.com/questions/51901333/okhttp-3-how-to-decompress-gzip-deflate-response-manually-using-java-android +class UnzippingInterceptor : Interceptor { + @Throws(IOException::class) + override fun intercept(chain: Chain): Response { + val response: Response = chain.proceed(chain.request()) + return unzip(response) + } + + @Throws(IOException::class) + private fun unzip(response: Response): Response { + if (response.body == null) { + return response + } + + // check if we have gzip response + val contentEncoding: String? = response.headers["Content-Encoding"] + + // this is used to decompress gzipped responses + return if (contentEncoding != null && contentEncoding == "gzip") { + val body = response.body!! + val contentLength: Long = body.contentLength() + val responseBody = GzipSource(body.source()) + val strippedHeaders: Headers = response.headers.newBuilder().build() + response.newBuilder().headers(strippedHeaders) + .body(RealResponseBody(body.contentType().toString(), contentLength, responseBody.buffer())) + .build() + } else { + response + } + } +} diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/CachedImageResponse.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/CachedImageResponse.kt similarity index 98% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/CachedImageResponse.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/CachedImageResponse.kt index 8da53c3..87462fe 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/CachedImageResponse.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/CachedImageResponse.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util.storage +package suwayomi.tachidesk.impl.util.storage /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/ImageUtil.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/ImageUtil.kt similarity index 82% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/ImageUtil.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/ImageUtil.kt index cc20a50..943e3d4 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/ImageUtil.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/ImageUtil.kt @@ -1,5 +1,9 @@ -package ir.armor.tachidesk.impl.util.storage +package suwayomi.tachidesk.impl.util.storage +import suwayomi.tachidesk.impl.util.storage.ImageUtil.ImageType.GIF +import suwayomi.tachidesk.impl.util.storage.ImageUtil.ImageType.JPG +import suwayomi.tachidesk.impl.util.storage.ImageUtil.ImageType.PNG +import suwayomi.tachidesk.impl.util.storage.ImageUtil.ImageType.WEBP import java.io.InputStream /* @@ -32,16 +36,16 @@ object ImageUtil { } if (bytes.compareWith(charByteArrayOf(0xFF, 0xD8, 0xFF))) { - return ImageType.JPG + return JPG } if (bytes.compareWith(charByteArrayOf(0x89, 0x50, 0x4E, 0x47))) { - return ImageType.PNG + return PNG } if (bytes.compareWith("GIF8".toByteArray())) { - return ImageType.GIF + return GIF } if (bytes.compareWith("RIFF".toByteArray())) { - return ImageType.WEBP + return WEBP } } catch (e: Exception) { } diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/OkioExtensions.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/OkioExtensions.kt similarity index 96% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/OkioExtensions.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/OkioExtensions.kt index d45e75d..74fff39 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/OkioExtensions.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/OkioExtensions.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util.storage +package suwayomi.tachidesk.impl.util.storage /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/SafePath.kt b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/SafePath.kt similarity index 97% rename from server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/SafePath.kt rename to server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/SafePath.kt index b92e6c2..e70f60e 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/util/storage/SafePath.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/impl/util/storage/SafePath.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.impl.util.storage +package suwayomi.tachidesk.impl.util.storage /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/DBManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/DBManager.kt similarity index 74% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/DBManager.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/DBManager.kt index ed446cb..9aea007 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/DBManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/DBManager.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database +package suwayomi.tachidesk.model.database /* * Copyright (C) Contributors to the Suwayomi project @@ -7,13 +7,13 @@ package ir.armor.tachidesk.model.database * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.database.migration.lib.loadMigrationsFrom -import ir.armor.tachidesk.model.database.migration.lib.runMigrations -import ir.armor.tachidesk.server.ApplicationDirs import org.jetbrains.exposed.sql.Database import org.kodein.di.DI import org.kodein.di.conf.global import org.kodein.di.instance +import suwayomi.server.ApplicationDirs +import suwayomi.tachidesk.model.database.migration.lib.loadMigrationsFrom +import suwayomi.tachidesk.model.database.migration.lib.runMigrations object DBManager { val db by lazy { @@ -27,6 +27,6 @@ fun databaseUp() { val db = DBManager.db db.useNestedTransactions = true - val migrations = loadMigrationsFrom("ir.armor.tachidesk.model.database.migration") + val migrations = loadMigrationsFrom("suwayomi.tachidesk.model.database.migration") runMigrations(migrations) } diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0001_Initial.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0001_Initial.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0001_Initial.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0001_Initial.kt index a893c75..ab8f00a 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0001_Initial.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0001_Initial.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.migration +package suwayomi.tachidesk.model.database.migration /* * Copyright (C) Contributors to the Suwayomi project @@ -8,11 +8,11 @@ package ir.armor.tachidesk.model.database.migration * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import eu.kanade.tachiyomi.source.model.SManga -import ir.armor.tachidesk.model.database.migration.lib.Migration import org.jetbrains.exposed.dao.id.IdTable import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.SchemaUtils import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.tachidesk.model.database.migration.lib.Migration @Suppress("ClassName", "unused") class M0001_Initial : Migration() { @@ -104,10 +104,10 @@ class M0001_Initial : Migration() { } } - private class CategoryMangaTable : IntIdTable() { + private class CategoryMangaTable(categoryTable: CategoryTable, mangaTable: MangaTable) : IntIdTable() { init { - reference("category", ir.armor.tachidesk.model.database.table.CategoryTable) - reference("manga", ir.armor.tachidesk.model.database.table.MangaTable) + reference("category", categoryTable) + reference("manga", mangaTable) } } @@ -120,7 +120,7 @@ class M0001_Initial : Migration() { val chapterTable = ChapterTable(mangaTable) val pageTable = PageTable(chapterTable) val categoryTable = CategoryTable() - val categoryMangaTable = CategoryMangaTable() + val categoryMangaTable = CategoryMangaTable(categoryTable, mangaTable) SchemaUtils.create( extensionTable, sourceTable, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt similarity index 87% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt index fbf40f3..0ffc065 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0002_ChapterTableIndexRename.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.migration +package suwayomi.tachidesk.model.database.migration /* * Copyright (C) Contributors to the Suwayomi project @@ -7,9 +7,9 @@ package ir.armor.tachidesk.model.database.migration * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.database.migration.lib.Migration import org.jetbrains.exposed.sql.transactions.TransactionManager import org.jetbrains.exposed.sql.vendors.currentDialect +import suwayomi.tachidesk.model.database.migration.lib.Migration @Suppress("ClassName", "unused") class M0002_ChapterTableIndexRename : Migration() { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0003_DefaultCategory.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0003_DefaultCategory.kt similarity index 86% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0003_DefaultCategory.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0003_DefaultCategory.kt index 959d959..503bc42 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/M0003_DefaultCategory.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/M0003_DefaultCategory.kt @@ -1,16 +1,16 @@ -package ir.armor.tachidesk.model.database.migration - -import ir.armor.tachidesk.model.database.migration.lib.Migration -import org.jetbrains.exposed.sql.transactions.TransactionManager -import org.jetbrains.exposed.sql.vendors.currentDialect +package suwayomi.tachidesk.model.database.migration /* * Copyright (C) Contributors to the Suwayomi project - * + * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +import org.jetbrains.exposed.sql.transactions.TransactionManager +import org.jetbrains.exposed.sql.vendors.currentDialect +import suwayomi.tachidesk.model.database.migration.lib.Migration + @Suppress("ClassName", "unused") class M0003_DefaultCategory : Migration() { /** this migration renamed CategoryTable.IS_LANDING to ChapterTable.IS_DEFAULT */ diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/LICENSE b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/LICENSE similarity index 100% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/LICENSE rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/LICENSE diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/Migration.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/Migration.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/Migration.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/Migration.kt index 6fe3632..88eb105 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/Migration.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/Migration.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.migration.lib +package suwayomi.tachidesk.model.database.migration.lib /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/MigrationEntity.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/MigrationEntity.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/MigrationEntity.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/MigrationEntity.kt index 6af9f48..44be601 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/MigrationEntity.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/MigrationEntity.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.migration.lib +package suwayomi.tachidesk.model.database.migration.lib /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/runMigrations.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt similarity index 97% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/runMigrations.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt index 94bb4a7..7ddb60d 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/migration/lib/runMigrations.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.migration.lib +package suwayomi.tachidesk.model.database.migration.lib /* * Copyright (C) Contributors to the Suwayomi project @@ -10,7 +10,6 @@ package ir.armor.tachidesk.model.database.migration.lib // originally licenced under MIT by Andreas Mausch, Changes are licenced under Mozilla Public License, v. 2.0. // adopted from: https://gitlab.com/andreas-mausch/exposed-migrations/-/tree/4bf853c18a24d0170eda896ddbb899cb01233595 -import ir.armor.tachidesk.server.ServerConfig import mu.KotlinLogging import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.sql.Database @@ -18,6 +17,7 @@ import org.jetbrains.exposed.sql.SchemaUtils.create import org.jetbrains.exposed.sql.exists import org.jetbrains.exposed.sql.transactions.TransactionManager import org.jetbrains.exposed.sql.transactions.transaction +import suwayomi.server.ServerConfig import java.nio.file.FileSystems import java.nio.file.Files import java.nio.file.Paths diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryMangaTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryMangaTable.kt similarity index 90% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryMangaTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryMangaTable.kt index b7c79a7..f7a922a 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryMangaTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryMangaTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryTable.kt similarity index 76% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryTable.kt index c08177f..9914fe1 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/CategoryTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/CategoryTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project @@ -7,9 +7,9 @@ package ir.armor.tachidesk.model.database.table * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.dataclass.CategoryDataClass import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow +import suwayomi.tachidesk.model.dataclass.CategoryDataClass object CategoryTable : IntIdTable() { val name = varchar("name", 64) @@ -19,7 +19,7 @@ object CategoryTable : IntIdTable() { fun CategoryTable.toDataClass(categoryEntry: ResultRow) = CategoryDataClass( categoryEntry[this.id].value, - categoryEntry[this.order], - categoryEntry[this.name], - categoryEntry[this.isDefault], + categoryEntry[order], + categoryEntry[name], + categoryEntry[isDefault], ) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ChapterTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ChapterTable.kt similarity index 67% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ChapterTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ChapterTable.kt index 404c538..acdf453 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ChapterTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ChapterTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project @@ -7,9 +7,9 @@ package ir.armor.tachidesk.model.database.table * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.dataclass.ChapterDataClass import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow +import suwayomi.tachidesk.model.dataclass.ChapterDataClass object ChapterTable : IntIdTable() { val url = varchar("url", 2048) @@ -30,14 +30,14 @@ object ChapterTable : IntIdTable() { fun ChapterTable.toDataClass(chapterEntry: ResultRow) = ChapterDataClass( - chapterEntry[this.url], - chapterEntry[this.name], - chapterEntry[this.date_upload], - chapterEntry[this.chapter_number], - chapterEntry[this.scanlator], - chapterEntry[this.manga].value, - chapterEntry[this.isRead], - chapterEntry[this.isBookmarked], - chapterEntry[this.lastPageRead], - chapterEntry[this.chapterIndex], + chapterEntry[url], + chapterEntry[name], + chapterEntry[date_upload], + chapterEntry[chapter_number], + chapterEntry[scanlator], + chapterEntry[manga].value, + chapterEntry[isRead], + chapterEntry[isBookmarked], + chapterEntry[lastPageRead], + chapterEntry[chapterIndex], ) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ExtensionTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ExtensionTable.kt similarity index 96% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ExtensionTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ExtensionTable.kt index 79bfba7..c311904 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/ExtensionTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/ExtensionTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/MangaTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/MangaTable.kt similarity index 74% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/MangaTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/MangaTable.kt index c422813..2a27c80 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/MangaTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/MangaTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project @@ -8,10 +8,11 @@ package ir.armor.tachidesk.model.database.table * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import eu.kanade.tachiyomi.source.model.SManga -import ir.armor.tachidesk.impl.MangaList.proxyThumbnailUrl -import ir.armor.tachidesk.model.dataclass.MangaDataClass import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.sql.ResultRow +import suwayomi.tachidesk.impl.MangaList.proxyThumbnailUrl +import suwayomi.tachidesk.model.database.table.MangaStatus.Companion +import suwayomi.tachidesk.model.dataclass.MangaDataClass object MangaTable : IntIdTable() { val url = varchar("url", 2048) @@ -37,20 +38,20 @@ object MangaTable : IntIdTable() { fun MangaTable.toDataClass(mangaEntry: ResultRow) = MangaDataClass( mangaEntry[this.id].value, - mangaEntry[this.sourceReference].toString(), + mangaEntry[sourceReference].toString(), - mangaEntry[this.url], - mangaEntry[this.title], + mangaEntry[url], + mangaEntry[title], proxyThumbnailUrl(mangaEntry[this.id].value), - mangaEntry[this.initialized], + mangaEntry[initialized], - mangaEntry[this.artist], - mangaEntry[this.author], - mangaEntry[this.description], - mangaEntry[this.genre], - MangaStatus.valueOf(mangaEntry[this.status]).name, - mangaEntry[this.inLibrary] + mangaEntry[artist], + mangaEntry[author], + mangaEntry[description], + mangaEntry[genre], + Companion.valueOf(mangaEntry[status]).name, + mangaEntry[inLibrary] ) enum class MangaStatus(val status: Int) { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/PageTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/PageTable.kt similarity index 91% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/PageTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/PageTable.kt index 000cd24..555254d 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/PageTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/PageTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/SourceTable.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/SourceTable.kt similarity index 92% rename from server/src/main/kotlin/ir/armor/tachidesk/model/database/table/SourceTable.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/database/table/SourceTable.kt index cabcb5b..a981ca8 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/database/table/SourceTable.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/table/SourceTable.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.database.table +package suwayomi.tachidesk.model.database.table /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/CategoryDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/CategoryDataClass.kt similarity index 89% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/CategoryDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/CategoryDataClass.kt index 06c6285..00ca692 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/CategoryDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/CategoryDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ChapterDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ChapterDataClass.kt similarity index 95% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ChapterDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ChapterDataClass.kt index 0660782..0c476e8 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ChapterDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ChapterDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ExtensionDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ExtensionDataClass.kt similarity index 93% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ExtensionDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ExtensionDataClass.kt index d0cf103..198ef22 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/ExtensionDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/ExtensionDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/MangaDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/MangaDataClass.kt similarity index 89% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/MangaDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/MangaDataClass.kt index 0474743..48821ce 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/MangaDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/MangaDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project @@ -7,7 +7,7 @@ package ir.armor.tachidesk.model.dataclass * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ir.armor.tachidesk.model.database.table.MangaStatus +import suwayomi.tachidesk.model.database.table.MangaStatus data class MangaDataClass( val id: Int, diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/PageDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/PageDataClass.kt similarity index 88% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/PageDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/PageDataClass.kt index ef326a2..2951853 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/PageDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/PageDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/SourceDataClass.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/SourceDataClass.kt similarity index 90% rename from server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/SourceDataClass.kt rename to server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/SourceDataClass.kt index 6e22584..dd7bd4c 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/model/dataclass/SourceDataClass.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/dataclass/SourceDataClass.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk.model.dataclass +package suwayomi.tachidesk.model.dataclass /* * Copyright (C) Contributors to the Suwayomi project diff --git a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt b/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt index de277fe..e706ac3 100644 --- a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt +++ b/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt @@ -18,7 +18,6 @@ import ir.armor.tachidesk.impl.extension.ExtensionsList.getExtensionList import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource import ir.armor.tachidesk.impl.util.lang.awaitSingle import ir.armor.tachidesk.model.dataclass.ExtensionDataClass -import ir.armor.tachidesk.server.applicationSetup import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll @@ -30,6 +29,7 @@ import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import rx.Observable +import suwayomi.server.applicationSetup import java.io.File @TestInstance(TestInstance.Lifecycle.PER_CLASS) From 24f68b8f1acba503e61764666397d40ea524267e Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 27 May 2021 01:57:40 +0430 Subject: [PATCH 5/7] move packages --- .../tachidesk => suwayomi}/TestExtensions.kt | 18 +++++++++--------- .../armor/tachidesk => suwayomi}/TestUtils.kt | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) rename server/src/test/kotlin/{ir/armor/tachidesk => suwayomi}/TestExtensions.kt (94%) rename server/src/test/kotlin/{ir/armor/tachidesk => suwayomi}/TestUtils.kt (95%) diff --git a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt b/server/src/test/kotlin/suwayomi/TestExtensions.kt similarity index 94% rename from server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt rename to server/src/test/kotlin/suwayomi/TestExtensions.kt index e706ac3..b25f9f7 100644 --- a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt +++ b/server/src/test/kotlin/suwayomi/TestExtensions.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk +package suwayomi /* * Copyright (C) Contributors to the Suwayomi project @@ -10,14 +10,6 @@ package ir.armor.tachidesk import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import ir.armor.tachidesk.impl.Source.getSourceList -import ir.armor.tachidesk.impl.extension.Extension.installExtension -import ir.armor.tachidesk.impl.extension.Extension.uninstallExtension -import ir.armor.tachidesk.impl.extension.Extension.updateExtension -import ir.armor.tachidesk.impl.extension.ExtensionsList.getExtensionList -import ir.armor.tachidesk.impl.util.GetHttpSource.getHttpSource -import ir.armor.tachidesk.impl.util.lang.awaitSingle -import ir.armor.tachidesk.model.dataclass.ExtensionDataClass import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll @@ -30,6 +22,14 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import rx.Observable import suwayomi.server.applicationSetup +import suwayomi.tachidesk.impl.Source.getSourceList +import suwayomi.tachidesk.impl.extension.Extension.installExtension +import suwayomi.tachidesk.impl.extension.Extension.uninstallExtension +import suwayomi.tachidesk.impl.extension.Extension.updateExtension +import suwayomi.tachidesk.impl.extension.ExtensionsList.getExtensionList +import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource +import suwayomi.tachidesk.impl.util.lang.awaitSingle +import suwayomi.tachidesk.model.dataclass.ExtensionDataClass import java.io.File @TestInstance(TestInstance.Lifecycle.PER_CLASS) diff --git a/server/src/test/kotlin/ir/armor/tachidesk/TestUtils.kt b/server/src/test/kotlin/suwayomi/TestUtils.kt similarity index 95% rename from server/src/test/kotlin/ir/armor/tachidesk/TestUtils.kt rename to server/src/test/kotlin/suwayomi/TestUtils.kt index cae702c..8f0cecd 100644 --- a/server/src/test/kotlin/ir/armor/tachidesk/TestUtils.kt +++ b/server/src/test/kotlin/suwayomi/TestUtils.kt @@ -1,4 +1,4 @@ -package ir.armor.tachidesk +package suwayomi /* * Copyright (C) Contributors to the Suwayomi project From 155f9f107d5e1249d2faff5a47372fa34bd5706e Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 27 May 2021 02:07:32 +0430 Subject: [PATCH 6/7] more of package moving --- .../src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt | 2 +- .../Config/src/main/java/xyz/nulldev/ts/config/Logging.kt | 2 +- build.gradle.kts | 2 +- scripts/resources/Tachidesk Debug Launcher.bat | 2 +- scripts/resources/Tachidesk Electron Launcher.bat | 2 +- server/src/main/kotlin/suwayomi/server/util/Browser.kt | 4 ++-- .../tachidesk/model/database/migration/lib/runMigrations.kt | 2 +- server/src/test/kotlin/suwayomi/TestExtensions.kt | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt index cc30fec..c2eecdb 100644 --- a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt +++ b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt @@ -12,7 +12,7 @@ import net.harawata.appdirs.AppDirsFactory val ApplicationRootDir: String get(): String { return System.getProperty( - "ir.armor.tachidesk.rootDir", + "suwayomi.tachidesk.rootDir", AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null) ) } \ No newline at end of file diff --git a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt index a7ea068..efb6398 100644 --- a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt +++ b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt @@ -17,4 +17,4 @@ fun setLogLevel(level: Level) { } fun debugLogsEnabled(config: Config) - = System.getProperty("ir.armor.tachidesk.debugLogsEnabled", config.getString("server.debugLogsEnabled")).toBoolean() \ No newline at end of file + = System.getProperty("suwayomi.tachidesk.debugLogsEnabled", config.getString("server.debugLogsEnabled")).toBoolean() \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2a381c7..f8c4a24 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } allprojects { - group = "ir.armor.tachidesk" + group = "suwayomi" version = "1.0" diff --git a/scripts/resources/Tachidesk Debug Launcher.bat b/scripts/resources/Tachidesk Debug Launcher.bat index d185009..f6e86c3 100644 --- a/scripts/resources/Tachidesk Debug Launcher.bat +++ b/scripts/resources/Tachidesk Debug Launcher.bat @@ -1 +1 @@ -jre\bin\java -Dir.armor.tachidesk.debugLogsEnabled=true -jar Tachidesk.jar +jre\bin\java -Dsuwayomi.tachidesk.debugLogsEnabled=true -jar Tachidesk.jar diff --git a/scripts/resources/Tachidesk Electron Launcher.bat b/scripts/resources/Tachidesk Electron Launcher.bat index 0799e8e..33defed 100644 --- a/scripts/resources/Tachidesk Electron Launcher.bat +++ b/scripts/resources/Tachidesk Electron Launcher.bat @@ -1 +1 @@ -jre\bin\javaw "-Dir.armor.tachidesk.webInterface=electron" "-Dir.armor.tachidesk.electronPath=electron/electron.exe" -jar Tachidesk.jar +jre\bin\javaw "-Dsuwayomi.tachidesk.webInterface=electron" "-Dsuwayomi.tachidesk.electronPath=electron/electron.exe" -jar Tachidesk.jar diff --git a/server/src/main/kotlin/suwayomi/server/util/Browser.kt b/server/src/main/kotlin/suwayomi/server/util/Browser.kt index 6a04cf1..3b4b501 100644 --- a/server/src/main/kotlin/suwayomi/server/util/Browser.kt +++ b/server/src/main/kotlin/suwayomi/server/util/Browser.kt @@ -18,11 +18,11 @@ object Browser { fun openInBrowser() { - val openInElectron = System.getProperty("ir.armor.tachidesk.webInterface")?.equals("electron") + val openInElectron = System.getProperty("suwayomi.tachidesk.webInterface")?.equals("electron") if (openInElectron == true) { try { - val electronPath = System.getProperty("ir.armor.tachidesk.electronPath")!! + val electronPath = System.getProperty("suwayomi.tachidesk.electronPath")!! electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start()) } catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error e.printStackTrace() diff --git a/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt index 7ddb60d..2a299e0 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/model/database/migration/lib/runMigrations.kt @@ -63,7 +63,7 @@ fun runMigrations(migrations: List, database: Database = TransactionM @OptIn(ExperimentalPathApi::class) private fun getTopLevelClasses(packageName: String): List> { - ServerConfig::class.java.getResource("/" + "ir.armor.tachidesk.model.database.migration".replace('.', '/')) + ServerConfig::class.java.getResource("/" + "suwayomi.tachidesk.model.database.migration".replace('.', '/')) val path = "/" + packageName.replace('.', '/') val uri = ServerConfig::class.java.getResource(path).toURI() diff --git a/server/src/test/kotlin/suwayomi/TestExtensions.kt b/server/src/test/kotlin/suwayomi/TestExtensions.kt index b25f9f7..5b9552d 100644 --- a/server/src/test/kotlin/suwayomi/TestExtensions.kt +++ b/server/src/test/kotlin/suwayomi/TestExtensions.kt @@ -48,7 +48,7 @@ class TestExtensions { @BeforeAll fun setup() { val dataRoot = File("tmp/TestDesk").absolutePath - System.setProperty("ir.armor.tachidesk.rootDir", dataRoot) + System.setProperty("suwayomi.tachidesk.rootDir", dataRoot) applicationSetup() setLoggingEnabled(false) From dda5a2df9348cb41d35afdc4117a66d6753f8e4c Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 27 May 2021 02:13:17 +0430 Subject: [PATCH 7/7] reconsider package strings --- .../src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt | 2 +- .../Config/src/main/java/xyz/nulldev/ts/config/Logging.kt | 2 +- scripts/resources/Tachidesk Debug Launcher.bat | 2 +- scripts/resources/Tachidesk Electron Launcher.bat | 2 +- server/src/main/kotlin/suwayomi/server/util/Browser.kt | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt index c2eecdb..83b68c2 100644 --- a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt +++ b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/ApplicationRootDir.kt @@ -12,7 +12,7 @@ import net.harawata.appdirs.AppDirsFactory val ApplicationRootDir: String get(): String { return System.getProperty( - "suwayomi.tachidesk.rootDir", + "suwayomi.server.rootDir", AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null) ) } \ No newline at end of file diff --git a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt index efb6398..0c6d5f1 100644 --- a/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt +++ b/AndroidCompat/Config/src/main/java/xyz/nulldev/ts/config/Logging.kt @@ -17,4 +17,4 @@ fun setLogLevel(level: Level) { } fun debugLogsEnabled(config: Config) - = System.getProperty("suwayomi.tachidesk.debugLogsEnabled", config.getString("server.debugLogsEnabled")).toBoolean() \ No newline at end of file + = System.getProperty("suwayomi.server.debugLogsEnabled", config.getString("server.debugLogsEnabled")).toBoolean() \ No newline at end of file diff --git a/scripts/resources/Tachidesk Debug Launcher.bat b/scripts/resources/Tachidesk Debug Launcher.bat index f6e86c3..2705add 100644 --- a/scripts/resources/Tachidesk Debug Launcher.bat +++ b/scripts/resources/Tachidesk Debug Launcher.bat @@ -1 +1 @@ -jre\bin\java -Dsuwayomi.tachidesk.debugLogsEnabled=true -jar Tachidesk.jar +jre\bin\java -Dsuwayomi.server.debugLogsEnabled=true -jar Tachidesk.jar diff --git a/scripts/resources/Tachidesk Electron Launcher.bat b/scripts/resources/Tachidesk Electron Launcher.bat index 33defed..7c24329 100644 --- a/scripts/resources/Tachidesk Electron Launcher.bat +++ b/scripts/resources/Tachidesk Electron Launcher.bat @@ -1 +1 @@ -jre\bin\javaw "-Dsuwayomi.tachidesk.webInterface=electron" "-Dsuwayomi.tachidesk.electronPath=electron/electron.exe" -jar Tachidesk.jar +jre\bin\javaw "-Dsuwayomi.server.webInterface=electron" "-Dsuwayomi.server.electronPath=electron/electron.exe" -jar Tachidesk.jar diff --git a/server/src/main/kotlin/suwayomi/server/util/Browser.kt b/server/src/main/kotlin/suwayomi/server/util/Browser.kt index 3b4b501..8a9e4ad 100644 --- a/server/src/main/kotlin/suwayomi/server/util/Browser.kt +++ b/server/src/main/kotlin/suwayomi/server/util/Browser.kt @@ -18,11 +18,11 @@ object Browser { fun openInBrowser() { - val openInElectron = System.getProperty("suwayomi.tachidesk.webInterface")?.equals("electron") + val openInElectron = System.getProperty("suwayomi.server.webInterface")?.equals("electron") if (openInElectron == true) { try { - val electronPath = System.getProperty("suwayomi.tachidesk.electronPath")!! + val electronPath = System.getProperty("suwayomi.server.electronPath")!! electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start()) } catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error e.printStackTrace()