Feature: Add EPUB conversion support for CBX files to Kobo Sync (#1538)

* Feature/kobo sync cbx support (#3)

* Feature: Add CBX syncing support to Kobo sync (#2)

* feat: add cbx sync support

* fix: phrasing of setting description to align with CBX terminology

* fix: resolve issue with CBX setting persistence

* fix: updated dev docker compose to align with Dockerfile

* feat: add cbx files as allowed entitlements

* fix: relax tomcat query characters for kobo sync

* fix: remove hardcoded epub restrictions

* fix: reduce image size and resolve relative content paths

* fix: resolve issues with the image file encoding

* feat: add rar and cb7 support

* feat: bring generated epub more in line with epub standard

* fix: resolve issues with extra metadata fields

* fix: make css background colour white to improve e-ink performance

* cleanup: code comments

* feat: add cbx unit tests

* fix: update zipfile to use builder pattern as current method is deprecated

* fix: remove comments

* fix: replace regex pattern to a simpler check

* fix: remove unused imports

* fix: update epub template to use standard language string

* fix: missing line end on css

* fix: remove duplicate query characters

* fix: grammer issue

* fix: resolve typo in the entitlement service test

* fix: redundant imports and update long types

* chore: update test descriptions for cbx conversion

* fix: add check for larger images in archive files. unlikely to occur.

* fix: merge temp dir logic for the book download

* fix: update kobo entitlement to always report the format as epub3

* fix: implement suggested changes around javadocs and some edge cases to handle gracefully

* chore: cleanup variable names to be clearer in download service

* feat: change function to extract to disk instead of storing images in memory

* fix: add temp file clean up into the conversion service

* fix: add visual divider to seperate CBX and EPUB settings

* fix: update lambdas to use method references

* fix: reword setting description for cbx to epub sync

---------

Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
This commit is contained in:
CounterClops
2025-11-30 09:53:26 -07:00
committed by GitHub
co-authored by Aditya Chandel
parent e47046aa20
commit dfb73d50d9
22 changed files with 1912 additions and 16 deletions
@@ -225,6 +225,46 @@
</div>
</div>
<p-divider></p-divider>
<div class="setting-item">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Convert CBX to EPUB</label>
<p-toggle-switch
id="convertCbxToEpub"
[(ngModel)]="koboSettings.convertCbxToEpub"
(ngModelChange)="onToggleChange()">
</p-toggle-switch>
</div>
<p class="setting-description">
Converts CBX files to EPUB during Kobo sync, allowing CBX files to be downloaded and read on Kobo devices.
</p>
</div>
</div>
<div class="setting-item">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">CBX Conversion Size Limit: {{ koboSettings.conversionLimitInMbForCbx }} MB</label>
<div class="slider-container">
<p-slider
id="conversionLimitForCbx"
[(ngModel)]="koboSettings.conversionLimitInMbForCbx"
[min]="1"
[max]="500"
[step]="1"
(ngModelChange)="onSliderChange()">
</p-slider>
</div>
</div>
<p class="setting-description">
Comic book archives can be very large due to high-resolution images. Set a reasonable limit to prevent server overload during conversion.
<br>
<strong>Recommended:</strong> 100-200MB for most comic libraries. CBX files over this limit will not be converted or synced to the device.
</p>
</div>
</div>
</div>
</div>
}
@@ -11,6 +11,7 @@ import {Subject} from 'rxjs';
import {debounceTime, filter, take, takeUntil} from 'rxjs/operators';
import {ToggleSwitch} from 'primeng/toggleswitch';
import {Slider} from 'primeng/slider';
import {Divider} from 'primeng/divider';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {SettingsHelperService} from '../../../../../shared/service/settings-helper.service';
import {AppSettingKey, KoboSettings} from '../../../../../shared/model/app-settings.model';
@@ -22,7 +23,7 @@ import {ExternalDocLinkComponent} from '../../../../../shared/components/externa
standalone: true,
templateUrl: './kobo-sync-settings-component.html',
styleUrl: './kobo-sync-settings-component.scss',
imports: [FormsModule, Button, InputText, ConfirmDialog, ToggleSwitch, Slider, ExternalDocLinkComponent],
imports: [FormsModule, Button, InputText, ConfirmDialog, ToggleSwitch, Slider, Divider, ExternalDocLinkComponent],
providers: [MessageService, ConfirmationService]
})
export class KoboSyncSettingsComponent implements OnInit, OnDestroy {
@@ -46,6 +47,8 @@ export class KoboSyncSettingsComponent implements OnInit, OnDestroy {
koboSettings: KoboSettings = {
convertToKepub: false,
conversionLimitInMb: 100,
convertCbxToEpub: false,
conversionLimitInMbForCbx: 100,
forceEnableHyphenation: false
};
@@ -123,6 +126,8 @@ export class KoboSyncSettingsComponent implements OnInit, OnDestroy {
.subscribe(settings => {
this.koboSettings.convertToKepub = settings?.koboSettings?.convertToKepub ?? true;
this.koboSettings.conversionLimitInMb = settings?.koboSettings?.conversionLimitInMb ?? 100;
this.koboSettings.convertCbxToEpub = settings?.koboSettings?.convertCbxToEpub ?? false;
this.koboSettings.conversionLimitInMbForCbx = settings?.koboSettings?.conversionLimitInMbForCbx ?? 100;
this.koboSettings.forceEnableHyphenation = settings?.koboSettings?.forceEnableHyphenation ?? false;
});
}