Commit Graph

42 Commits

Author SHA1 Message Date
Zeedif
84cfa6bea5 Update KOReader Sync settings (#1030)
* feat(settings): refactor and implement KOReader Sync settings page

Refactors the KOReader Sync settings section into its own dedicated page and implements the full connection and configuration flow.

The previous implementation in the main server settings was outdated and incomplete. This change aligns the frontend with the latest backend logic and provides a complete user experience.

Key changes include:
- Separated the UI into two states: a login form for initial connection and a configuration panel for existing connections.
- Implemented `connectKoSyncAccount` and `logoutKoSyncAccount` mutations to handle authentication with the KOReader Sync server.
- Updated the `SERVER_SETTINGS` GraphQL fragment to use the new `koreaderSyncStrategyForward` and `koreaderSyncStrategyBackward` fields, removing the deprecated `koreaderSyncStrategy`.
- Moved all KOReader Sync settings from the generic Server Settings page to a dedicated route at `/settings/koreader-sync`.
- Restructured and improved i18n keys for better clarity and consistency.

Ran `yarn gql:codegen` to regenerate GraphQL types and helpers.

* Extract credentials login into component

* Update to server changes and cleanup

---------

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>
2025-12-06 19:59:39 +01:00
schroda
e5eda76ea7 Recreate ws client when receiving auth error message 2025-11-20 13:58:44 +01:00
schroda
490ebb5bde Restart subscriptions after token refresh
In case the connection got lost and the client reconnected again, there is a possibility that the auth token is expired. This will lead to the subscription to fail due to being unauthorized.
This, however, does not close the connection and the heartbeat messages are still being sent and received.
Thus, after refreshing the token, the connection is still alive but not authorized, which is the same as not having the connection open.
2025-11-07 12:09:36 +01:00
schroda
284c194ac3 Add "reset" functions to clients 2025-11-07 01:28:56 +01:00
schroda
8ac93ff3ff Recreate graphql ws client only as last resort
Try to force a reconnection by terminating the client first.
2025-11-06 02:42:33 +01:00
schroda
1d639f45ca Restart graphql subscriptions after ws client recreation
Disposing the client does not restart active subscriptions.
2025-11-06 02:41:58 +01:00
schroda
71b70ab0da Ensure graphql ws client is terminated when recreating it 2025-11-06 02:39:02 +01:00
schroda
6636cc66b1 Prevent sending requests that are known to fail
In case it's still unknown if auth is set up on the server, only the initial request to detect this should be sent. Since all other requests will also just fail, they should be blocked until the auth initialization is completed.

While the access token is getting refreshed, no request will succeed since the access token is expired; thus, they should not be sent.
2025-10-15 03:06:46 +02:00
schroda
f539afb404 Introduce "koration" duration api 2025-10-14 21:14:52 +02:00
schroda
f961e734bc Improve graphql ws client connection loss handling
- Retry on all disconnect events
- Retry infinitely
- Cap retry backoff strategy delay at heartbeat interval (20s)
- Recreate client in case reconnecting isn't working
2025-10-10 19:08:46 +02:00
schroda
33fb30a399 Fix including credentials in gql client
Caused the basic auth popup to constantly open again

Regression 4aad410957
2025-08-27 01:10:09 +02:00
schroda
0bd3370d89 Add auth header only when necessary 2025-08-27 00:41:59 +02:00
schroda
4aad410957 Add "ui login" support 2025-08-26 23:06:44 +02:00
schroda
fed291a5dc Remove "__typename" prop from gql request variables
Will cause the request to fail in case the prop was not expected
2025-07-20 16:48:59 +02:00
schroda
fad590eb5d Add "order" filter to chapters query key 2025-07-08 21:56:21 +02:00
schroda
76167ebb67 Set sensible gql ws-client retry attempt count 2025-04-18 00:34:22 +02:00
schroda
b673047517 Update to server gql library update changes 2025-03-23 04:04:08 +01:00
schroda
63a6cfcfb3 Add merge function for "DownloadStatus" "queue" field 2025-01-12 20:55:08 +01:00
schroda
94b0e25df2 Update "apollo-upload-client" to v18.x
- apollo-upload-client v18.0.1
- @types/apollo-upload-client v18
2024-12-24 14:19:40 +01:00
schroda
a819d45489 Update to server download subscription changes 2024-11-28 12:17:55 +01:00
schroda
8f4da52d1f Add optimistic response to server settings mutation 2024-09-26 15:34:00 +02:00
schroda
20eaa90c10 Add optimistic response to metadata mutations 2024-09-21 22:20:41 +02:00
schroda
b57e5118cc Define gql merge function for "trackRecords" field of "MangaType"
When opening the reader and going back to the library, the whole category of the previous opened manga gets refetched due to the readers manga query removing the mangas tracker data from the cache which is required in the library
2024-09-08 01:52:36 +02:00
schroda
08866ace3d Terminate gql subscription on server address change
Otherwise, the subscription is still active for the old server instead of connecting to the new server
2024-08-26 00:25:58 +02:00
schroda
faf2bd2572 Uses correct extension gql key 2024-07-03 23:24:49 +02:00
schroda
76125a7617 Feature/update dependencies (#738)
* [Tooling] Create script to update dependencies

* Lock dependency versions

* Update dependencies

Wait for eslint related dependencies to be compatible with v9
2024-04-14 15:10:34 +02:00
Angel
5f7240d93b Include credentials in requests (#721)
* feat(request manager): adds header to send cookies, and other auths with every request

* refactor(.gitignore): removes local env from .gitignores
2024-04-10 00:04:30 +02:00
schroda
ab4cddfedd Force a reconnect in case a heartbeat is missing (#569)
There seems to be cases where the connection is lost without the client being able to reconnect (e.g. active subscription -> system hibernation -> waking up system => not receiving any messages anymore).
2024-01-26 20:55:14 +01:00
schroda
24379c1e46 Infinitely try to reconnect gql subscriptions (#563) 2024-01-21 22:31:20 +01:00
schroda
05fa3d0732 Fix/chapter not getting deleted after being read (#532)
* Create permanent subscriptions

The subscriptions have to be permanently open, otherwise, the cache gets outdated.

E.g. in case a view is open, which does not subscribe to the download updates, finished downloads are never received and thus, data of existing chapters/mangas in the cache get outdated

* [Codegen][Tool] Get latest data from cache for automatic chapter deletion after reading

The manga chapters query is on "standby" to prevent the reader from rerender in case the underlying query data updates, which would cause the reader to jump back to the beginning of the last read page.
Thus, when checking if the chapter should be automatically deleted, the data from the query can't be used, since it is outdated.
2024-01-01 22:40:39 +01:00
schroda
446deeae06 Feature/library manga actions (#506)
* Extend "IMangaGridProps" from "DefaultGridProps"

* Move library manga filtering into hook

* Add logic to select mangas

* Add manga actions

* Remove cache only policy for category mangas

Unclear why this was added

* Prevent SelectionFAB from being hidden by the mobile footer

On e.g. the library page, the footer is visible and thus, the fab was not completely visible

* Update categories of manga only after clicking "OK"

Previously, selecting a category resulted in an immediate mutation.
To be able to reuse the "CategorySelect" component to change the categories of multiple mangas at once, this behaviour is not suited.

* Add action to change categories of multiple mangas

* Cancel selection mode after removal from library

The mangas would still be selected and other action could get performed. However, this should only be possible for mangas that are in the library

* Remove unintentionally added console log

Accidentally added with 980da657d9
2023-12-25 21:37:45 +01:00
schroda
980da657d9 [Codegen] Check cache before executing query for a single item (#513)
E.g. in case a manga was already loaded through the category mangas query, the query for that specific manga should not run against the server if it hasn't been executed before
2023-12-25 21:20:07 +01:00
schroda
c8747d6db4 Use correct key to normalize extensions (#512) 2023-12-25 21:16:04 +01:00
schroda
1dc60af67c Add logic to reorder downloads (#495) 2023-12-13 02:05:03 +01:00
schroda
78310496aa Feature/about screen add option to check for and trigger updates (#485)
* [VersionMapping] Require server version "r1436" for preview

* Move ts util types to new type file

* Add buttons for updating server and webUI
2023-12-09 23:08:27 +01:00
schroda
a4bd44de9e Correctly merge chapter requests (#474)
A re-fetch wasn't correctly detected which resulted in outdated data to be shown.
The pageInfo was also not correctly merged, which resulted in losing the previous response start cursor and "has previous page" info
2023-11-25 15:35:26 +01:00
schroda
3b147b1b46 Fix/update gql after server changes (#469)
* [Codegen] Update files

* Update "AboutServer"

* Cache "WebUIUpdateInfo"
2023-11-24 01:33:56 +01:00
schroda
5a5b12a9e1 [ESLint] Prefer named exports (#427) 2023-10-28 00:32:02 +02:00
schroda
68e7b4b16d Feature/library global update exclude manga with state (#281)
* Extract global update settings

* Add option to exclude mangas with specific state from global update
2023-10-27 23:39:05 +02:00
schroda
b79fbcf71d Setup graphql subscriptions 2023-10-27 20:23:45 +02:00
schroda
aad87463f3 [Codegen] Use gql for "loading chapters" 2023-10-27 20:23:44 +02:00
schroda
181eb6c811 Add graphql logic to RequestManager 2023-10-27 20:23:01 +02:00