Skip to content

Add SyncYomi trigger settings and chapter sync hooks - #2103

Open
dodmann wants to merge 24 commits into
Suwayomi:masterfrom
dodmann:feature/syncyomi-triggers
Open

Add SyncYomi trigger settings and chapter sync hooks#2103
dodmann wants to merge 24 commits into
Suwayomi:masterfrom
dodmann:feature/syncyomi-triggers

Conversation

@dodmann

@dodmann dodmann commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Add syncOnChapterRead, syncOnChapterOpen, syncOnWebUIStart and syncOnWebUIResume boolean settings to ServerConfig (proto numbers 96–99, group SYNCYOMI, privacy-safe)
  • Trigger a SyncYomi sync automatically in ChapterMutation when a chapter is marked as read (isRead == true) or when a chapter is opened in the reader
  • Improve SyncYomi push log messages: clarify success outcome and 412 precondition-failed scenario with descriptive context instead of bare debug messages

Test plan

  • Configure SyncYomi in server settings and enable syncOnChapterRead
  • Mark a chapter as read via the API — verify sync is triggered
  • Enable syncOnChapterOpen and open a chapter — verify sync is triggered
  • Confirm syncOnWebUIStart and syncOnWebUIResume settings are exposed in the GraphQL API
  • Check server logs to confirm the improved push messages appear on success and 412 responses

cpiber and others added 3 commits June 8, 2026 14:21
…wayomi#2095)

* CEF: Remove jogl and jogamp deps by implementing a no-op renderer

* Update readme
The returned result rows of the inserted chapters did not have the up-to-date "last_modified_at".
This caused "downloadNewChapters" to not be able to correctly detect unread chapters. it included the newly inserted ones, leading to exiting early due to having unread chapters.

Regression 811e151

fixes Suwayomi#2097
Add syncOnChapterRead, syncOnChapterOpen, syncOnWebUIStart and
syncOnWebUIResume settings to ServerConfig. Trigger a SyncYomi sync
automatically when a chapter is marked as read or opened in the reader.

Improve SyncYomi push log messages to clarify success outcome and
412 precondition-failed conflicts.
@Syer10

Syer10 commented Jun 15, 2026

Copy link
Copy Markdown
Member

@schroda Do you want to implement sync triggers in WebUI instead of the server? I feel like that would be better since it would give the UI's control of this.

@schroda

schroda commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

I agree, should be done client side (which includes the koreader sync stuff as well, which is currently done the same way this pr intends to implement it).

Though, as of now, the client can only trigger a sync which runs in the background.
Which makes pushing changes to the sync server the only thing that makes sense.
I don't see what pulling would achieve, especially considering that the caused mutations never reach the client anyway (which is an overall issue with the sync implementation).

It also seems like a big overhead to trigger a full sync for everything, instead of just syncing the specific chapter/manga/whatever.
Especially considering that it uses the backup logic, which, in case postgres is used, just takes forever.
Though, I have no clue if syncyomi even supports anything besides a full sync

zeedif and others added 9 commits June 15, 2026 14:26
…omi#1879)

* feat(opds): add option to skip chapter metadata feed

Introduces a new server configuration `server.opdsSkipChapterMetadataFeed` (default: false).

When enabled, the OPDS chapter feed generates direct acquisition (CBZ download) and streaming (OPDS-PSE) links within the chapter list entries, bypassing the intermediate metadata subsection. This streamlines the user experience and improves compatibility with OPDS clients like KOReader that rely on direct links for automated downloading features.

* fix: lint

* fix(opds): enrich chapter data and refine sync logic for skip-metadata mode

Refines the `opdsSkipChapterMetadataFeed` implementation to ensure necessary data is available for direct links and handles synchronization logic appropriate for a list view.

- **Refactor ChapterForDownload:** Extract `refreshChapterPageList` and `updateChapterPersistence` to allow reusing page count verification logic outside the download flow.
- **Enrich Chapter Repository:** When skipping metadata, asynchronously verify page counts and calculate CBZ file sizes for chapters in the list. This ensures direct stream/download links are valid even if the chapter wasn't previously fully indexed.
- **KoSync Logic:** Implement synchronization logic in `OpdsEntryBuilder`. Since the user cannot be prompted in the chapter list view, `PROMPT` conflicts are explicitly ignored (prioritizing local progress), while updates are applied if non-conflicting.
- **OPDS Attributes:** Add `length` (file size) to acquisition links and ensure download links only appear for actually downloaded chapters.
- **Documentation:** Update `server.conf` description to clarify KoSync behavior in this mode.

