🍬 Removed hardcoded reference to import-service
TODO: Remove the repetitive use of thumbnail generating logic
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
PriorityEnum,
|
||||
SearchResponse,
|
||||
} from "threetwo-ui-typings";
|
||||
import { IMPORT_SERVICE_BASE_URI } from "../constants/endpoints";
|
||||
import {
|
||||
AIRDCPP_SEARCH_RESULTS_ADDED,
|
||||
AIRDCPP_SEARCH_RESULTS_UPDATED,
|
||||
@@ -129,7 +130,7 @@ export const downloadAirDCPPItem =
|
||||
if (!isNil(downloadResult)) {
|
||||
bundleDBImportResult = await axios({
|
||||
method: "POST",
|
||||
url: "http://localhost:3000/api/import/applyAirDCPPDownloadMetadata",
|
||||
url: `${IMPORT_SERVICE_BASE_URI}/applyAirDCPPDownloadMetadata`,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
@@ -187,7 +188,7 @@ export const getBundlesForComic =
|
||||
}
|
||||
const comicObject = await axios({
|
||||
method: "POST",
|
||||
url: "http://localhost:3000/api/import/getComicBookById",
|
||||
url: `${IMPORT_SERVICE_BASE_URI}/getComicBookById`,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
|
||||
@@ -12,7 +12,10 @@ import {
|
||||
IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
|
||||
IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS,
|
||||
} from "../constants/action-types";
|
||||
import { COMICBOOKINFO_SERVICE_URI } from "../constants/endpoints";
|
||||
import {
|
||||
COMICBOOKINFO_SERVICE_URI,
|
||||
IMPORT_SERVICE_BASE_URI,
|
||||
} from "../constants/endpoints";
|
||||
|
||||
const http = rateLimiter(axios.create(), {
|
||||
maxRequests: 1,
|
||||
@@ -67,7 +70,7 @@ export const getComicBookDetailById =
|
||||
IMS_inProgress: true,
|
||||
});
|
||||
const result = await axios.request({
|
||||
url: `http://localhost:3000/api/import/getComicBookById`,
|
||||
url: `${IMPORT_SERVICE_BASE_URI}/getComicBookById`,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: comicBookObjectId,
|
||||
@@ -87,7 +90,7 @@ export const applyComicVineMatch =
|
||||
IMS_inProgress: true,
|
||||
});
|
||||
const result = await axios.request({
|
||||
url: "http://localhost:3000/api/import/applyComicVineMetadata",
|
||||
url: `${IMPORT_SERVICE_BASE_URI}/applyComicVineMetadata`,
|
||||
method: "POST",
|
||||
data: {
|
||||
match,
|
||||
@@ -109,7 +112,7 @@ export const extractComicArchive =
|
||||
});
|
||||
const extractedComicBookArchive = await axios({
|
||||
method: "POST",
|
||||
url: "http://localhost:3000/api/import/unrarArchive",
|
||||
url: `${IMPORT_SERVICE_BASE_URI}/unrarArchive`,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
@@ -122,9 +125,9 @@ export const extractComicArchive =
|
||||
const foo = page.path.split("/");
|
||||
const folderName = foo[foo.length - 1];
|
||||
const imagePath = encodeURI(
|
||||
"http://localhost:3000/userdata/expanded/" +
|
||||
`${IMPORT_SERVICE_BASE_URI}/userdata/expanded/` +
|
||||
folderName +
|
||||
"/" +
|
||||
`/` +
|
||||
page.name +
|
||||
page.extension,
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from "../shared/utils/formatting.utils";
|
||||
import { isUndefined, isEmpty, isNil } from "lodash";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IMPORT_SERVICE_HOST } from "../constants/endpoints";
|
||||
import ellipsize from "ellipsize";
|
||||
|
||||
interface IProps {
|
||||
@@ -26,7 +27,7 @@ class Card extends React.Component<IProps, IState> {
|
||||
metadata: IExtractedComicBookCoverFile,
|
||||
): JSX.Element => {
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" + removeLeadingPeriod(metadata.path),
|
||||
`${IMPORT_SERVICE_HOST}` + removeLeadingPeriod(metadata.path),
|
||||
);
|
||||
const filePath = escapePoundSymbol(encodedFilePath);
|
||||
return (
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
escapePoundSymbol,
|
||||
} from "../shared/utils/formatting.utils";
|
||||
import Sticky from "react-stickynode";
|
||||
import { IMPORT_SERVICE_HOST } from "../constants/endpoints";
|
||||
|
||||
type ComicDetailProps = {};
|
||||
/**
|
||||
@@ -465,7 +466,7 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
|
||||
let comicBookTitle = "";
|
||||
if (!isNil(comicBookDetailData.rawFileDetails)) {
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" +
|
||||
`${IMPORT_SERVICE_HOST}` +
|
||||
removeLeadingPeriod(comicBookDetailData.rawFileDetails.cover.filePath),
|
||||
);
|
||||
imagePath = escapePoundSymbol(encodedFilePath);
|
||||
|
||||
@@ -11,6 +11,7 @@ import ellipsize from "ellipsize";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { getComicBooks } from "../actions/fileops.actions";
|
||||
import { isNil } from "lodash";
|
||||
import { IMPORT_SERVICE_HOST } from "../constants/endpoints";
|
||||
|
||||
interface IComicBookLibraryProps {
|
||||
matches?: unknown;
|
||||
@@ -38,7 +39,7 @@ export const Library = ({}: IComicBookLibraryProps): ReactElement => {
|
||||
const RawFileDetails = ({ value }) => {
|
||||
if (!isNil(value.path)) {
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" + removeLeadingPeriod(value.cover.filePath),
|
||||
`${IMPORT_SERVICE_HOST}` + removeLeadingPeriod(value.cover.filePath),
|
||||
);
|
||||
const filePath = escapePoundSymbol(encodedFilePath);
|
||||
return (
|
||||
|
||||
@@ -15,6 +15,7 @@ import Masonry from "react-masonry-css";
|
||||
import Card from "./Carda";
|
||||
import { detectIssueTypes } from "../shared/utils/tradepaperback.utils";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IMPORT_SERVICE_HOST } from "../constants/endpoints";
|
||||
|
||||
|
||||
interface ILibraryGridProps {}
|
||||
@@ -47,7 +48,7 @@ export const LibraryGrid = (libraryGridProps: ILibraryGridProps) => {
|
||||
let comicName = "";
|
||||
if (!isNil(rawFileDetails)) {
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" +
|
||||
`${IMPORT_SERVICE_HOST}` +
|
||||
removeLeadingPeriod(rawFileDetails.cover.filePath),
|
||||
);
|
||||
imagePath = escapePoundSymbol(encodedFilePath);
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
import { isNil, isUndefined, map } from "lodash";
|
||||
import { detectIssueTypes } from "../shared/utils/tradepaperback.utils";
|
||||
import Masonry from "react-masonry-css";
|
||||
import { IMPORT_SERVICE_HOST } from "../constants/endpoints";
|
||||
|
||||
type RecentlyImportedProps = {
|
||||
comicBookCovers: any;
|
||||
@@ -40,7 +41,7 @@ export const RecentlyImported = ({
|
||||
let comicName = "";
|
||||
if (!isNil(rawFileDetails)) {
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" +
|
||||
`${IMPORT_SERVICE_HOST}` +
|
||||
removeLeadingPeriod(rawFileDetails.cover.filePath),
|
||||
);
|
||||
imagePath = escapePoundSymbol(encodedFilePath);
|
||||
|
||||
@@ -23,6 +23,12 @@ export const API_BASE_URI = hostURIBuilder({
|
||||
apiPath: "/api",
|
||||
});
|
||||
|
||||
export const IMPORT_SERVICE_HOST = hostURIBuilder({
|
||||
protocol: "http",
|
||||
host: process.env.DOCKER_HOST || "localhost",
|
||||
port: "3000",
|
||||
apiPath: ``,
|
||||
});
|
||||
export const IMPORT_SERVICE_BASE_URI = hostURIBuilder({
|
||||
protocol: "http",
|
||||
host: process.env.DOCKER_HOST || "localhost",
|
||||
|
||||
Reference in New Issue
Block a user