mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-17 18:00:43 +00:00
fix(download): send every file of a multi-file download to the browser (#1489)
Download to Browser only ever sent the first file of a multi-file release (audiobook chapters, packs): the folder output returned final_paths[0] and /api/localdownload served that one path. The folder output now keeps every final path on the in-memory task (download_paths), and /api/localdownload streams them as one uncompressed ZIP named after the book when there is more than one. The archive is never staged on disk or held in memory, and ZIP64 covers large audiobooks. History still stores only the first path, so a re-download from history after a dismiss or restart serves a single file, as before. Also brings every linter back to green on all files: - pre-commit: bump the ruff hook to v0.17.1 to match uv.lock; ruff-format the Python examples in docs/dev and skills - ruff: fix the remaining issues in skills/shelfmark/download_books.py; format base_handler.py - basedpyright: Optional and attrs errors in databazeknih.py - knip: drop 31 unused exports, reuse ColumnColorHint in colorMaps - oxfmt 0.72: styles.css - direct download: fix the "Welib, mirrors" typo and the test that still expected the pre-OceanofPDF message Fixes #1467
This commit is contained in:
1 parent
3025f120eb
commit
10710abd4e
26 files changed
+664
-344
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import type { RequestRecord } from '../../types';
|
||||
|
||||
export type ActivityKind = 'download' | 'request';
|
||||
type ActivityKind = 'download' | 'request';
|
||||
|
||||
export type ActivityVisualStatus =
|
||||
| 'queued'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { DisplayFieldIcon, DisplayFieldBadge, DisplayFieldBadges } from './DisplayFieldIcon';
|
||||
export { CircularProgress } from './CircularProgress';
|
||||
export { ToggleSwitch } from './ToggleSwitch';
|
||||
export { LibraryBadge, isInLibrary, isCollectionOnly } from './LibraryBadge';
|
||||
export { LibraryBadge, isInLibrary } from './LibraryBadge';
|
||||
@@ -861,9 +861,9 @@ export const getReleases = async (
|
||||
|
||||
// Admin user management API
|
||||
|
||||
export type AdminAuthSource = 'builtin' | 'oidc' | 'proxy' | 'cwa';
|
||||
type AdminAuthSource = 'builtin' | 'oidc' | 'proxy' | 'cwa';
|
||||
|
||||
export interface AdminUserEditCapabilities {
|
||||
interface AdminUserEditCapabilities {
|
||||
authSource: AdminAuthSource;
|
||||
canSetPassword: boolean;
|
||||
canEditRole: boolean;
|
||||
|
||||
@@ -172,13 +172,7 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:
|
||||
'Inter',
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
sans-serif;
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: var(--text-color);
|
||||
background: var(--background-color);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Search mode constants and type
|
||||
export const SEARCH_MODE = {
|
||||
const SEARCH_MODE = {
|
||||
DIRECT: 'direct',
|
||||
UNIVERSAL: 'universal',
|
||||
} as const;
|
||||
@@ -88,7 +88,7 @@ export interface StatusData {
|
||||
}
|
||||
|
||||
// Button states
|
||||
export type ButtonState =
|
||||
type ButtonState =
|
||||
| 'download'
|
||||
| 'queued'
|
||||
| 'resolving'
|
||||
@@ -156,24 +156,24 @@ export interface TextSearchField extends SearchFieldBase {
|
||||
suggestions_min_query_length?: number;
|
||||
}
|
||||
|
||||
export interface NumberSearchField extends SearchFieldBase {
|
||||
interface NumberSearchField extends SearchFieldBase {
|
||||
type: 'NumberSearchField';
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
}
|
||||
|
||||
export interface SelectSearchField extends SearchFieldBase {
|
||||
interface SelectSearchField extends SearchFieldBase {
|
||||
type: 'SelectSearchField';
|
||||
options: SortOption[];
|
||||
}
|
||||
|
||||
export interface CheckboxSearchField extends SearchFieldBase {
|
||||
interface CheckboxSearchField extends SearchFieldBase {
|
||||
type: 'CheckboxSearchField';
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
export interface DynamicSelectSearchField extends SearchFieldBase {
|
||||
interface DynamicSelectSearchField extends SearchFieldBase {
|
||||
type: 'DynamicSelectSearchField';
|
||||
options_endpoint: string;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export type MetadataSearchField =
|
||||
| CheckboxSearchField
|
||||
| DynamicSelectSearchField;
|
||||
|
||||
export type QueryTargetSource = 'general' | 'manual' | 'direct-field' | 'provider-field';
|
||||
type QueryTargetSource = 'general' | 'manual' | 'direct-field' | 'provider-field';
|
||||
|
||||
export interface QueryTargetOption {
|
||||
key: string;
|
||||
@@ -201,12 +201,12 @@ export type ContentType = 'ebook' | 'audiobook';
|
||||
|
||||
export type RequestPolicyMode = 'download' | 'request_release' | 'request_book' | 'blocked';
|
||||
|
||||
export interface RequestPolicyDefaults {
|
||||
interface RequestPolicyDefaults {
|
||||
ebook: RequestPolicyMode;
|
||||
audiobook: RequestPolicyMode;
|
||||
}
|
||||
|
||||
export interface RequestPolicySourceMode {
|
||||
interface RequestPolicySourceMode {
|
||||
source: string;
|
||||
supported_content_types: string[];
|
||||
browse_results_are_releases?: boolean;
|
||||
@@ -222,7 +222,7 @@ export interface RequestPolicyResponse {
|
||||
source_modes: RequestPolicySourceMode[];
|
||||
}
|
||||
|
||||
export interface RequestContextPayload {
|
||||
interface RequestContextPayload {
|
||||
source: string;
|
||||
content_type: ContentType;
|
||||
request_level: 'book' | 'release';
|
||||
@@ -279,14 +279,14 @@ export interface QueuedDownloadResult {
|
||||
export type RequestSubmissionResult = RequestRecord | QueuedDownloadResult;
|
||||
|
||||
/** How the library holds a book, per format: owned outright, or inside a collection. */
|
||||
export type LibraryHolding = 'owned' | 'collection';
|
||||
type LibraryHolding = 'owned' | 'collection';
|
||||
|
||||
export interface LibraryOwnership {
|
||||
ebook?: LibraryHolding | null;
|
||||
audiobook?: LibraryHolding | null;
|
||||
}
|
||||
|
||||
export type BooksOutputMode = 'folder' | 'booklore' | 'email';
|
||||
type BooksOutputMode = 'folder' | 'booklore' | 'email';
|
||||
|
||||
export interface AppConfig {
|
||||
calibre_web_url: string;
|
||||
@@ -334,7 +334,7 @@ export interface MetadataProvidersResponse {
|
||||
configured_provider_combined: string | null;
|
||||
}
|
||||
|
||||
export interface MetadataCapability {
|
||||
interface MetadataCapability {
|
||||
key: string;
|
||||
field_key?: string;
|
||||
sort?: string;
|
||||
@@ -398,7 +398,7 @@ export interface ReleaseSource {
|
||||
}
|
||||
|
||||
// Column schema types for plugin-driven release list UI
|
||||
export type ColumnRenderType =
|
||||
type ColumnRenderType =
|
||||
| 'text'
|
||||
| 'badge'
|
||||
| 'tags'
|
||||
@@ -408,7 +408,7 @@ export type ColumnRenderType =
|
||||
| 'indexer_protocol'
|
||||
| 'flag_icon'
|
||||
| 'format_content_type';
|
||||
export type ColumnAlign = 'left' | 'center' | 'right';
|
||||
type ColumnAlign = 'left' | 'center' | 'right';
|
||||
|
||||
export interface ColumnColorHint {
|
||||
type: 'map' | 'static'; // 'map' uses colorMaps.ts, 'static' is a fixed Tailwind class
|
||||
@@ -430,7 +430,7 @@ export interface ColumnSchema {
|
||||
}
|
||||
|
||||
// Leading cell config - what to show in the left-most position of each row
|
||||
export type LeadingCellType = 'thumbnail' | 'badge' | 'none';
|
||||
type LeadingCellType = 'thumbnail' | 'badge' | 'none';
|
||||
|
||||
export interface LeadingCellConfig {
|
||||
type: LeadingCellType;
|
||||
@@ -439,13 +439,13 @@ export interface LeadingCellConfig {
|
||||
uppercase?: boolean; // Force uppercase for badge text
|
||||
}
|
||||
|
||||
export interface ExtraSortOption {
|
||||
interface ExtraSortOption {
|
||||
label: string; // Display label in the sort dropdown
|
||||
sort_key: string; // Field to sort by on the Release object
|
||||
default_direction?: 'asc' | 'desc'; // Which way "best first" runs (defaults to desc)
|
||||
}
|
||||
|
||||
export interface SourceActionButton {
|
||||
interface SourceActionButton {
|
||||
label: string; // Button text (e.g., "Refresh search")
|
||||
action: string; // Action type: "expand" triggers expand_search
|
||||
}
|
||||
@@ -483,7 +483,7 @@ export interface Release {
|
||||
}
|
||||
|
||||
// Search info returned by release sources
|
||||
export interface SourceSearchInfo {
|
||||
interface SourceSearchInfo {
|
||||
search_type: 'isbn' | 'title_author' | 'categories' | 'expanded' | 'manual' | 'query';
|
||||
total_results?: number | string | null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Settings field types matching backend settings_registry.py
|
||||
|
||||
export type FieldType =
|
||||
type FieldType =
|
||||
| 'TextField'
|
||||
| 'PasswordField'
|
||||
| 'NumberField'
|
||||
@@ -28,17 +28,17 @@ export interface ShowWhenCondition {
|
||||
notEmpty?: boolean; // If true, show when field has any non-empty value
|
||||
}
|
||||
|
||||
export type ShowWhen = ShowWhenCondition | ShowWhenCondition[];
|
||||
type ShowWhen = ShowWhenCondition | ShowWhenCondition[];
|
||||
|
||||
// Conditional disable configuration
|
||||
export interface DisabledWhenCondition {
|
||||
interface DisabledWhenCondition {
|
||||
field: string; // The field key to check
|
||||
value: string | string[] | boolean; // The value(s) that disable this field
|
||||
reason?: string; // Explanation shown when disabled
|
||||
}
|
||||
|
||||
// Base field interface - common properties
|
||||
export interface BaseField {
|
||||
interface BaseField {
|
||||
key: string;
|
||||
label: string;
|
||||
type: FieldType;
|
||||
@@ -139,20 +139,14 @@ export interface CustomComponentFieldConfig extends BaseField {
|
||||
wrapInFieldWrapper?: boolean; // Whether to render with standard FieldWrapper layout
|
||||
}
|
||||
|
||||
export interface TableFieldColumnOption {
|
||||
interface TableFieldColumnOption {
|
||||
value: string;
|
||||
label: string;
|
||||
description?: string;
|
||||
childOf?: string;
|
||||
}
|
||||
|
||||
export type TableFieldColumnType =
|
||||
| 'text'
|
||||
| 'password'
|
||||
| 'select'
|
||||
| 'multiselect'
|
||||
| 'checkbox'
|
||||
| 'path';
|
||||
type TableFieldColumnType = 'text' | 'password' | 'select' | 'multiselect' | 'checkbox' | 'path';
|
||||
|
||||
export interface TableFieldColumn {
|
||||
key: string;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { ColumnColorHint } from '../types';
|
||||
|
||||
// Color styles with transparent backgrounds and contrasting text
|
||||
interface ColorStyle {
|
||||
bg: string;
|
||||
@@ -133,14 +135,6 @@ function getFlagColor(flag?: string): ColorStyle {
|
||||
return FLAG_COLORS[normalized] || DEFAULT_FLAG_COLOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Color hint type for dynamic column coloring.
|
||||
*/
|
||||
interface ColumnColorHint {
|
||||
type: 'static' | 'map';
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color style for a value based on a color hint.
|
||||
* Supports both static color classes and dynamic map lookups.
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { ContentType } from '../types';
|
||||
export const CONTENT_TYPE_STORAGE_KEY = 'preferred-content-type.v2';
|
||||
|
||||
/** Where the current content type came from, which decides what may still override it. */
|
||||
export type ContentTypeSource =
|
||||
type ContentTypeSource =
|
||||
/** Nothing has chosen a tab, so a configured default may still apply. */
|
||||
| 'unset'
|
||||
/** This browser stored a choice, or something explicit set one. Defaults do not apply. */
|
||||
|
||||
Reference in new issue
Block a user