🔧 Rewiring for the new uncompression endpoint
This commit is contained in:
@@ -246,42 +246,40 @@ export const fetchComicVineMatches =
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const extractComicArchive =
|
export const extractComicArchive = (path: string) => async (dispatch) => {
|
||||||
(path: string, options: IExtractionOptions) => async (dispatch) => {
|
const comicBookPages: string[] = [];
|
||||||
const comicBookPages: string[] = [];
|
dispatch({
|
||||||
dispatch({
|
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS,
|
||||||
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS,
|
});
|
||||||
});
|
const extractedComicBookArchive = await axios({
|
||||||
const extractedComicBookArchive = await axios({
|
method: "POST",
|
||||||
method: "POST",
|
url: `${LIBRARY_SERVICE_BASE_URI}/uncompressFullArchive`,
|
||||||
url: `${LIBRARY_SERVICE_BASE_URI}/unrarArchive`,
|
headers: {
|
||||||
headers: {
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
"Content-Type": "application/json; charset=utf-8",
|
},
|
||||||
},
|
data: {
|
||||||
data: {
|
filePath: path,
|
||||||
options,
|
},
|
||||||
filePath: path,
|
});
|
||||||
},
|
map(extractedComicBookArchive.data, (page) => {
|
||||||
});
|
const pathItems = page.filePath.split("/");
|
||||||
map(extractedComicBookArchive.data, (page) => {
|
const folderName = pathItems[pathItems.length - 2];
|
||||||
const pathItems = page.filePath.split("/");
|
|
||||||
const folderName = pathItems[pathItems.length - 2];
|
|
||||||
|
|
||||||
const imagePath = encodeURI(
|
const imagePath = encodeURI(
|
||||||
`${LIBRARY_SERVICE_HOST}/userdata/expanded/` +
|
`${LIBRARY_SERVICE_HOST}/userdata/expanded/` +
|
||||||
folderName +
|
folderName +
|
||||||
`/` +
|
`/` +
|
||||||
page.name +
|
page.name +
|
||||||
page.extension,
|
page.extension,
|
||||||
);
|
);
|
||||||
comicBookPages.push(imagePath);
|
comicBookPages.push(imagePath);
|
||||||
});
|
});
|
||||||
console.log(comicBookPages);
|
console.log(comicBookPages);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
|
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
|
||||||
extractedComicBookArchive: comicBookPages,
|
extractedComicBookArchive: comicBookPages,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchIssue = (query, options) => async (dispatch) => {
|
export const searchIssue = (query, options) => async (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ type ComicDetailProps = {};
|
|||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const ComicDetail = ({ }: ComicDetailProps): ReactElement => {
|
export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [active, setActive] = useState(1);
|
const [active, setActive] = useState(1);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
@@ -237,8 +237,8 @@ export const ComicDetail = ({ }: ComicDetailProps): ReactElement => {
|
|||||||
{/* Downloads tab and count badge */}
|
{/* Downloads tab and count badge */}
|
||||||
<a>
|
<a>
|
||||||
{id === 5 &&
|
{id === 5 &&
|
||||||
!isNil(comicBookDetailData) &&
|
!isNil(comicBookDetailData) &&
|
||||||
!isEmpty(comicBookDetailData) ? (
|
!isEmpty(comicBookDetailData) ? (
|
||||||
<span className="download-icon-labels">
|
<span className="download-icon-labels">
|
||||||
<i className="fa-solid fa-download"></i>
|
<i className="fa-solid fa-download"></i>
|
||||||
<span className="tag downloads-count is-info is-light">
|
<span className="tag downloads-count is-info is-light">
|
||||||
|
|||||||
@@ -23,14 +23,7 @@ export const ArchiveOperations = (props): ReactElement => {
|
|||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const unpackComicArchive = useCallback(() => {
|
const unpackComicArchive = useCallback(() => {
|
||||||
dispatch(
|
dispatch(extractComicArchive(data.rawFileDetails.filePath));
|
||||||
extractComicArchive(data.rawFileDetails.filePath, {
|
|
||||||
extractTarget: "book",
|
|
||||||
targetExtractionFolder:
|
|
||||||
"./userdata/expanded/" + data.rawFileDetails.name,
|
|
||||||
extractionMode: "all",
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}, [dispatch, data]);
|
}, [dispatch, data]);
|
||||||
|
|
||||||
// sliding panel config
|
// sliding panel config
|
||||||
|
|||||||
Reference in New Issue
Block a user