diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx index f5ab76d..5e84a2e 100644 --- a/src/client/actions/fileops.actions.tsx +++ b/src/client/actions/fileops.actions.tsx @@ -246,42 +246,40 @@ export const fetchComicVineMatches = }); }; -export const extractComicArchive = - (path: string, options: IExtractionOptions) => async (dispatch) => { - const comicBookPages: string[] = []; - dispatch({ - type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS, - }); - const extractedComicBookArchive = await axios({ - method: "POST", - url: `${LIBRARY_SERVICE_BASE_URI}/unrarArchive`, - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - data: { - options, - filePath: path, - }, - }); - map(extractedComicBookArchive.data, (page) => { - const pathItems = page.filePath.split("/"); - const folderName = pathItems[pathItems.length - 2]; +export const extractComicArchive = (path: string) => async (dispatch) => { + const comicBookPages: string[] = []; + dispatch({ + type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS, + }); + const extractedComicBookArchive = await axios({ + method: "POST", + url: `${LIBRARY_SERVICE_BASE_URI}/uncompressFullArchive`, + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + data: { + filePath: path, + }, + }); + map(extractedComicBookArchive.data, (page) => { + const pathItems = page.filePath.split("/"); + const folderName = pathItems[pathItems.length - 2]; - const imagePath = encodeURI( - `${LIBRARY_SERVICE_HOST}/userdata/expanded/` + + const imagePath = encodeURI( + `${LIBRARY_SERVICE_HOST}/userdata/expanded/` + folderName + `/` + page.name + page.extension, - ); - comicBookPages.push(imagePath); - }); - console.log(comicBookPages); - dispatch({ - type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS, - extractedComicBookArchive: comicBookPages, - }); - }; + ); + comicBookPages.push(imagePath); + }); + console.log(comicBookPages); + dispatch({ + type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS, + extractedComicBookArchive: comicBookPages, + }); +}; export const searchIssue = (query, options) => async (dispatch) => { dispatch({ diff --git a/src/client/components/ComicDetail.tsx b/src/client/components/ComicDetail.tsx index 47f4bca..dfa091a 100644 --- a/src/client/components/ComicDetail.tsx +++ b/src/client/components/ComicDetail.tsx @@ -40,7 +40,7 @@ type ComicDetailProps = {}; * ) */ -export const ComicDetail = ({ }: ComicDetailProps): ReactElement => { +export const ComicDetail = ({}: ComicDetailProps): ReactElement => { const [page, setPage] = useState(1); const [active, setActive] = useState(1); const [visible, setVisible] = useState(false); @@ -237,8 +237,8 @@ export const ComicDetail = ({ }: ComicDetailProps): ReactElement => { {/* Downloads tab and count badge */} {id === 5 && - !isNil(comicBookDetailData) && - !isEmpty(comicBookDetailData) ? ( + !isNil(comicBookDetailData) && + !isEmpty(comicBookDetailData) ? ( diff --git a/src/client/components/ComicDetail/Tabs/ArchiveOperations.tsx b/src/client/components/ComicDetail/Tabs/ArchiveOperations.tsx index b9a0660..0b87770 100644 --- a/src/client/components/ComicDetail/Tabs/ArchiveOperations.tsx +++ b/src/client/components/ComicDetail/Tabs/ArchiveOperations.tsx @@ -23,14 +23,7 @@ export const ArchiveOperations = (props): ReactElement => { const dispatch = useDispatch(); const unpackComicArchive = useCallback(() => { - dispatch( - extractComicArchive(data.rawFileDetails.filePath, { - extractTarget: "book", - targetExtractionFolder: - "./userdata/expanded/" + data.rawFileDetails.name, - extractionMode: "all", - }), - ); + dispatch(extractComicArchive(data.rawFileDetails.filePath)); }, [dispatch, data]); // sliding panel config