Commit Graph
23 Commits
Author SHA1 Message Date
jpirnay 6537a368ed Add retry on esp_err_http_eagain 2026-04-14 10:40:05 +02:00
jpirnay a03d232dd3 Finalize implementation 2026-04-13 20:24:28 +02:00
jpirnay 1c3ba11563 Attempt at closing reader and sync 2026-04-13 19:10:32 +02:00
jpirnay e768db2ceb Less memory 2026-04-13 17:54:39 +02:00
jpirnay b907aa8ff7 Minor adjustment for BOM strings 2026-04-13 11:48:02 +02:00
jpirnay 398a25c417 Review comment 2026-04-13 11:38:52 +02:00
jpirnay 03b3e1e5b7 Provide a clearer message for TLS 1.3 cases 2026-04-13 11:32:19 +02:00
jpirnay 5c567b0a72 Address upstream review comments 2026-04-13 11:15:20 +02:00
jpirnay 6d9c5b592b Review comment 2026-04-11 20:52:21 +02:00
jpirnay 548fd61e99 Add redirection to KoReaderSyncs (eg behind Duckdns or others) 2026-04-11 20:31:34 +02:00
jpirnay 019dde09e1 Deal with empty responses 2026-04-08 14:54:26 +02:00
jpirnay dcc1bbc2fa Address review comments 2026-04-07 22:28:32 +02:00
jpirnay 6dd905fb5a Split menu actions for smaller footprint 2026-04-07 21:39:03 +02:00
jpirnay abbf69649e Revert "Merge pull request #25 from jpirnay/fix-pr1582" and refactor koreader 2026-04-07 20:24:51 +02:00
jpirnay a67799b04c Extend error messages 2026-04-07 10:56:56 +02:00
jpirnay d7c4471864 yaclf 2026-03-30 10:07:10 +02:00
jpirnay 5745e598e3 fix: migrate KOSync registerUser to esp_http_client 2026-03-25 20:22:01 +01:00
trilwu 08739746f8 style: fix clang-format alignment and log allocation failure
Address CI clang-format check and CodeRabbit review feedback:
- Fix parameter alignment (one extra space)
- Log warning when response buffer allocation fails

(cherry picked from commit 3900ea1feb017c07bd5e38da0b471fe623ec506e)
2026-03-25 20:19:46 +01:00
trilwu 10ea651e26 fix: use esp_http_client for KOSync to prevent TLS OOM on ESP32-C3
The Arduino WiFiClientSecure allocates 16KB TLS buffers by default,
which exhausts the ESP32-C3's limited heap (~46KB free after WiFi)
during the TLS handshake. This causes KOReader sync to fail silently
or crash on HTTPS servers (including the default sync.koreader.rocks).

Replace WiFiClientSecure/HTTPClient with esp_http_client (ESP-IDF),
which supports configurable buffer sizes. Use 2KB TLS buffers — more
than sufficient for KOSync's tiny JSON payloads (<1KB).

Also:
- Use esp_crt_bundle for proper TLS certificate verification instead
  of setInsecure()
- Strip trailing slashes from server URL to prevent double-slash in
  API paths
- Add lastHttpCode for diagnostics
- Add heap logging to help debug memory issues

Fixes #581

(cherry picked from commit 835abc19ff14fcbea8571ccb0dfd8d21e882b84c)
2026-03-25 20:19:46 +01:00
jpirnay 75350b0a3e Incorporate koreader registration 2026-03-23 12:35:01 +01:00
jpirnayandXuan Son Nguyen 5029f5fda5 feat: Add central logging pragma (#843)
## Summary

* Definition and use of a central LOG function, that can later be
extended or completely be removed (for public use where debugging
information may not be required) to save flash by suppressing the
-DENABLE_SERIAL_LOG like in the slim branch

* **What changes are included?**

## Additional Context
* By using the central logger the usual:
```
#include <HardwareSerial.h>
...
  Serial.printf("[%lu] [WCS] Obfuscating/deobfuscating %zu bytes\n", millis(), data.size());
```
would then become
```
#include <Logging.h>
...
  LOG_DBG("WCS", "Obfuscating/deobfuscating %zu bytes", data.size());
```
You do have ``LOG_DBG`` for debug messages, ``LOG_ERR`` for error
messages and ``LOG_INF`` for informational messages. Depending on the
verbosity level defined (see below) soe of these message types will be
suppressed/not-compiled.

* The normal compilation (default) will create a firmware.elf file of
42.194.356 bytes, the same code via slim will create 42.024.048 bytes -
170.308 bytes less
* Firmware.bin : 6.469.984 bytes for default, 6.418.672 bytes for slim -
51.312 bytes less


### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _NO_

---------

Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
2026-02-13 12:16:39 +01:00
Fabio Barbonanddrbourbon 9d5a07481e feat: Calibre Web Automated (CWA) koreader sync server support (#594)
## Summary

* **What is the goal of this PR?** Provide support to koreader sync
server embedded in the popular *Calibre Web Automated* self-hosted
digital library solution.
* **What changes are included?**

* Trivial addition of **HTTP Basic Auth (RFC 7617) header** to
`lib/KOReaderSync/KOReaderSyncClient.cpp`

## Additional Context

None

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_

---------

Co-authored-by: drbourbon <fabio@MacBook-Air-di-Fabio.local>
2026-02-05 23:10:08 +11:00
Justin MitchellandDave Allie ab628b1f3c Adds KOReader Sync support (#232)
## Summary

- Adds KOReader progress sync integration, allowing CrossPoint to sync
reading positions with other
KOReader-compatible devices
- Stores credentials securely with XOR obfuscation
- Uses KOReader's partial MD5 document hashing for cross-device book
matching
  - Syncs position via percentage with estimated XPath for compatibility

# Features
- Settings: KOReader Username, Password, and Authenticate options
- Sync from chapters menu: "Sync Progress" option appears when
credentials are configured
- Bidirectional sync: Can apply remote progress or upload local progress

---------

Co-authored-by: Dave Allie <dave@daveallie.com>
2026-01-19 11:55:35 +00:00