* feat(download): improve chapter download filenames

* feat(opds): append language to source names

* feat(opds): handle empty chapter titles

* fix import org.jetbrains.exposed.v1.core.inList

* refactor(opds): reorganize API routes and update facet count calculations based on active filters

- **API Routing & Controllers**: Reorganize OPDS v1.2 route paths into logical groups in `OpdsAPI`. Centralize request filter extraction into `OpdsMangaFilter.fromContext`.
- **Facet Counting**: Extract `Query.applyOpdsMangaFilter` to apply active filters to facet and navigation queries. Pass the active filters to `NavigationRepository` and `MangaRepository` count queries (using `excludeField` to calculate sibling counts). This ensures category, source, language, status, and genre counts (`thr:count`) are accurately computed based on active selections.
- **Pagination**: Add pagination support to computed navigation feeds in `NavigationRepository` ( statuses and content languages).
- **Builders**: Standardize parameter ordering in `FeedBuilderInternal` and `OpdsEntryBuilder` constructors. Simplify pagination and facet link URL generation.

* fix(opds): remove redundant filter logic to avoid duplicate HAVING clauses

Resolve IllegalStateException crash caused by applying content filters twice in MangaRepository. Filtering is now handled exclusively by `applyOpdsMangaFilter`, allowing `applyMangaLibrarySort` to focus solely on ordering operations.

* revert(download): restore original CBZ filename scheme

* refactor(opds): simplify persistence updates and clean up chapter mapping

- Simplify page count and download checks in ChapterForDownload
- Clean up enriched chapter mapping in ChapterRepository to improve readability

* fix(opds): retrieve chapter archive size without leaving stream open

* perf(opds): avoid redundant DB query when refreshing chapter page list
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…#2104)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…yomi#2114)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Fix Postgres Backups

* Changelog

* Import

* More accurate changelog
@dodmann

dodmann commented Jun 15, 2026

Copy link
Copy Markdown
Author

Syncyomi doesn't support partial syncs, AFAIK, this is the current implementation for the tachiyomi/komikku, etc. I just tried to replicate it. I don't see a way to trigger the syncs without doing it server-side as well (I've done the WebUI implementation as well), the interface just gives the user more control over the sync triggers. I personally use this as a mean to sync my android devices with my suwayomi, as my library is quite large.

weblate and others added 10 commits June 17, 2026 22:39
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/el/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/ja/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/pl/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/ru/
Translation: Suwayomi/Suwayomi-Server

Co-authored-by: Micka149 <dr.mischutckin2017@yandex.ru>
Co-authored-by: Philip Prescott-Decie <presdec@gmail.com>
Co-authored-by: Roland Vezsenyi <miscogd5yf2paqvxvc@farvoid.com>
Co-authored-by: Syer10 <Mitchellptbo@gmail.com>
Co-authored-by: TheRay82 <raycoc1382@gmail.com>
Co-authored-by: UnknownSkyrimPasserby <f7022961@opayq.com>
Co-authored-by: 圭紫 <kaceykoo@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* feat(download): improve chapter download filenames

* refactor(download): use SafePath helper for filename sanitization
* add reportSyncEvent

* Update SyncYomiSyncService.kt
- Add pendingSync flag to SyncManager so a sync requested while another
  is running is re-executed after completion instead of being silently dropped
- Use do-while loop in startSync and ensureSync to hold the mutex during
  re-runs, eliminating the race window between unlock and pending check
- Fix import ordering in ChapterMutation to satisfy KtLint
- Document syncOnChapterRead, syncOnChapterOpen, syncOnWebUIStart and
  syncOnWebUIResume settings in Configuring-Suwayomi-Server.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dodmann
dodmann force-pushed the feature/syncyomi-triggers branch from f756cd3 to 7de5aba Compare June 18, 2026 11:28
dodmann and others added 2 commits June 18, 2026 08:30
The chapter merge used a winner-takes-all strategy based on version: when
the remote chapter had a version >= the local one, the entire remote
chapter replaced the local one. This let a stale remote chapter (pushed
mid-reading with read=false, lastPageRead=X) overwrite a local read=true,
so chapters showed progress up to page X but were never marked as read.

Merge read progress non-destructively instead (read = OR, bookmark = OR,
lastPageRead = MAX), mirroring the backup-restore semantics, so reading
progress never regresses across devices. Version still selects the base
chapter for the remaining metadata.

Also make pushSyncData return an explicit Boolean on every branch and move
the trigger proto numbers off the range now used upstream by
opdsSkipChapterMetadataFeed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants