Implement SyncYomi (#1813)

* Implement SyncYomi

* Add ability to select what to sync

* Properly fix default category bug

* Add periodic sync

* Add PostgreSQL support

* Deschedule previous task

* Check if SyncYomi is enabled in syncData function

* Don't allow multiple syncs at the same time

* Convert SyncYomiSyncService to object

* Make startSync non-suspend

* Return a result from startSync

* Sync before library update

* Improvements

* Use NetworkHelper client

* Lint

* Use measureTime

* Database improvements
- Move entire sync operation into a single transaction
- Stop loading all manga to memory

* Revert "Database improvements"

This reverts commit bee8d214c3.

* Actual database improvements

* Remove runBlocking

* Remove title check

* Update updateNonFavorites function

* Update timeout code

* Improve PostgreSQL query

* Create lastSyncState variable

* Create lastSyncStatus query

* Convert lastSyncState to StateFlow

* Create lastSyncStatusChange subscription

* Replace backupRestoreStatus with backupRestoreId

* Add startDate and endDate

* Add logs for sync start and end

* Handle all errors in syncData

* Change category restore function to match Mihon's behavior

* Fix comment

* Remove duplicate BackupMangaHandler.backup call

* Remove duplicated log

* Rename subscription to syncStatusChanged

* Use same flags for restoring

* Update syncInterval config to use DurationSetting

* Update sync scheduling logic

* Reorder conditions to reduce database calls

* Prevent deleted ghost chapters from reappearing during sync
jobobby04/TachiyomiSY#1575

* Improve sync merging categories
jobobby04/TachiyomiSY#1559

* Make columns not null

* Improve H2 triggers

* Add documentation
This commit is contained in:
Bartu Özen
2026-06-05 22:31:51 +03:00
committed by GitHub
parent a403b1c564
commit 811e15162b
29 changed files with 1880 additions and 87 deletions

View File

@@ -1038,7 +1038,68 @@ class ServerConfig(
description = "Enable the WebView via CEF (Chromium)"
)
val syncYomiEnabled: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 87,
defaultValue = false,
group = SettingGroup.SYNCYOMI,
privacySafe = true
)
val syncYomiHost: MutableStateFlow<String> by StringSetting(
protoNumber = 88,
defaultValue = "",
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncYomiApiKey: MutableStateFlow<String> by StringSetting(
protoNumber = 89,
defaultValue = "",
group = SettingGroup.SYNCYOMI,
privacySafe = false,
)
val syncDataManga: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 90,
defaultValue = true,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncDataChapters: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 91,
defaultValue = true,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncDataTracking: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 92,
defaultValue = true,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncDataHistory: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 93,
defaultValue = true,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncDataCategories: MutableStateFlow<Boolean> by BooleanSetting(
protoNumber = 94,
defaultValue = true,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
val syncInterval: MutableStateFlow<Duration> by DurationSetting(
protoNumber = 95,
defaultValue = 0.seconds,
group = SettingGroup.SYNCYOMI,
privacySafe = true,
)
/** ****************************************************************** **/
/** **/

View File

@@ -18,6 +18,7 @@ enum class SettingGroup(
OPDS("OPDS"),
KOREADER_SYNC("KOReader sync"),
WEB_VIEW("WebView"),
SYNCYOMI("SyncYomi")
;
override fun toString(): String = value