Commit Graph

2032 Commits

Author SHA1 Message Date
Constantin Piber
a09cac1063 Update wiki for settings changes (#1649)
* Update auth settings

* Add some missing config values

* Introduce KOReader variables

* Introduce Database variables
2025-09-15 10:21:53 -04:00
renovate[bot]
513af98872 [skip ci] Update actions/checkout action to v5 (#1648)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-15 09:41:18 -04:00
Mitchell Syer
fafcaa222c Update Dex2Jar (#1644) 2025-09-15 09:25:20 -04:00
Mitchell Syer
1dd79a0b1e Add Wiki to main repo to allow pull requests for improvements (#1647) 2025-09-15 09:25:13 -04:00
schroda
bbd7e30298 Fix/server startup config update failure handling (#1646)
* Catch config value migration exception

In case the value did not exist in the config a "ConfigException.Missing" exception was thrown which caused the whole migration to fail.

Fixes #1645

* Improve config migration logging

* Update user config file after config update

The user config file gets reset before the update.
This could cause the user settings to get lost on the next server start in case something went wrong during the update and the updated config never got saved to the actual file.
2025-09-14 10:32:23 -04:00
renovate[bot]
2818fbe575 Update dependency com.typesafe:config to v1.4.5 (#1642)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-13 12:22:28 -04:00
renovate[bot]
a11db6662d Update kotlin monorepo to v2.2.20 (#1640)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-13 12:22:22 -04:00
schroda
904157a91a Streamline deprecated settings config value migration logic (#1633)
* Streamline deprecated settings config value migration logic

* Add "autoDownloadAheadLimit" config migration

For consistency

* Replace "exitCode" with "shutdownApp"

* Enhance shutdown logging to include exit reason
2025-09-13 12:22:09 -04:00
renovate[bot]
904d3980d6 Update plugin ktlint to v13.1.0 (#1609)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-13 12:21:58 -04:00
renovate[bot]
89e2ba9f75 Update dependency com.pinterest.ktlint:ktlint-cli to v1.7.1 (#1520)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.7.1

* Lint

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Syer10 <syer10@users.noreply.github.com>
2025-09-13 12:21:49 -04:00
Mitchell Syer
3f4dd2861e Fix pages after refactoring downloads (#1639) 2025-09-09 21:10:27 -04:00
Weblate (bot)
c1a9b158e2 Weblate translations (#1638)
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/pt/
Translation: Suwayomi/Suwayomi-Server

Co-authored-by: Thiago Alencar <thiago.alcr@gmail.com>
2025-09-09 18:15:08 -04:00
schroda
7db947eba2 Restore server settings first (#1637)
The imported server settings might cause the active database to change.
In case this happens, the backup was restored into the wrong database.
2025-09-09 18:14:47 -04:00
renovate[bot]
450861d47a Update plugin buildconfig to v5.6.8 (#1636)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-09 18:14:36 -04:00
schroda
3df0106325 Fix/logging user sensitive config data in cleartext (#1634)
* Redact username and passwords from config log

* Redact empty username and password

* Make regex Username/Password case-insensitive in config redaction
2025-09-09 18:14:21 -04:00
schroda
2b767eb488 Fix/local manga thumbnails handling (#1630)
* Skip thumbnail download for local manga sources

Local manga sources do not require downloading thumbnails as they are stored locally.

* Always update local source manga info when browsing

When making changes to an in library local source manga, a refresh from the source was required to get the latest data.
From a user perspective, this is unexpected behavior that looks like a bug.

If, for example, the thumbnail file extension got changed, the file could not be found anymore and an error was shown in the client. To fix this, a manga refresh was required.
2025-09-09 18:14:01 -04:00
renovate[bot]
f8c77b3673 Update dependency io.insert-koin:koin-core to v4.1.1 (#1629)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-09 18:13:50 -04:00
Mitchell Syer
aaaae4e719 Handle null keys better (#1628) 2025-09-09 18:13:40 -04:00
Mitchell Syer
679e2c0da9 Optimize Download Queue (#1627)
* Optimize download Queue

* Lint

* Fix name of DownloadStatus file

* Re-add synchronous status fetch
2025-09-09 18:13:31 -04:00
renovate[bot]
055c1c47f6 Update dependency com.android.tools.build:apksig to v8.13.0 (#1626)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-09 18:13:18 -04:00
Zeedif
275727ed90 feat(kosync): add mutations for manual progress push and pull (#1625)
Exposes the existing push and pull functionality from the KoreaderSyncService via the GraphQL API.

This change introduces two new mutations:
- `pushKoSyncProgress`: Manually sends the current chapter's reading progress to the KOReader sync server.
- `pullKoSyncProgress`: Manually fetches and applies the latest reading progress from the KOReader sync server.

These mutations enable clients and WebUIs to implement manual sync triggers, providing users with more direct control over their reading progress synchronization, similar to the functionality offered by the official KOReader plugin and other clients like Readest.
2025-09-09 18:13:05 -04:00
Zeedif
257e1dd03d refactor(kosync): introduce differentiated sync strategies (#1624)
* refactor(kosync): introduce differentiated sync strategies

Replaces the single `koreaderSyncStrategy` setting with `koreaderSyncStrategyForward` and `koreaderSyncStrategyBackward`. This allows users to define distinct conflict resolution behaviors based on whether the remote progress is newer or older than the local progress.

The `KoreaderSyncStrategy` enum has been simplified to `KoreaderSyncConflictStrategy` with four clear options: `PROMPT`, `KEEP_LOCAL`, `KEEP_REMOTE`, and `DISABLED`. The ambiguous `SILENT` option is removed, as its behavior is now implicitly covered by selecting `KEEP_REMOTE` for forward syncs and `KEEP_LOCAL` for backward syncs.

The legacy `koreaderSyncStrategy` setting is now deprecated and is seamlessly migrated to the new dual-strategy system using `MigratedConfigValue`, ensuring backward compatibility for existing user configurations.

* fix(kosync): correct proto numbers and setting order for sync strategies

* fix(kosync): proto number 78 to 68

* fix(server): migrate KOReader sync strategy during settings cleanup

Add migration logic to convert the old `server.koreaderSyncStrategy` key
into the new `server.koreaderSyncStrategyForward` and
`server.koreaderSyncStrategyBackward` keys during server setup.
2025-09-09 18:12:53 -04:00
Syer10
5bf2a4aed4 Set BackupServerSettings to nullable 2025-09-02 16:34:48 -04:00
Mitchell Syer
dc79b4c90a Support PostgreSQL Databases (#1617)
* Support PostgreSQL Databases

* Set the database Schema

* See if we can test postgres

* Another test

* Disable node container

* Update database when changed

* Simplify test workflow

* Only exit on failed migrations

* Run the first databaseUp sync

* Map the port

* Use absolute path for LD_PRELOAD

* Timeout after 1m

* Open the server in both database configurations

* Only exit on migration failed in ci

* Lint

* Use new ServerConfig configuration
2025-09-02 12:29:09 -04:00
renovate[bot]
4cdc7b348d Update dependency com.android.tools.build:apksig to v8.12.2 (#1620)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 17:03:33 -04:00
Mitchell Syer
ddedceeded Support null preference keys (#1623) 2025-09-01 17:03:21 -04:00
renovate[bot]
3179169913 Update dependency org.jsoup:jsoup to v1.21.2 (#1615)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 17:03:10 -04:00
schroda
8ef2877040 Feature/streamline settings (#1614)
* Cleanup graphql setting mutation

* Validate values read from config

* Generate server-reference.conf files from ServerConfig

* Remove unnecessary enum value handling in config value update

Commit df0078b725 introduced the usage of config4k, which handles enums automatically. Thus, this handling is outdated and not needed anymore

* Generate gql SettingsType from ServerConfig

* Extract settings backup logic

* Generate settings backup files

* Move "group" arg to second position

To make it easier to detect and have it at the same position consistently for all settings.

* Remove setting generation from compilation

* Extract setting generation code into new module

* Extract pure setting generation code into new module

* Remove generated settings files from src tree

* Force each setting to set a default value
2025-09-01 17:02:58 -04:00
Weblate (bot)
11b2a6b616 Weblate translations (#1605)
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/de/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/es/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/vi/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/zh_Hans/
Translation: Suwayomi/Suwayomi-Server

Co-authored-by: Christian Heinrich <ch.heinrich16@gmail.com>
Co-authored-by: Constantin Piber <cp.piber@gmail.com>
Co-authored-by: Nguyễn Trung Đức <vaicato16@gmail.com>
Co-authored-by: Weblate <allendandstart@gmail.com>
Co-authored-by: zeedif <carlos_antonio-rl@hotmail.com>
2025-09-01 17:02:38 -04:00
Constantin Piber
04ad0033d7 GraphQL directly uses getUserFromToken and expects a valid user for (#1616)
other authentication methods, so re-introduce that check
2025-08-25 06:02:12 -04:00
Constantin Piber
46e2ef125a OPDS: Allow fallback to Basic Auth (#1613)
* Move API authorization to UserType

We already verify the JWT there, so do the same with cookies. This makes
the next steps easier

* OPDS: Allow basic auth as fallback

* Send 404 for any unmatched API request

Redirecting to the UI is weird and can cause problems with the
SIMPLE_LOGIN check (which ignores API requests)

* Webview: Present Login page in SIMPLE_LOGIN mode

For BASIC_AUTH, the dialog is always presented. With UI_LOGIN, we have a
custom login dialog.
Before, SIMPLE_LOGIN would just say "Unauthorized", as with all API
endpoints. With the last commits, SIMPLE_LOGIN is checked by the
endpoints, which Webview did not, so the page would load, but then the
Websocket would error out, despite showing the login dialog.

* Lint
2025-08-24 12:36:11 -04:00
schroda
9a33e3808a Feature/graphql settings add jwt settings (#1612)
* Add jwt settings to grapqhl SettingsType

* Sort proto BackupServerSettings by ProtNumber
2025-08-24 12:35:59 -04:00
Zeedif
8ae451ece5 refactor(opds): align feed generation with RFC5005 and OpenSearch specs (#1611)
* refactor(opds): align feed generation with RFC5005 and OpenSearch specs

This commit refactors the OPDS feed generation to strictly adhere to official specifications for search and pagination.

Previously, OpenSearch response elements (totalResults, itemsPerPage, startIndex) were incorrectly included in all acquisition feeds. According to the OPDS 1.2 and OpenSearch 1.1 specifications, these elements should only be present in feeds that are a direct response to a search query. This change restricts their inclusion to search result feeds only, ensuring spec compliance.

Additionally, pagination link relations were not fully implemented as per RFC 5005. This commit enhances all paginated feeds to include `first` and `last` links, in addition to the existing `prev` and `next` links. This provides a complete and standard-compliant navigation experience for OPDS clients.

- `FeedBuilderInternal` now accepts an `isSearchFeed` flag to conditionally add OpenSearch elements.
- All feed generation methods in `OpdsFeedBuilder` and `OpdsV1Controller` now correctly identify search contexts.
- RFC 5005 pagination links (`first`, `last`, `prev`, `next`) are now generated for all paginated feeds.
- Added necessary link relation constants to `OpdsConstants`.

* feat(opds): improve pagination navigation and code organization
2025-08-24 12:35:47 -04:00
Zeedif
a5d64be197 fix(kosync): use correct partial hash for binary checksum (#1610)
When generating a hash on-the-fly for the binary checksum method, the code was performing a full MD5 hash of the entire file stream. This was incorrect as the KOReader binary method expects a specific partial hash (reading small chunks at different offsets).

This change ensures that when an in-memory CBZ is created, it is first written to a temporary file. Then, the correct `KoreaderHelper.hashContents()` function is used on that file to generate the partial hash, matching KOReader's logic. The temporary file is deleted immediately after.
2025-08-24 12:35:38 -04:00
Constantin Piber
4482b325d7 [#1575] Disable Alt translation (#1608) 2025-08-21 19:18:33 -04:00
Zeedif
f46745d70c feat(kosync): Implement On-the-Fly Deterministic Hashing for KOReader Sync (#1606)
* fix(archive): unify CBZ generation to produce deterministic archives

Previously, CBZ files generated on-the-fly (`FolderProvider`) had a different hash than those created directly (`ArchiveProvider`), even with identical content. This inconsistency was caused by using two different ZIP libraries (`java.util.zip` vs. `org.apache.commons.compress`) and not normalizing file metadata.

This inconsistent hashing breaks binary-based synchronization with external services like KOReader Sync Server, as the same chapter could be identified as a different file on each generation.

This change ensures CBZ generation is fully deterministic by:

- Unifying both providers to use `org.apache.commons.compress`.
- Setting a fixed epoch timestamp (`time = 0L`) for all ZIP entries.
- Explicitly setting the compression method and level to `DEFLATED` with default compression.

This guarantees that a CBZ file for a given chapter will always have the same hash, regardless of how it's generated, resolving synchronization issues.

* feat(kosync): lazily generate and cache CBZ hashes for sync

Previously, KOReader progress sync in binary mode was limited to chapters explicitly downloaded as CBZ files. Chapters stored as folders lacked a hash, preventing them from being synced.

With the recent move to deterministic CBZ generation, it's now possible to create a consistent hash for any downloaded chapter on-the-fly.

This commit enhances the `getOrGenerateChapterHash` function to act as a central point for hash management. If a hash is requested for a downloaded chapter that doesn't have one cached in the database:

1.  It generates the CBZ archive in-memory from the downloaded folder or existing CBZ using `ChapterDownloadHelper.getAsArchiveStream()`.
2.  It calculates the deterministic hash of the generated archive content.
3.  It saves this hash to the `koreader_hash` column in the `Chapter` table for future use.

The cached hash is cleared when the chapter download is deleted, ensuring hashes are only tracked for available content.

This change transparently extends Koreader Sync compatibility to all downloaded chapters, regardless of their storage format, without requiring users to pre-convert their library to CBZ.

* fix: rename getAsArchiveStream to getArchiveStreamWithSize
2025-08-21 19:18:27 -04:00
renovate[bot]
b213de19cc Update actions/setup-java action to v5 (#1607)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-21 19:18:08 -04:00
renovate[bot]
75355f0784 Update dependency com.auth0:java-jwt to v4.5.0 (#1603)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-21 19:18:00 -04:00
Constantin Piber
8547159eec Basic JWT implementation (#1524)
* Basic JWT implementation

* Move JWT to UI_LOGIN mode and bring back SIMPLE_LOGIN as before

* Update server/src/main/kotlin/suwayomi/tachidesk/global/impl/util/Jwt.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Refresh: Update only access token

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Implement JWT Audience

* Store JWT key

Generates the key on startup if not set

* Handle invalid Base64

* Make JWT expiry configurable

* Missing value parse

* Update server/src/main/kotlin/suwayomi/tachidesk/global/impl/util/Jwt.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Simplify Duration parsing

* JWT Protect Mutations

* JWT Protect Queries and Subscriptions

* JWT Protect v1 WebSockets

* WebSockets allow sending token via protocol header

* Also respect the `suwayomi-server-token` cookie

* JWT reduce default token expiry

* JWT Support cookie on WebSocket as well

* Lint

* Authenticate graphql subscription via connection_init payload

* WebView: Prefer explicit token over cookie

This hack was implemented because WebView sent `"null"` if no token was
supplied, just don't send a bad token, then we can do this properly

* WebView: Implement basic login dialog if no token supplied

---------

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>
2025-08-20 18:04:48 -04:00
Weblate (bot)
d90bfb6e3e Weblate translations (#1599)
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/es/
Translate-URL: https://hosted.weblate.org/projects/suwayomi/suwayomi-server/vi/
Translation: Suwayomi/Suwayomi-Server

Co-authored-by: Nguyễn Trung Đức <vaicato16@gmail.com>
Co-authored-by: zeedif <carlos_antonio-rl@hotmail.com>
2025-08-20 18:03:46 -04:00
Zeedif
82ad2fbe80 feat(opds): Enhance KOSync Conflict Handling and Reliability (#1602)
* feat(opds): Enhance KOSync conflict handling and reliability

This commit introduces several improvements to the KOSync integration within the OPDS feed, focusing on fixing bugs, improving network stability, and enhancing user feedback during synchronization conflicts.

- fix(sync): Corrects a KOSync JSON deserialization issue by mapping the `updated_at` field from the server response to the `timestamp` property in the client's data model. This resolves a critical bug where remote progress was being ignored.
- fix(sync): Adds a `Connection: close` header to all KOSync API requests. This prevents `unexpected end of stream` errors by ensuring a fresh connection is used, improving network reliability.
- feat(opds): Resolve sync conflicts by generating separate OPDS entries for local and remote progress. This aligns with the OPDS-PSE specification's implicit design of one stream link per entry. Instead of incorrectly adding multiple links to a single entry, the feed now presents two distinct, clearly labeled entries, allowing users to choose their desired reading position from compatible clients.
- chore(sync): Adds detailed debug logging for KOSync `GET` and `PUT` requests, including request URLs, sent data, and received responses. This improves traceability and makes debugging future issues significantly easier.

* change synced icon

* unnecessary comments removed
2025-08-20 18:03:33 -04:00
Zeedif
a414860626 fix(api): optimize HEAD requests for chapter downloads (#1601)
Previously, handling a HEAD request on the chapter download endpoint was inefficient as it triggered the full CBZ file generation process in-memory just to retrieve metadata like Content-Length and Content-Disposition. This caused unnecessary latency especially for OPDS clients.

This commit introduces a separate, lightweight path for HEAD requests.

- A new `getCbzMetadataForDownload` method is added to `ChapterDownloadHelper` to calculate the filename and file size without generating an archive stream.
- The `ChaptersFilesProvider` interface is updated with a `getArchiveSize()` method, implemented by both `ArchiveProvider` and `FolderProvider`, to retrieve the total size.
- The `MangaController` now differentiates between GET and HEAD methods, invoking the appropriate helper to ensure HEAD requests are served instantly with only the required metadata.
2025-08-20 18:03:26 -04:00
renovate[bot]
392f66e938 Update plugin shadowjar to v8.3.9 (#1597)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-20 18:03:08 -04:00
renovate[bot]
a40021a823 Update actions/checkout action to v5 (#1582)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 15:01:50 -04:00
renovate[bot]
c86f7c5356 Update dependency com.android.tools.build:apksig to v8.12.1 (#1595)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 15:01:37 -04:00
Constantin Piber
3075888d26 [#1575] Support copy & paste (#1593)
* [#1575] Support paste

* WebView: Implement copy

* Localize copy dialog, lint

* Implement a custom context menu for copy/paste

* Remove click event which causes double events

* WebView: Fix input events broken by moved preventDefault

We want to fall back to the `input` event for Android bug and paste, but
we want to prevent the event for the others, so change the order
2025-08-19 15:01:31 -04:00
Mitchell Syer
7a0d3a1efe Expose the Source baseUrl (#1585)
* Expose the source baseUrl

* Lint
2025-08-19 15:01:14 -04:00
renovate[bot]
7b22397a82 Update kotlin monorepo to v2.2.10 (#1589)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 15:01:07 -04:00
Constantin Piber
b2cfb5a1e9 AndroidCompat: Use NotoSans as default font (#1572)
* Initial Noto fonts

* Use Noto for other default fonts

* Typeface: Prefer main font

Eagerly switch back to main font as soon as it can display again;
otherwise we might never switch back (or later than necessary); we
should always prefer the main font

* fix: Font metrics with fallback font on TextLine
2025-08-19 15:00:59 -04:00
renovate[bot]
283e38c30a Update actions/download-artifact action to v5 (#1573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 15:00:43 -04:00