Add an option to save metadata directly into the EPUB file, along with the ability to back up and restore the original metadata.

This commit is contained in:
aditya.chandel
2025-06-17 00:19:20 -06:00
committed by Aditya Chandel
parent faae595ef6
commit 03ce268d8e
32 changed files with 1400 additions and 371 deletions
@@ -1,6 +1,56 @@
<div class="w-full h-[calc(100vh-12.1rem)] overflow-y-auto border rounded-lg enclosing-container">
<div class="p-4 pt-8">
<div class="p-4 pt-6">
<p class="text-lg pb-4 pt-2">Metadata Persistence:</p>
<div class="flex flex-col gap-4 pl-6">
<div class="flex items-center gap-4">
<label>Write to File</label>
<p-toggleswitch
[ngModel]="metadataPersistence.saveToOriginalFile"
(onChange)="onPersistenceToggle('saveToOriginalFile')">
</p-toggleswitch>
<div class="text-sm text-gray-400 flex items-start gap-2">
<i class="pi pi-exclamation-triangle text-yellow-500 mt-0.5"></i>
<span>
Writes metadata directly into the original file. A backup of the metadata and/or cover is created <b>only if enabled below</b>. Proceed with caution, restoration may fail if the file is moved or renamed.
</span>
</div>
</div>
<div class="flex items-center gap-4">
<label>Backup Metadata</label>
<p-toggleswitch
[ngModel]="metadataPersistence.backupMetadata"
(onChange)="onPersistenceToggle('backupMetadata')"
[disabled]="!metadataPersistence.saveToOriginalFile">
</p-toggleswitch>
<span class="text-sm text-gray-400">
Save a JSON copy of the current metadata before writing new data to the file.
</span>
</div>
<div class="flex items-center gap-4">
<label>Backup Cover</label>
<p-toggleswitch
[ngModel]="metadataPersistence.backupCover"
(onChange)="onPersistenceToggle('backupCover')"
[disabled]="!metadataPersistence.saveToOriginalFile">
</p-toggleswitch>
<span class="text-sm text-gray-400">
Save a copy of the existing embedded cover image before it is replaced.
</span>
</div>
</div>
</div>
<div class="pb-4">
<p-divider></p-divider>
</div>
<div class="p-4">
<app-metadata-provider-settings></app-metadata-provider-settings>
</div>