This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
"style-src": "'self' 'unsafe-inline' blob: asset: http://asset.localhost https://cdn.jsdelivr.net https://fonts.googleapis.com https://cdnjs.cloudflare.com https://storage.readest.com",
|
||||
"font-src": "'self' blob: data: asset: http://asset.localhost tauri: https://db.onlinewebfonts.com https://cdn.jsdelivr.net https://fonts.gstatic.com https://cdnjs.cloudflare.com https://storage.readest.com",
|
||||
"frame-src": "'self' blob: asset: http://asset.localhost https://*.stripe.com",
|
||||
"script-src": "'self' 'unsafe-inline' 'unsafe-eval' blob: asset: http://asset.localhost https://*.sentry.io https://*.posthog.com https://*.stripe.com"
|
||||
"script-src": "'self' 'unsafe-inline' 'unsafe-eval' data: blob: asset: http://asset.localhost https://*.sentry.io https://*.posthog.com https://*.stripe.com"
|
||||
},
|
||||
"assetProtocol": {
|
||||
"enable": true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BookFormat } from '@/types/book';
|
||||
import { Collection, Contributor, Identifier, LanguageMap } from '@/utils/book';
|
||||
import { configureZip } from '@/utils/zip';
|
||||
import * as epubcfi from 'foliate-js/epubcfi.js';
|
||||
|
||||
export const CFI = epubcfi;
|
||||
@@ -148,10 +149,9 @@ export class DocumentLoader {
|
||||
return null;
|
||||
};
|
||||
|
||||
const { configure, ZipReader, BlobReader, TextWriter, BlobWriter } =
|
||||
await import('@zip.js/zip.js');
|
||||
await configureZip();
|
||||
const { ZipReader, BlobReader, TextWriter, BlobWriter } = await import('@zip.js/zip.js');
|
||||
type Entry = import('@zip.js/zip.js').Entry;
|
||||
configure({ useWebWorkers: false, useCompressionStream: false });
|
||||
const reader = new ZipReader(new BlobReader(this.file));
|
||||
const entries = await reader.getEntries();
|
||||
const map = new Map(entries.map((entry) => [entry.filename, entry]));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { partialMD5 } from './md5';
|
||||
import { getBaseFilename } from './path';
|
||||
import { detectLanguage } from './lang';
|
||||
import { configureZip } from './zip';
|
||||
|
||||
interface Metadata {
|
||||
bookTitle: string;
|
||||
@@ -273,6 +274,7 @@ export class TxtToEpubConverter {
|
||||
}
|
||||
|
||||
private async createEpub(chapters: Chapter[], metadata: Metadata): Promise<Blob> {
|
||||
await configureZip();
|
||||
const { BlobWriter, TextReader, ZipWriter } = await import('@zip.js/zip.js');
|
||||
const { bookTitle, author, language, identifier } = metadata;
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export const configureZip = async () => {
|
||||
const { configure } = await import('@zip.js/zip.js');
|
||||
configure({ useWebWorkers: false, useCompressionStream: false });
|
||||
};
|
||||
Reference in New Issue
Block a user