🧃 Worker is... working.
This commit is contained in:
@@ -31,7 +31,8 @@ export async function extractCoverFromComicBookArchive(
|
||||
| IExtractComicBookCoverErrorResponse
|
||||
> {
|
||||
return await axios.request({
|
||||
url: FS_API_BASE_URI + "/getComicCovers",
|
||||
url: FS_API_BASE_URI + "getComicCovers",
|
||||
method: "POST",
|
||||
data: {
|
||||
...options,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as React from "react";
|
||||
import _ from "lodash";
|
||||
import { connect } from "react-redux";
|
||||
import * as Comlink from "comlink";
|
||||
import { greet } from "../workers/extractCovers.worker";
|
||||
interface IProps {
|
||||
matches: unknown;
|
||||
|
||||
1
src/client/constants/importer.config.ts
Normal file
1
src/client/constants/importer.config.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const SUPPORTED_COMIC_ARCHIVES = [".cbz", ".cbr"];
|
||||
@@ -1,7 +1,28 @@
|
||||
import { walkFolder } from "../actions/fileops.actions";
|
||||
import { IFolderData } from "../../server/interfaces/folder.interface";
|
||||
import {
|
||||
walkFolder,
|
||||
extractCoverFromComicBookArchive,
|
||||
} from "../actions/fileops.actions";
|
||||
import { SUPPORTED_COMIC_ARCHIVES } from "../constants/importer.config";
|
||||
import { IExtractedComicBookCoverFile } from "../../server/interfaces/folder.interface";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function greet(path: string): Promise<IFolderData[]> {
|
||||
export const greet = async (
|
||||
path: string,
|
||||
): Promise<IExtractedComicBookCoverFile[] | unknown> => {
|
||||
console.log(path);
|
||||
return await walkFolder("./comics");
|
||||
const targetOptions = {
|
||||
sourceFolder: path,
|
||||
extractTarget: "cover",
|
||||
targetExtractionFolder: "../covers",
|
||||
};
|
||||
const fileObjects = await walkFolder("./comics");
|
||||
_.map(fileObjects, async (fileObject) => {
|
||||
console.log(fileObject);
|
||||
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
||||
await extractCoverFromComicBookArchive({
|
||||
...targetOptions,
|
||||
folderDetails: fileObject,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const port: number = Number(process.env.PORT) || 8050; // set our port
|
||||
|
||||
// Send index.html on root request
|
||||
app.use(express.static("dist"));
|
||||
app.use(express.static("src/client/workers"));
|
||||
|
||||
app.get("/", (req: Request, res: Response) => {
|
||||
console.log("sending index.html");
|
||||
res.sendFile("/dist/index.html");
|
||||
|
||||
@@ -223,8 +223,6 @@ export const explodePath = (filePath: string): IExplodedPathResponse => {
|
||||
const constructPaths = (extractionOptions: IExtractionOptions) => {
|
||||
return {
|
||||
targetPath:
|
||||
extractionOptions.sourceFolder +
|
||||
"/" +
|
||||
extractionOptions.targetExtractionFolder +
|
||||
"/" +
|
||||
extractionOptions.folderDetails.name,
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist/",
|
||||
"noImplicitAny": true,
|
||||
"skipLibCheck": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
"esnext",
|
||||
"webworker"
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"eslint.workingDirectories": [
|
||||
{"directory": "./node_modules", "changeProcessCWD": true }
|
||||
{ "directory": "./node_modules", "changeProcessCWD": true }
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
|
||||
@@ -65,6 +65,9 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
},
|
||||
optimization: {
|
||||
usedExports: false,
|
||||
},
|
||||
plugins: [
|
||||
// new CleanWebpackPlugin([outputDirectory]),
|
||||
new HtmlWebpackPlugin({
|
||||
|
||||
Reference in New Issue
Block a user