Merge pull request #1065 from booklore-app/develop
Merge develop into master for the release
This commit is contained in:
+10
-10
@@ -29,14 +29,14 @@
|
||||
}
|
||||
<div>
|
||||
<p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="true" [position]="'right'" header="Settings">
|
||||
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="true" [position]="'right'" header="Settings">
|
||||
<div class="flex flex-col gap-4 max-w-md mx-auto">
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="font-semibold text-gray-700 dark:text-gray-200">Font Size:</span>
|
||||
<span class="font-semibold text-gray-200">Font Size:</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-button size="small" icon="pi pi-minus" (click)="decreaseFontSize()" severity="info"></p-button>
|
||||
<span class="text-gray-800 dark:text-gray-100">{{ fontSize }}%</span>
|
||||
<span class="text-gray-100">{{ fontSize }}%</span>
|
||||
<p-button size="small" icon="pi pi-plus" (click)="increaseFontSize()" severity="info"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="font-type" class="block font-semibold text-gray-700 dark:text-gray-200">Font:</label>
|
||||
<label for="font-type" class="block font-semibold text-gray-200">Font:</label>
|
||||
<p-select
|
||||
id="font-type"
|
||||
[options]="fontTypes"
|
||||
@@ -58,7 +58,7 @@
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<label class="block font-semibold text-gray-700 dark:text-gray-200">Theme:</label>
|
||||
<label class="block font-semibold text-gray-200">Theme:</label>
|
||||
<div class="flex gap-3 mt-1" role="radiogroup" aria-label="Theme selection">
|
||||
@for (theme of themes; track theme) {
|
||||
<button
|
||||
@@ -77,7 +77,7 @@
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<label id="flow-label" class="block font-semibold text-gray-700 dark:text-gray-200">Flow:</label>
|
||||
<label id="flow-label" class="block font-semibold text-gray-200">Flow:</label>
|
||||
<div class="flex gap-4" role="radiogroup" aria-labelledby="flow-label">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<p-radioButton
|
||||
@@ -87,7 +87,7 @@
|
||||
(onClick)="changeScrollMode()"
|
||||
inputId="flow-paginated">
|
||||
</p-radioButton>
|
||||
<label for="flow-paginated" class="cursor-pointer select-none text-gray-700 dark:text-gray-200">Paginated</label>
|
||||
<label for="flow-paginated" class="cursor-pointer select-none text-gray-200">Paginated</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<p-radioButton
|
||||
@@ -97,7 +97,7 @@
|
||||
(onClick)="changeScrollMode()"
|
||||
inputId="flow-scrolled">
|
||||
</p-radioButton>
|
||||
<label for="flow-scrolled" class="cursor-pointer select-none text-gray-700 dark:text-gray-200">Scrolled</label>
|
||||
<label for="flow-scrolled" class="cursor-pointer select-none text-gray-200">Scrolled</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +105,7 @@
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div>
|
||||
<label class="block mb-1 font-semibold text-gray-700 dark:text-gray-200 pb-2">Line Height: {{ lineHeight }}</label>
|
||||
<label class="block mb-1 font-semibold text-gray-200 pb-2">Line Height: {{ lineHeight }}</label>
|
||||
<p-slider
|
||||
[(ngModel)]="lineHeight"
|
||||
[min]="1"
|
||||
@@ -118,7 +118,7 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block mb-1 font-semibold text-gray-700 dark:text-gray-200 pb-2 pt-2">Letter Spacing: {{ letterSpacing }}em</label>
|
||||
<label class="block mb-1 font-semibold text-gray-200 pb-2 pt-2">Letter Spacing: {{ letterSpacing }}em</label>
|
||||
<p-slider
|
||||
[(ngModel)]="letterSpacing"
|
||||
[min]="0"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
@if (!isLoading) {
|
||||
<ngx-extended-pdf-viewer
|
||||
[src]="bookData"
|
||||
[handTool]="handTool"
|
||||
[textLayer]="true"
|
||||
[showHandToolButton]="true"
|
||||
[handTool]="false"
|
||||
[height]="'auto'"
|
||||
[page]="page"
|
||||
[rotation]="rotation"
|
||||
|
||||
@@ -19,7 +19,6 @@ export class PdfViewerComponent implements OnInit, OnDestroy {
|
||||
isLoading = true;
|
||||
totalPages: number = 0;
|
||||
|
||||
handTool = true;
|
||||
rotation: 0 | 90 | 180 | 270 = 0;
|
||||
|
||||
page!: number;
|
||||
|
||||
+267
-266
@@ -1,307 +1,308 @@
|
||||
<div class="flex flex-col h-[calc(100dvh-6.1rem)] rounded-xl bg-[var(--card-background)] space-y-4">
|
||||
<div class="overflow-x-auto">
|
||||
<div class="flex flex-col h-[calc(100dvh-6.1rem)] rounded-xl bg-[var(--card-background)] space-y-4 min-w-[100rem]">
|
||||
<div class="px-4 md:px-6 pt-6 pb-4 flex flex-col md:flex-row md:items-center md:justify-between">
|
||||
<div>
|
||||
<h2 class="text-xl font-semibold pb-1 flex items-center gap-2">
|
||||
Review Bookdrop Files
|
||||
<a href="https://booklore-app.github.io/booklore-docs/docs/bookdrop" target="_blank" rel="noopener noreferrer">
|
||||
<i
|
||||
class="pi pi-external-link text-sky-600 cursor-pointer"
|
||||
style="font-size: 0.9rem"
|
||||
pTooltip="View documentation"
|
||||
tooltipPosition="top"></i>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="text-sm text-gray-400">
|
||||
These files were uploaded to the
|
||||
<strong class="text-[var(--primary-color)]">Bookdrop Folder</strong>.
|
||||
Review their fetched metadata, assign a library and subpath, and finalize where they belong in your collection.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="px-6 pt-6 pb-4 flex flex-col md:flex-row md:items-center md:justify-between">
|
||||
<div>
|
||||
<h2 class="text-xl font-semibold pb-1 flex items-center gap-2">
|
||||
Review Bookdrop Files
|
||||
<a href="https://booklore-app.github.io/booklore-docs/docs/bookdrop" target="_blank" rel="noopener noreferrer">
|
||||
<i
|
||||
class="pi pi-external-link text-sky-600 cursor-pointer"
|
||||
style="font-size: 0.9rem"
|
||||
pTooltip="View documentation"
|
||||
tooltipPosition="top"></i>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="text-sm text-gray-400">
|
||||
These files were uploaded to the
|
||||
<strong class="text-[var(--primary-color)]">Bookdrop Folder</strong>.
|
||||
Review their fetched metadata, assign a library and subpath, and finalize where they belong in your collection.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 md:mt-0">
|
||||
<p-button
|
||||
label="Rescan Bookdrop"
|
||||
icon="pi pi-refresh"
|
||||
severity="primary"
|
||||
outlined
|
||||
(click)="rescanBookdrop()"
|
||||
pTooltip="Manually trigger a rescan of the Bookdrop folder"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (loading) {
|
||||
|
||||
<div class="absolute inset-0 flex items-center justify-center z-50 rounded-xl">
|
||||
<div class="flex flex-col items-center space-y-3">
|
||||
<p-progressSpinner class="w-8 h-8" strokeWidth="4"/>
|
||||
<span class="text-gray-300">Loading Bookdrop files. Please wait...</span>
|
||||
<div class="mt-4 md:mt-0">
|
||||
<p-button
|
||||
label="Rescan Bookdrop"
|
||||
icon="pi pi-refresh"
|
||||
severity="primary"
|
||||
outlined
|
||||
(click)="rescanBookdrop()"
|
||||
pTooltip="Manually trigger a rescan of the Bookdrop folder"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
} @else {
|
||||
@if (loading) {
|
||||
|
||||
<div class="px-6 pb-2">
|
||||
@if (saving) {
|
||||
<div class="absolute inset-0 bg-black bg-opacity-50 flex flex-col items-center justify-center z-50 rounded-xl space-y-3">
|
||||
<div class="absolute inset-0 flex items-center justify-center z-50 rounded-xl">
|
||||
<div class="flex flex-col items-center space-y-3">
|
||||
<p-progressSpinner class="w-8 h-8" strokeWidth="4"/>
|
||||
<div class="bg-gray-900/90 px-4 py-2 rounded-md">
|
||||
<span class="text-gray-300">Loading Bookdrop files. Please wait...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
} @else {
|
||||
|
||||
<div class="px-6 pb-2">
|
||||
@if (saving) {
|
||||
<div class="absolute inset-0 bg-black bg-opacity-50 flex flex-col items-center justify-center z-50 rounded-xl space-y-3">
|
||||
<p-progressSpinner class="w-8 h-8" strokeWidth="4"/>
|
||||
<div class="bg-gray-900/90 px-4 py-2 rounded-md">
|
||||
<span class="text-sm text-gray-200 text-center">
|
||||
Organizing and moving files to their designated libraries. Please wait...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@if (bookdropFileUis.length !== 0) {
|
||||
<div class="flex justify-between items-center gap-4 px-1">
|
||||
|
||||
<div class="flex gap-4 items-center">
|
||||
<span class="text-sm text-gray-300 font-medium">Library for All Files:</span>
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="libraryOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Default Library"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
[(ngModel)]="defaultLibraryId">
|
||||
</p-select>
|
||||
|
||||
<span class="text-sm text-gray-300 font-medium">Subpath for All Files:</span>
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="selectedLibraryPaths"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Default Subpath"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
[(ngModel)]="defaultPathId">
|
||||
</p-select>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
label="Apply to All"
|
||||
icon="pi pi-check"
|
||||
[disabled]="!canApplyDefaults"
|
||||
(click)="applyDefaultsToAll()"
|
||||
pTooltip="Apply selected library and subpath to all files"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-4">
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="info"
|
||||
label="Apply (w/ Cover)"
|
||||
icon="pi pi-copy"
|
||||
(click)="copyAll(true)"
|
||||
pTooltip="For all files, replace current metadata with fetched metadata, including cover images"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="info"
|
||||
label="Apply (no Cover)"
|
||||
icon="pi pi-copy"
|
||||
(click)="copyAll(false)"
|
||||
pTooltip="For all files, replace current metadata with fetched metadata, excluding cover images"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="warn"
|
||||
label="Reset"
|
||||
icon="pi pi-refresh"
|
||||
(click)="resetAll()"
|
||||
pTooltip="Reset all metadata changes"
|
||||
tooltipPosition="left">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-6 pt-4 space-y-2 pb-4">
|
||||
@if (bookdropFileUis.length === 0) {
|
||||
<div class="h-full w-full flex items-center justify-center text-gray-400 italic py-8">
|
||||
No bookdrop files to review.
|
||||
</div>
|
||||
} @else {
|
||||
@for (file of bookdropFileUis; track file) {
|
||||
|
||||
<div class="flex flex-col">
|
||||
<div class="flex items-center gap-4 custom-border rounded-xl px-4 py-2">
|
||||
|
||||
<p-checkbox
|
||||
[binary]="true"
|
||||
[(ngModel)]="file.selected"
|
||||
(ngModelChange)="toggleFileSelection(file.file.id, $event)">
|
||||
</p-checkbox>
|
||||
|
||||
<i
|
||||
class="pi pi-circle-fill"
|
||||
[ngStyle]="{'color': file.file.fetchedMetadata ? 'green' : 'darkorange'}"
|
||||
style="font-size: 0.75rem"
|
||||
pTooltip="{{file.file.fetchedMetadata ? 'Fetched metadata is available.' : 'No fetched metadata available.'}}"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
|
||||
@if (file.metadataForm.get('thumbnailUrl')?.value) {
|
||||
<img
|
||||
[src]="file.metadataForm.get('thumbnailUrl')?.value"
|
||||
alt="Cover"
|
||||
title="Original cover"
|
||||
class="w-6 h-8 rounded-sm object-cover cursor-pointer hover:scale-105 hover:shadow-md transition-transform duration-200"
|
||||
(click)="file.showDetails = !file.showDetails"/>
|
||||
}
|
||||
|
||||
@if (file.file.fetchedMetadata?.thumbnailUrl) {
|
||||
<img
|
||||
[src]="file.file.fetchedMetadata?.thumbnailUrl"
|
||||
alt="Fetched Cover"
|
||||
title="Fetched cover"
|
||||
class="w-6 h-8 rounded-sm object-cover cursor-pointer hover:scale-105 hover:shadow-md transition-transform duration-200"
|
||||
(click)="file.showDetails = !file.showDetails"/>
|
||||
}
|
||||
|
||||
<div class="flex-1 font-medium text-sm truncate" (click)="file.showDetails = !file.showDetails">
|
||||
{{ file.file.fileName }}
|
||||
</div>
|
||||
|
||||
<i
|
||||
class="pi"
|
||||
[ngClass]="{
|
||||
'pi-check-circle text-green-500': copiedFlags[file.file.id],
|
||||
'pi-check-circle text-blue-500': !file.file.fetchedMetadata,
|
||||
'pi-exclamation-triangle text-red-500': file.file.fetchedMetadata && !copiedFlags[file.file.id]
|
||||
}"
|
||||
[pTooltip]="copiedFlags[file.file.id]
|
||||
? 'Fetched metadata has been applied.'
|
||||
: !file.file.fetchedMetadata
|
||||
? 'No fetched metadata available. Original metadata will be used.'
|
||||
: 'Fetched metadata hasn’t been applied yet. Open metadata picker to review.'"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
@if (bookdropFileUis.length !== 0) {
|
||||
<div class="flex justify-between items-center gap-4 px-1">
|
||||
|
||||
<div class="flex gap-4 items-center">
|
||||
<span class="text-sm text-gray-300 font-medium">Library for All Files:</span>
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="libraryOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Library"
|
||||
placeholder="Select Default Library"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
[(ngModel)]="file.selectedLibraryId"
|
||||
(onChange)="onLibraryChange(file)">
|
||||
[(ngModel)]="defaultLibraryId">
|
||||
</p-select>
|
||||
|
||||
<span class="text-sm text-gray-300 font-medium">Subpath for All Files:</span>
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="file.availablePaths"
|
||||
optionLabel="name"
|
||||
optionValue="id"
|
||||
placeholder="Select Subpath"
|
||||
[options]="selectedLibraryPaths"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Default Subpath"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
appendTo="body"
|
||||
[(ngModel)]="file.selectedPathId">
|
||||
[(ngModel)]="defaultPathId">
|
||||
</p-select>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
[icon]="file.showDetails ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
(click)="file.showDetails = !file.showDetails"
|
||||
label="Apply to All"
|
||||
icon="pi pi-check"
|
||||
[disabled]="!canApplyDefaults"
|
||||
(click)="applyDefaultsToAll()"
|
||||
pTooltip="Apply selected library and subpath to all files"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
@if (file.showDetails) {
|
||||
<app-bookdrop-file-metadata-picker-component
|
||||
class="px-12 py-8 custom-border1"
|
||||
[originalMetadata]="file.file.originalMetadata"
|
||||
[fetchedMetadata]="file.file.fetchedMetadata!"
|
||||
[metadataForm]="file.metadataForm"
|
||||
[copiedFields]="file.copiedFields"
|
||||
[savedFields]="file.savedFields"
|
||||
[bookdropFileId]="file.file.id"
|
||||
(metadataCopied)="onMetadataCopied(file.file.id, $event)">
|
||||
</app-bookdrop-file-metadata-picker-component>
|
||||
}
|
||||
<div class="flex gap-4">
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="info"
|
||||
label="Apply (w/ Cover)"
|
||||
icon="pi pi-copy"
|
||||
(click)="copyAll(true)"
|
||||
pTooltip="For all files, replace current metadata with fetched metadata, including cover images"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="info"
|
||||
label="Apply (no Cover)"
|
||||
icon="pi pi-copy"
|
||||
(click)="copyAll(false)"
|
||||
pTooltip="For all files, replace current metadata with fetched metadata, excluding cover images"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
outlined
|
||||
severity="warn"
|
||||
label="Reset"
|
||||
icon="pi pi-refresh"
|
||||
(click)="resetAll()"
|
||||
pTooltip="Reset all metadata changes"
|
||||
tooltipPosition="left">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="pb-2 px-4 flex items-center justify-between gap-4">
|
||||
|
||||
<div class="flex gap-4 items-center min-w-[160px] justify-start">
|
||||
@if (bookdropFileUis.length > 0) {
|
||||
<p-button
|
||||
label="Select All"
|
||||
icon="pi pi-check-square"
|
||||
severity="info"
|
||||
(click)="selectAll(true)"
|
||||
outlined
|
||||
pTooltip="Select all files across all pages you have navigated"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
label="Clear All"
|
||||
icon="pi pi-times-circle"
|
||||
severity="warn"
|
||||
(click)="selectAll(false)"
|
||||
outlined
|
||||
pTooltip="Deselect all files across all pages you have navigated"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<div class="flex-1 overflow-y-auto px-4 md:px-6 pt-4 space-y-2 pb-4">
|
||||
@if (bookdropFileUis.length === 0) {
|
||||
<div class="h-full w-full flex items-center justify-center text-gray-400 italic py-8">
|
||||
No bookdrop files to review.
|
||||
</div>
|
||||
} @else {
|
||||
<div class="min-w-[160px]"></div>
|
||||
@for (file of bookdropFileUis; track file) {
|
||||
|
||||
<div class="flex flex-col">
|
||||
<div class="flex items-center gap-4 custom-border rounded-xl px-4 py-2">
|
||||
|
||||
<p-checkbox
|
||||
[binary]="true"
|
||||
[(ngModel)]="file.selected"
|
||||
(ngModelChange)="toggleFileSelection(file.file.id, $event)">
|
||||
</p-checkbox>
|
||||
|
||||
<i
|
||||
class="pi pi-circle-fill"
|
||||
[ngStyle]="{'color': file.file.fetchedMetadata ? 'green' : 'darkorange'}"
|
||||
style="font-size: 0.75rem"
|
||||
pTooltip="{{file.file.fetchedMetadata ? 'Fetched metadata is available.' : 'No fetched metadata available.'}}"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
|
||||
@if (file.metadataForm.get('thumbnailUrl')?.value) {
|
||||
<img
|
||||
[src]="file.metadataForm.get('thumbnailUrl')?.value"
|
||||
alt="Cover"
|
||||
title="Original cover"
|
||||
class="w-6 h-8 rounded-sm object-cover cursor-pointer hover:scale-105 hover:shadow-md transition-transform duration-200"
|
||||
(click)="file.showDetails = !file.showDetails"/>
|
||||
}
|
||||
|
||||
@if (file.file.fetchedMetadata?.thumbnailUrl) {
|
||||
<img
|
||||
[src]="file.file.fetchedMetadata?.thumbnailUrl"
|
||||
alt="Fetched Cover"
|
||||
title="Fetched cover"
|
||||
class="w-6 h-8 rounded-sm object-cover cursor-pointer hover:scale-105 hover:shadow-md transition-transform duration-200"
|
||||
(click)="file.showDetails = !file.showDetails"/>
|
||||
}
|
||||
|
||||
<div class="flex-1 font-medium text-sm truncate" (click)="file.showDetails = !file.showDetails">
|
||||
{{ file.file.fileName }}
|
||||
</div>
|
||||
|
||||
<i
|
||||
class="pi"
|
||||
[ngClass]="{
|
||||
'pi-check-circle text-green-500': copiedFlags[file.file.id],
|
||||
'pi-check-circle text-blue-500': !file.file.fetchedMetadata,
|
||||
'pi-exclamation-triangle text-red-500': file.file.fetchedMetadata && !copiedFlags[file.file.id]
|
||||
}"
|
||||
[pTooltip]="copiedFlags[file.file.id]
|
||||
? 'Fetched metadata has been applied.'
|
||||
: !file.file.fetchedMetadata
|
||||
? 'No fetched metadata available. Original metadata will be used.'
|
||||
: 'Fetched metadata hasn’t been applied yet. Open metadata picker to review.'"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="libraryOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Library"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
[(ngModel)]="file.selectedLibraryId"
|
||||
(onChange)="onLibraryChange(file)">
|
||||
</p-select>
|
||||
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="file.availablePaths"
|
||||
optionLabel="name"
|
||||
optionValue="id"
|
||||
placeholder="Select Subpath"
|
||||
class="min-w-[8rem] max-w-[16rem]"
|
||||
appendTo="body"
|
||||
[(ngModel)]="file.selectedPathId">
|
||||
</p-select>
|
||||
|
||||
<p-button
|
||||
size="small"
|
||||
[icon]="file.showDetails ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
(click)="file.showDetails = !file.showDetails"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
@if (file.showDetails) {
|
||||
<app-bookdrop-file-metadata-picker-component
|
||||
class="px-12 py-8 custom-border1"
|
||||
[originalMetadata]="file.file.originalMetadata"
|
||||
[fetchedMetadata]="file.file.fetchedMetadata!"
|
||||
[metadataForm]="file.metadataForm"
|
||||
[copiedFields]="file.copiedFields"
|
||||
[savedFields]="file.savedFields"
|
||||
[bookdropFileId]="file.file.id"
|
||||
(metadataCopied)="onMetadataCopied(file.file.id, $event)">
|
||||
</app-bookdrop-file-metadata-picker-component>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="flex-grow flex justify-center">
|
||||
<p-paginator
|
||||
[rows]="pageSize"
|
||||
[totalRecords]="totalRecords"
|
||||
[first]="currentPage * pageSize"
|
||||
(onPageChange)="loadPage($event.page ?? 0)"
|
||||
[showCurrentPageReport]="true"
|
||||
currentPageReportTemplate="Showing files {first} - {last} of {totalRecords}">
|
||||
</p-paginator>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex gap-4 items-center min-w-[200px] justify-end">
|
||||
<p-button
|
||||
[label]="'Delete ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : '')"
|
||||
icon="pi pi-times"
|
||||
severity="danger"
|
||||
[disabled]="!hasSelectedFiles"
|
||||
outlined
|
||||
(click)="confirmDelete()"
|
||||
pTooltip="Permanently delete selected Bookdrop files and discard any changes"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<p-button
|
||||
[label]="saving ? ('Finalizing ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : '') + '...') : ('Finalize ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : ''))"
|
||||
[icon]="saving ? 'pi pi-spin pi-spinner' : 'pi pi-save'"
|
||||
severity="success"
|
||||
outlined
|
||||
[disabled]="!canFinalize || saving"
|
||||
(click)="confirmFinalize()"
|
||||
pTooltip="Move selected files into the chosen library and subpath">
|
||||
</p-button>
|
||||
</div>
|
||||
<div class="pb-2 px-4 flex items-center justify-between gap-4">
|
||||
|
||||
</div>
|
||||
}
|
||||
<div class="flex gap-4 items-center min-w-[160px] justify-start">
|
||||
@if (bookdropFileUis.length > 0) {
|
||||
<p-button
|
||||
label="Select All"
|
||||
icon="pi pi-check-square"
|
||||
severity="info"
|
||||
(click)="selectAll(true)"
|
||||
outlined
|
||||
pTooltip="Select all files across all pages you have navigated"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
label="Clear All"
|
||||
icon="pi pi-times-circle"
|
||||
severity="warn"
|
||||
(click)="selectAll(false)"
|
||||
outlined
|
||||
pTooltip="Deselect all files across all pages you have navigated"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
} @else {
|
||||
<div class="min-w-[160px]"></div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="flex-grow flex justify-center">
|
||||
<p-paginator
|
||||
[rows]="pageSize"
|
||||
[totalRecords]="totalRecords"
|
||||
[first]="currentPage * pageSize"
|
||||
(onPageChange)="loadPage($event.page ?? 0)"
|
||||
[showCurrentPageReport]="true"
|
||||
currentPageReportTemplate="Showing files {first} - {last} of {totalRecords}">
|
||||
</p-paginator>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-4 items-center min-w-[200px] justify-end">
|
||||
<p-button
|
||||
[label]="'Delete ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : '')"
|
||||
icon="pi pi-times"
|
||||
severity="danger"
|
||||
[disabled]="!hasSelectedFiles"
|
||||
outlined
|
||||
(click)="confirmDelete()"
|
||||
pTooltip="Permanently delete selected Bookdrop files and discard any changes"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<p-button
|
||||
[label]="saving ? ('Finalizing ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : '') + '...') : ('Finalize ' + selectedCount + ' File' + (selectedCount !== 1 ? 's' : ''))"
|
||||
[icon]="saving ? 'pi pi-spin pi-spinner' : 'pi pi-save'"
|
||||
severity="success"
|
||||
outlined
|
||||
[disabled]="!canFinalize || saving"
|
||||
(click)="confirmFinalize()"
|
||||
pTooltip="Move selected files into the chosen library and subpath">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -125,7 +125,6 @@ export interface AppSettings {
|
||||
export enum AppSettingKey {
|
||||
QUICK_BOOK_MATCH = 'QUICK_BOOK_MATCH',
|
||||
AUTO_BOOK_SEARCH = 'AUTO_BOOK_SEARCH',
|
||||
COVER_IMAGE_RESOLUTION = 'COVER_IMAGE_RESOLUTION',
|
||||
SIMILAR_BOOK_RECOMMENDATION = 'SIMILAR_BOOK_RECOMMENDATION',
|
||||
UPLOAD_FILE_PATTERN = 'UPLOAD_FILE_PATTERN',
|
||||
OPDS_SERVER_ENABLED = 'OPDS_SERVER_ENABLED',
|
||||
|
||||
@@ -162,6 +162,15 @@
|
||||
Upload Book
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button
|
||||
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
|
||||
(click)="navigateToBookdrop(); mobileMenu.hide()"
|
||||
>
|
||||
<i class="pi pi-inbox text-surface-100"></i>
|
||||
Bookdrop
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li>
|
||||
|
||||
+24
-4
@@ -102,9 +102,18 @@
|
||||
<div class="flex flex-col gap-1 md:basis-[71%]">
|
||||
<label class="text-sm" for="authors">Authors</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<div class="w-full">
|
||||
<p-autoComplete formControlName="authors" [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" [showClear]="true" (onBlur)="onAutoCompleteBlur('authors', $event)" styleClass="w-full"></p-autoComplete>
|
||||
</div>
|
||||
<p-autoComplete
|
||||
class="w-full"
|
||||
formControlName="authors"
|
||||
[multiple]="true"
|
||||
[dropdown]="false"
|
||||
[suggestions]="filteredAuthors"
|
||||
[forceSelection]="false"
|
||||
[showClear]="true"
|
||||
(completeMethod)="filterAuthors($event)"
|
||||
(onKeyUp)="onAutoCompleteKeyUp('authors', $event)"
|
||||
(onSelect)="onAutoCompleteSelect('authors', $event)">
|
||||
</p-autoComplete>
|
||||
@if (!book.metadata!['authorsLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('authors')" severity="success"></p-button>
|
||||
}
|
||||
@@ -144,7 +153,18 @@
|
||||
<label class="text-sm" for="categories">Categories</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<div class="w-full">
|
||||
<p-autoComplete formControlName="categories" [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" [showClear]="true" (onBlur)="onAutoCompleteBlur('categories', $event)" styleClass="w-full"></p-autoComplete>
|
||||
<p-autoComplete
|
||||
class="w-full"
|
||||
formControlName="categories"
|
||||
[multiple]="true"
|
||||
[dropdown]="false"
|
||||
[suggestions]="filteredCategories"
|
||||
[forceSelection]="false"
|
||||
[showClear]="true"
|
||||
(completeMethod)="filterCategories($event)"
|
||||
(onKeyUp)="onAutoCompleteKeyUp('categories', $event)"
|
||||
(onSelect)="onAutoCompleteSelect('categories', $event)">
|
||||
</p-autoComplete>
|
||||
</div>
|
||||
@if (!book.metadata!['categoriesLocked']) {
|
||||
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('categories')" severity="success"></p-button>
|
||||
|
||||
+56
-36
@@ -1,4 +1,4 @@
|
||||
import {Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewChild} from '@angular/core';
|
||||
import {Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output} from '@angular/core';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Divider} from 'primeng/divider';
|
||||
@@ -13,8 +13,7 @@ import {HttpResponse} from '@angular/common/http';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {Editor} from 'primeng/editor';
|
||||
import {debounceTime} from 'rxjs/operators';
|
||||
import {filter, take} from 'rxjs/operators';
|
||||
import {MetadataRestoreDialogComponent} from '../../../book/components/book-browser/metadata-restore-dialog-component/metadata-restore-dialog-component';
|
||||
import {DialogService} from 'primeng/dynamicdialog';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
@@ -51,8 +50,6 @@ import {LazyLoadImageModule} from 'ng-lazyload-image';
|
||||
})
|
||||
export class MetadataEditorComponent implements OnInit {
|
||||
|
||||
@ViewChild(Editor) quillEditor!: Editor;
|
||||
|
||||
@Input() book$!: Observable<Book | null>;
|
||||
@Output() nextBookClicked = new EventEmitter<void>();
|
||||
@Output() previousBookClicked = new EventEmitter<void>();
|
||||
@@ -72,7 +69,6 @@ export class MetadataEditorComponent implements OnInit {
|
||||
currentBookId!: number;
|
||||
isUploading = false;
|
||||
isLoading = false;
|
||||
htmlTextarea = '';
|
||||
isSaving = false;
|
||||
|
||||
refreshingBookIds = new Set<number>();
|
||||
@@ -80,22 +76,23 @@ export class MetadataEditorComponent implements OnInit {
|
||||
|
||||
originalMetadata!: BookMetadata;
|
||||
|
||||
// Handle blur event for AutoComplete to add custom values
|
||||
onAutoCompleteBlur(fieldName: string, event: any) {
|
||||
const inputValue = event.target.value?.trim();
|
||||
if (inputValue) {
|
||||
const currentValue = this.metadataForm.get(fieldName)?.value || [];
|
||||
const values = Array.isArray(currentValue) ? currentValue :
|
||||
typeof currentValue === 'string' && currentValue ? currentValue.split(',').map((v: string) => v.trim()) : [];
|
||||
allAuthors!: string[];
|
||||
allCategories!: string[];
|
||||
filteredCategories: string[] = [];
|
||||
filteredAuthors: string[] = [];
|
||||
|
||||
// Add the new value if it's not already in the array
|
||||
if (!values.includes(inputValue)) {
|
||||
values.push(inputValue);
|
||||
this.metadataForm.get(fieldName)?.setValue(values);
|
||||
}
|
||||
// Clear the input
|
||||
event.target.value = '';
|
||||
}
|
||||
filterCategories(event: { query: string }) {
|
||||
const query = event.query.toLowerCase();
|
||||
this.filteredCategories = this.allCategories.filter(cat =>
|
||||
cat.toLowerCase().includes(query)
|
||||
);
|
||||
}
|
||||
|
||||
filterAuthors(event: { query: string }) {
|
||||
const query = event.query.toLowerCase();
|
||||
this.filteredAuthors = this.allAuthors.filter(cat =>
|
||||
cat.toLowerCase().includes(query)
|
||||
);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
@@ -164,30 +161,31 @@ export class MetadataEditorComponent implements OnInit {
|
||||
.subscribe(book => {
|
||||
const metadata = book?.metadata;
|
||||
if (!metadata) return;
|
||||
|
||||
this.currentBookId = metadata.bookId;
|
||||
|
||||
if (this.refreshingBookIds.has(book.id)) {
|
||||
this.refreshingBookIds.delete(book.id);
|
||||
this.isAutoFetching = false;
|
||||
}
|
||||
|
||||
this.originalMetadata = structuredClone(metadata);
|
||||
|
||||
if (this.quillEditor?.quill) {
|
||||
this.quillEditor.quill.root.innerHTML = metadata.description;
|
||||
this.quillDisabled();
|
||||
}
|
||||
|
||||
this.populateFormFromMetadata(metadata);
|
||||
});
|
||||
|
||||
this.metadataForm.get('description')?.valueChanges
|
||||
.pipe(debounceTime(100), takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(value => {
|
||||
if (this.htmlTextarea !== value) {
|
||||
this.htmlTextarea = value;
|
||||
}
|
||||
this.bookService.bookState$
|
||||
.pipe(
|
||||
filter(bookState => bookState.loaded),
|
||||
take(1)
|
||||
)
|
||||
.subscribe(bookState => {
|
||||
const authors = new Set<string>();
|
||||
const categories = new Set<string>();
|
||||
|
||||
(bookState.books ?? []).forEach(book => {
|
||||
book.metadata?.authors?.forEach(author => authors.add(author));
|
||||
book.metadata?.categories?.forEach(category => categories.add(category));
|
||||
});
|
||||
|
||||
this.allAuthors = Array.from(authors);
|
||||
this.allCategories = Array.from(categories);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -289,6 +287,28 @@ export class MetadataEditorComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onAutoCompleteSelect(fieldName: string, event: any) {
|
||||
const values = this.metadataForm.get(fieldName)?.value || [];
|
||||
if (!values.includes(event.value)) {
|
||||
this.metadataForm.get(fieldName)?.setValue([...values, event.value]);
|
||||
}
|
||||
(event.originalEvent.target as HTMLInputElement).value = '';
|
||||
}
|
||||
|
||||
onAutoCompleteKeyUp(fieldName: string, event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const value = input.value?.trim();
|
||||
if (value) {
|
||||
const values = this.metadataForm.get(fieldName)?.value || [];
|
||||
if (!values.includes(value)) {
|
||||
this.metadataForm.get(fieldName)?.setValue([...values, value]);
|
||||
}
|
||||
input.value = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSave(): void {
|
||||
this.isSaving = true;
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadataWrapper(undefined), false).subscribe({
|
||||
|
||||
+12
-1
@@ -100,7 +100,18 @@
|
||||
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="warn"></p-button>
|
||||
}
|
||||
<div class="w-full px-4">
|
||||
<p-autoComplete formControlName="{{field.controlName}}" [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" (onBlur)="onAutoCompleteBlur(field.controlName, $event)" styleClass="w-full"></p-autoComplete>
|
||||
<p-autoComplete
|
||||
class="w-full"
|
||||
formControlName="{{field.controlName}}"
|
||||
[multiple]="true"
|
||||
[dropdown]="false"
|
||||
[forceSelection]="false"
|
||||
[showClear]="true"
|
||||
[suggestions]="getFiltered(field.controlName)"
|
||||
(completeMethod)="filterItems($event, field.controlName)"
|
||||
(onKeyUp)="onAutoCompleteKeyUp(field.controlName, $event)"
|
||||
(onSelect)="onAutoCompleteSelect(field.controlName, $event)">
|
||||
</p-autoComplete>
|
||||
</div>
|
||||
<p-button
|
||||
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||
|
||||
+56
-15
@@ -11,7 +11,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {UrlHelperService} from '../../../utilities/service/url-helper.service';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {Textarea} from 'primeng/textarea';
|
||||
import {filter, map} from 'rxjs/operators';
|
||||
import {filter, map, take} from 'rxjs/operators';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {AutoComplete} from 'primeng/autocomplete';
|
||||
import {Image} from 'primeng/image';
|
||||
@@ -81,21 +81,21 @@ export class MetadataPickerComponent implements OnInit {
|
||||
@Input() book$!: Observable<Book | null>;
|
||||
@Output() goBack = new EventEmitter<boolean>();
|
||||
|
||||
// Handle blur event for AutoComplete to add custom values
|
||||
onAutoCompleteBlur(fieldName: string, event: any) {
|
||||
const inputValue = event.target.value?.trim();
|
||||
if (inputValue) {
|
||||
const currentValue = this.metadataForm.get(fieldName)?.value || [];
|
||||
const values = Array.isArray(currentValue) ? currentValue :
|
||||
typeof currentValue === 'string' && currentValue ? currentValue.split(',').map((v: string) => v.trim()) : [];
|
||||
allAuthors!: string[];
|
||||
allCategories!: string[];
|
||||
filteredCategories: string[] = [];
|
||||
filteredAuthors: string[] = [];
|
||||
|
||||
// Add the new value if it's not already in the array
|
||||
if (!values.includes(inputValue)) {
|
||||
values.push(inputValue);
|
||||
this.metadataForm.get(fieldName)?.setValue(values);
|
||||
}
|
||||
// Clear the input
|
||||
event.target.value = '';
|
||||
getFiltered(controlName: string): string[] {
|
||||
return controlName === 'authors' ? this.filteredAuthors : this.filteredCategories;
|
||||
}
|
||||
|
||||
filterItems(event: { query: string }, controlName: string) {
|
||||
const query = event.query.toLowerCase();
|
||||
if (controlName === 'authors') {
|
||||
this.filteredAuthors = this.allAuthors.filter(a => a.toLowerCase().includes(query));
|
||||
} else if (controlName === 'categories') {
|
||||
this.filteredCategories = this.allCategories.filter(c => c.toLowerCase().includes(query));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,25 @@ export class MetadataPickerComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.bookService.bookState$
|
||||
.pipe(
|
||||
filter(bookState => bookState.loaded),
|
||||
take(1)
|
||||
)
|
||||
.subscribe(bookState => {
|
||||
const authors = new Set<string>();
|
||||
const categories = new Set<string>();
|
||||
|
||||
(bookState.books ?? []).forEach(book => {
|
||||
book.metadata?.authors?.forEach(author => authors.add(author));
|
||||
book.metadata?.categories?.forEach(category => categories.add(category));
|
||||
});
|
||||
|
||||
this.allAuthors = Array.from(authors);
|
||||
this.allCategories = Array.from(categories);
|
||||
});
|
||||
|
||||
this.book$
|
||||
.pipe(
|
||||
filter((book): book is Book => !!book && !!book.metadata),
|
||||
@@ -275,6 +294,28 @@ export class MetadataPickerComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onAutoCompleteSelect(fieldName: string, event: any) {
|
||||
const values = this.metadataForm.get(fieldName)?.value || [];
|
||||
if (!values.includes(event.value)) {
|
||||
this.metadataForm.get(fieldName)?.setValue([...values, event.value]);
|
||||
}
|
||||
(event.originalEvent.target as HTMLInputElement).value = '';
|
||||
}
|
||||
|
||||
onAutoCompleteKeyUp(fieldName: string, event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const value = input.value?.trim();
|
||||
if (value) {
|
||||
const values = this.metadataForm.get(fieldName)?.value || [];
|
||||
if (!values.includes(value)) {
|
||||
this.metadataForm.get(fieldName)?.setValue([...values, value]);
|
||||
}
|
||||
input.value = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSave(): void {
|
||||
this.isSaving = true;
|
||||
const updatedBookMetadata = this.buildMetadataWrapper(undefined);
|
||||
|
||||
+3
-3
@@ -89,7 +89,7 @@
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--p-content-background);
|
||||
padding: 1rem 2rem 2rem 2rem;
|
||||
padding: 1rem 1.5rem 1.5rem 1.5rem;
|
||||
margin-left: 1rem;
|
||||
margin-right: 1rem;
|
||||
display: flex;
|
||||
@@ -107,7 +107,7 @@
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
padding: 0.75rem 0;
|
||||
padding: 0.5rem 0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
@@ -117,7 +117,7 @@
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 0.75rem 0;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="settings-header">
|
||||
<h2 class="settings-title">
|
||||
<i class="pi pi-server"></i>
|
||||
OPDS Settings
|
||||
OPDS Settings v2
|
||||
</h2>
|
||||
<p class="settings-description">
|
||||
Manage your OPDS credentials and control how your book collection is shared with reading apps.
|
||||
@@ -12,134 +12,177 @@
|
||||
|
||||
@if (hasPermission) {
|
||||
<div class="settings-content">
|
||||
<div class="endpoint-section">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-link"></i>
|
||||
OPDS Endpoint
|
||||
</h3>
|
||||
<div class="endpoint-form">
|
||||
<div class="endpoint-field">
|
||||
<input
|
||||
id="endpoint-url"
|
||||
fluid
|
||||
class="endpoint-input"
|
||||
type="text"
|
||||
pInputText
|
||||
[value]="opdsEndpoint"
|
||||
readonly/>
|
||||
<p-button
|
||||
icon="pi pi-copy"
|
||||
severity="info"
|
||||
outlined
|
||||
size="small"
|
||||
(onClick)="copyEndpoint()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="users-section">
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<div class="section-title-group">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-power-off"></i>
|
||||
Server Control
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">OPDS Server Enabled</label>
|
||||
<p-toggleswitch
|
||||
[(ngModel)]="opdsEnabled"
|
||||
(onChange)="toggleOpdsServer()">
|
||||
</p-toggleswitch>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Enable or disable the OPDS server to control access to your book collection through reading apps.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (opdsEnabled) {
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-users"></i>
|
||||
OPDS Users
|
||||
<i class="pi pi-link"></i>
|
||||
OPDS Endpoint
|
||||
</h3>
|
||||
<p-button
|
||||
icon="pi pi-plus"
|
||||
label="Add User"
|
||||
severity="success"
|
||||
size="small"
|
||||
(onClick)="showCreateUserDialog = true">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Endpoint URL</label>
|
||||
<div class="input-group">
|
||||
<input
|
||||
id="endpoint-url"
|
||||
class="endpoint-input"
|
||||
fluid
|
||||
type="text"
|
||||
pInputText
|
||||
[value]="opdsEndpoint"
|
||||
readonly/>
|
||||
<p-button
|
||||
icon="pi pi-copy"
|
||||
severity="info"
|
||||
outlined
|
||||
size="small"
|
||||
(onClick)="copyEndpoint()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Use this URL to connect your reading apps to your OPDS catalog.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-card">
|
||||
<p-table
|
||||
[value]="users"
|
||||
[paginator]="users.length > 10"
|
||||
[rows]="10"
|
||||
[showCurrentPageReport]="true"
|
||||
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} users">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="header-content">
|
||||
<i class="pi pi-user"></i>
|
||||
<span>Username</span>
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="header-content">
|
||||
<i class="pi pi-key"></i>
|
||||
<span>Password</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="actions-header">
|
||||
<div class="header-content">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>Actions</span>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-user let-rowIndex="rowIndex">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="user-info">
|
||||
<div class="user-avatar">
|
||||
{{ user.username.charAt(0).toUpperCase() }}
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<div class="section-header-content">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-users"></i>
|
||||
OPDS Users
|
||||
</h3>
|
||||
<p-button
|
||||
icon="pi pi-plus"
|
||||
label="Add User"
|
||||
severity="success"
|
||||
size="small"
|
||||
(onClick)="showCreateUserDialog = true">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-card">
|
||||
<p-table
|
||||
[value]="users"
|
||||
[paginator]="users.length > 10"
|
||||
[rows]="10"
|
||||
[showCurrentPageReport]="true"
|
||||
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} users">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="header-content">
|
||||
<i class="pi pi-user"></i>
|
||||
<span>Username</span>
|
||||
</div>
|
||||
<span class="username">{{ user.username }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-password
|
||||
fluid
|
||||
class="w-32 md:w-56"
|
||||
[(ngModel)]="dummyPassword"
|
||||
[feedback]="false"
|
||||
</th>
|
||||
<th>
|
||||
<div class="header-content">
|
||||
<i class="pi pi-key"></i>
|
||||
<span>Password</span>
|
||||
</div>
|
||||
</th>
|
||||
<th class="actions-header">
|
||||
<div class="header-content">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>Actions</span>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-user let-rowIndex="rowIndex">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="user-info">
|
||||
<div class="user-avatar">
|
||||
{{ user.username.charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<span class="username">{{ user.username }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-password
|
||||
fluid
|
||||
class="w-32 md:w-56"
|
||||
[(ngModel)]="dummyPassword"
|
||||
[feedback]="false"
|
||||
size="small"
|
||||
[disabled]="true"
|
||||
[toggleMask]="false">
|
||||
</p-password>
|
||||
<i
|
||||
class="pi pi-info-circle text-gray-400"
|
||||
pTooltip="Passwords are hidden for security reasons. To change, delete the user and create a new one with a new password."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</div>
|
||||
</td>
|
||||
<td class="actions-cell">
|
||||
<p-button
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
size="small"
|
||||
[disabled]="true"
|
||||
[toggleMask]="false">
|
||||
</p-password>
|
||||
<i
|
||||
class="pi pi-info-circle text-gray-400"
|
||||
pTooltip="Passwords are hidden for security reasons. To change, delete the user and create a new one with a new password."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</div>
|
||||
</td>
|
||||
<td class="actions-cell">
|
||||
<p-button
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
size="small"
|
||||
[outlined]="true"
|
||||
[rounded]="true"
|
||||
(onClick)="confirmDelete(user)"
|
||||
pTooltip="Delete user">
|
||||
</p-button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="emptymessage">
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="empty-message">
|
||||
<i class="pi pi-users"></i>
|
||||
<p class="empty-title">No users found</p>
|
||||
<p class="empty-subtitle">Create your first OPDS user to get started</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
[outlined]="true"
|
||||
[rounded]="true"
|
||||
(onClick)="confirmDelete(user)"
|
||||
pTooltip="Delete user">
|
||||
</p-button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="emptymessage">
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="empty-message">
|
||||
<i class="pi pi-users"></i>
|
||||
<p class="empty-title">No users found</p>
|
||||
<p class="empty-subtitle">Create your first OPDS user to get started</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p-dialog
|
||||
|
||||
@@ -16,6 +16,179 @@
|
||||
background: var(--p-content-background);
|
||||
}
|
||||
|
||||
.settings-header {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.settings-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--p-text-color);
|
||||
margin: 0 0 0.75rem 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-description {
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.settings-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.preferences-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.settings-card {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--p-content-background);
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.setting-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.setting-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.setting-label {
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
margin-top: 0.125rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.endpoint-input {
|
||||
width: 100%;
|
||||
min-width: 25rem;
|
||||
}
|
||||
|
||||
.table-card {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: var(--p-content-background);
|
||||
}
|
||||
|
||||
.p-datatable th .header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -28,19 +201,6 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.table-card {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: var(--p-content-background);
|
||||
}
|
||||
|
||||
.p-datatable {
|
||||
.p-datatable-table {
|
||||
border-collapse: separate;
|
||||
@@ -73,6 +233,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
@@ -90,17 +256,6 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.password-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.password-hidden, .password-visible {
|
||||
font-family: monospace;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.actions-cell {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -128,9 +283,6 @@
|
||||
}
|
||||
|
||||
.user-dialog {
|
||||
.p-dialog-header {
|
||||
}
|
||||
|
||||
.p-dialog-content {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
@@ -180,88 +332,6 @@
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.settings-header {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.settings-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--p-text-color);
|
||||
margin: 0 0 0.75rem 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-description {
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.settings-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.endpoint-section {
|
||||
background: var(--p-content-background);
|
||||
border-radius: 8px;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.endpoint-form {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.endpoint-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.endpoint-input {
|
||||
min-width: 9rem;
|
||||
max-width: 50rem;
|
||||
}
|
||||
|
||||
.users-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.section-title-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.access-denied-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -10,10 +10,13 @@ import {FormsModule} from '@angular/forms';
|
||||
import {ConfirmDialog} from 'primeng/confirmdialog';
|
||||
import {ConfirmationService, MessageService} from 'primeng/api';
|
||||
import {OpdsUserV2, OpdsUserV2CreateRequest, OpdsV2Service} from './opds-v2.service';
|
||||
import {catchError, filter, takeUntil, tap} from 'rxjs/operators';
|
||||
import {catchError, filter, take, takeUntil, tap} from 'rxjs/operators';
|
||||
import {UserService} from '../user-management/user.service';
|
||||
import {of, Subject} from 'rxjs';
|
||||
import {of, pipe, Subject} from 'rxjs';
|
||||
import {Password} from 'primeng/password';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {AppSettingsService} from '../../core/service/app-settings.service';
|
||||
import {AppSettingKey} from '../../core/model/app-settings.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-opds-settings-v2',
|
||||
@@ -26,7 +29,8 @@ import {Password} from 'primeng/password';
|
||||
FormsModule,
|
||||
ConfirmDialog,
|
||||
TableModule,
|
||||
Password
|
||||
Password,
|
||||
ToggleSwitch
|
||||
],
|
||||
providers: [ConfirmationService],
|
||||
templateUrl: './opds-settings-v2.html',
|
||||
@@ -35,11 +39,13 @@ import {Password} from 'primeng/password';
|
||||
export class OpdsSettingsV2 implements OnInit, OnDestroy {
|
||||
|
||||
opdsEndpoint = `${API_CONFIG.BASE_URL}/api/v2/opds/catalog`;
|
||||
opdsEnabled = false;
|
||||
|
||||
private opdsService = inject(OpdsV2Service);
|
||||
private confirmationService = inject(ConfirmationService);
|
||||
private messageService = inject(MessageService);
|
||||
private userService = inject(UserService);
|
||||
private appSettingsService = inject(AppSettingsService);
|
||||
|
||||
users: OpdsUserV2[] = [];
|
||||
loading = false;
|
||||
@@ -61,10 +67,26 @@ export class OpdsSettingsV2 implements OnInit, OnDestroy {
|
||||
this.hasPermission = !!(state.user?.permissions.canAccessOpds || state.user?.permissions.admin);
|
||||
}),
|
||||
filter(() => this.hasPermission),
|
||||
tap(() => this.loadUsers())
|
||||
tap(() => this.loadAppSettings())
|
||||
).subscribe();
|
||||
}
|
||||
|
||||
private loadAppSettings(): void {
|
||||
this.appSettingsService.appSettings$
|
||||
.pipe(
|
||||
filter((settings): settings is NonNullable<typeof settings> => settings != null),
|
||||
take(1)
|
||||
)
|
||||
.subscribe(settings => {
|
||||
this.opdsEnabled = settings.opdsServerEnabled ?? false;
|
||||
if (this.opdsEnabled) {
|
||||
this.loadUsers();
|
||||
} else {
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private loadUsers(): void {
|
||||
this.opdsService.getUser().pipe(
|
||||
takeUntil(this.destroy$),
|
||||
@@ -135,6 +157,29 @@ export class OpdsSettingsV2 implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
toggleOpdsServer(): void {
|
||||
this.saveSetting(AppSettingKey.OPDS_SERVER_ENABLED, this.opdsEnabled);
|
||||
if (this.opdsEnabled) {
|
||||
this.loadUsers();
|
||||
} else {
|
||||
this.users = [];
|
||||
}
|
||||
}
|
||||
|
||||
private saveSetting(key: string, value: unknown): void {
|
||||
this.appSettingsService.saveSettings([{key, newValue: value}]).subscribe({
|
||||
next: () => {
|
||||
const successMessage = (value === true)
|
||||
? 'OPDS Server Enabled.'
|
||||
: 'OPDS Server Disabled.';
|
||||
this.showMessage('success', 'Settings Saved', successMessage);
|
||||
},
|
||||
error: () => {
|
||||
this.showMessage('error', 'Error', 'There was an error saving the settings.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private resetCreateUserDialog(): void {
|
||||
this.showCreateUserDialog = false;
|
||||
this.newUser = {username: '', password: ''};
|
||||
|
||||
@@ -2,16 +2,10 @@
|
||||
<div class="settings-header">
|
||||
<h2 class="settings-title">
|
||||
<i class="pi pi-server"></i>
|
||||
OPDS Settings (v1)
|
||||
OPDS Settings v1 (Legacy)
|
||||
</h2>
|
||||
<p class="settings-description">
|
||||
Legacy OPDS server settings for managing your book collection access.
|
||||
<i
|
||||
class="pi pi-info-circle text-sky-600 ml-1"
|
||||
pTooltip="OPDS allows your book collection to be accessed by compatible reading apps through your private server."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</p>
|
||||
|
||||
<div class="deprecation-notice">
|
||||
@@ -19,7 +13,7 @@
|
||||
<div>
|
||||
<p class="notice-title">Deprecated:</p>
|
||||
<p class="notice-text">
|
||||
OPDS (v1) support will be removed in a future release.
|
||||
OPDS v1 support will be removed in a future release.
|
||||
Please migrate to <strong>OPDS v2</strong> for continued support and improvements.
|
||||
</p>
|
||||
</div>
|
||||
@@ -27,56 +21,79 @@
|
||||
</div>
|
||||
|
||||
<div class="settings-content">
|
||||
<div class="server-section">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-power-off"></i>
|
||||
Server Control
|
||||
</h3>
|
||||
<div class="server-control">
|
||||
<label class="control-label">OPDS Server Enabled:</label>
|
||||
<p-toggleswitch
|
||||
[(ngModel)]="opdsEnabled"
|
||||
(onChange)="toggleOpdsServer()">
|
||||
</p-toggleswitch>
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-power-off"></i>
|
||||
Server Control
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">OPDS Server Enabled</label>
|
||||
<p-toggleswitch
|
||||
[(ngModel)]="opdsEnabled"
|
||||
(onChange)="toggleOpdsServer()">
|
||||
</p-toggleswitch>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Enable or disable the OPDS server to control access to your book collection through reading apps.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (opdsEnabled) {
|
||||
<div class="endpoint-section">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-link"></i>
|
||||
OPDS Endpoint
|
||||
</h3>
|
||||
<div class="endpoint-form">
|
||||
<div class="endpoint-field">
|
||||
<input
|
||||
id="endpoint-url"
|
||||
fluid
|
||||
class="endpoint-input"
|
||||
type="text"
|
||||
pInputText
|
||||
[value]="opdsEndpoint"
|
||||
readonly/>
|
||||
<p-button
|
||||
icon="pi pi-copy"
|
||||
label="Copy"
|
||||
severity="info"
|
||||
outlined
|
||||
size="small"
|
||||
(onClick)="copyOpdsEndpoint()">
|
||||
</p-button>
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-link"></i>
|
||||
OPDS Endpoint
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Endpoint URL</label>
|
||||
<div class="input-group">
|
||||
<input
|
||||
id="endpoint-url"
|
||||
class="endpoint-input"
|
||||
type="text"
|
||||
pInputText
|
||||
[value]="opdsEndpoint"
|
||||
readonly/>
|
||||
<p-button
|
||||
icon="pi pi-copy"
|
||||
severity="info"
|
||||
outlined
|
||||
size="small"
|
||||
(onClick)="copyOpdsEndpoint()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Use this URL to connect your reading apps to your OPDS catalog.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="users-section">
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<div class="section-title-group">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-users"></i>
|
||||
OPDS Users
|
||||
</h3>
|
||||
</div>
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-users"></i>
|
||||
OPDS Users
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="table-card">
|
||||
|
||||
@@ -82,15 +82,16 @@
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.server-section {
|
||||
background: var(--p-content-background);
|
||||
border-radius: 8px;
|
||||
|
||||
.preferences-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem 0 1rem;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -98,58 +99,110 @@
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
margin-bottom: 1rem;
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.server-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.control-label {
|
||||
font-weight: 500;
|
||||
color: var(--p-text-color);
|
||||
}
|
||||
|
||||
.endpoint-section {
|
||||
background: var(--p-content-background);
|
||||
.settings-card {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--p-content-background);
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem 0 1rem;
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.endpoint-form {
|
||||
margin-top: 1rem;
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.setting-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: var(--p-text-color);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.setting-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.setting-label {
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
|
||||
.pi {
|
||||
color: var(--p-primary-color);
|
||||
margin-top: 0.125rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.endpoint-field {
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
gap: 0.75rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.endpoint-input {
|
||||
min-width: 9rem;
|
||||
max-width: 50rem;
|
||||
}
|
||||
|
||||
.users-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.section-title-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
max-width: 30rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table-card {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</p-tab>
|
||||
}
|
||||
<p-tab [value]="SettingsTab.OpdsV2">
|
||||
<i class="pi pi-globe"></i> OPDS V2
|
||||
<i class="pi pi-globe"></i> OPDS v2
|
||||
</p-tab>
|
||||
<p-tab [value]="SettingsTab.DeviceSettings">
|
||||
<i class="pi pi-mobile"></i> Devices
|
||||
|
||||
Reference in New Issue
Block a user