From 893fba5b8cc16cf0f282406653a42401cd663cc5 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Sun, 7 Mar 2021 22:35:27 +0330 Subject: [PATCH] fix image urls --- server/src/main/kotlin/ir/armor/tachidesk/util/Extension.kt | 2 +- server/src/main/kotlin/ir/armor/tachidesk/util/MangaList.kt | 2 +- webUI/react/src/components/ExtensionCard.tsx | 5 ++++- webUI/react/src/components/MangaCard.tsx | 4 +++- webUI/react/src/components/SourceCard.tsx | 5 ++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/util/Extension.kt b/server/src/main/kotlin/ir/armor/tachidesk/util/Extension.kt index 6570bf1..319afcc 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/util/Extension.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/util/Extension.kt @@ -168,5 +168,5 @@ fun getExtensionIcon(apkName: String): Pair { } fun getExtensionIconUrl(apkName: String): String { - return "http://127.0.0.1:4567/api/v1/extension/icon/$apkName" + return "/api/v1/extension/icon/$apkName" } diff --git a/server/src/main/kotlin/ir/armor/tachidesk/util/MangaList.kt b/server/src/main/kotlin/ir/armor/tachidesk/util/MangaList.kt index b46f854..e007079 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/util/MangaList.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/util/MangaList.kt @@ -14,7 +14,7 @@ import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction fun proxyThumbnailUrl(mangaId: Int): String { - return "http://127.0.0.1:4567/api/v1/manga/$mangaId/thumbnail" + return "/api/v1/manga/$mangaId/thumbnail" } fun getMangaList(sourceId: Long, pageNum: Int = 1, popular: Boolean): PagedMangaListDataClass { diff --git a/webUI/react/src/components/ExtensionCard.tsx b/webUI/react/src/components/ExtensionCard.tsx index 236c77f..f8d52d2 100644 --- a/webUI/react/src/components/ExtensionCard.tsx +++ b/webUI/react/src/components/ExtensionCard.tsx @@ -10,6 +10,7 @@ import Button from '@material-ui/core/Button'; import Avatar from '@material-ui/core/Avatar'; import Typography from '@material-ui/core/Typography'; import client from '../util/client'; +import useLocalStorage from '../util/useLocalStorage'; const useStyles = makeStyles((theme) => ({ root: { @@ -49,6 +50,8 @@ export default function ExtensionCard(props: IProps) { } = props; const [installedState, setInstalledState] = useState((installed ? 'uninstall' : 'install')); + const [serverAddress] = useLocalStorage('serverBaseURL', ''); + const classes = useStyles(); const langPress = lang === 'all' ? 'All' : lang.toUpperCase(); @@ -84,7 +87,7 @@ export default function ExtensionCard(props: IProps) { variant="rounded" className={classes.icon} alt={name} - src={iconUrl} + src={serverAddress + iconUrl} />
diff --git a/webUI/react/src/components/MangaCard.tsx b/webUI/react/src/components/MangaCard.tsx index 12ae32a..32c0f80 100644 --- a/webUI/react/src/components/MangaCard.tsx +++ b/webUI/react/src/components/MangaCard.tsx @@ -10,6 +10,7 @@ import CardMedia from '@material-ui/core/CardMedia'; import Typography from '@material-ui/core/Typography'; import { Link } from 'react-router-dom'; import { Grid } from '@material-ui/core'; +import useLocalStorage from '../util/useLocalStorage'; const useStyles = makeStyles({ root: { @@ -51,6 +52,7 @@ const MangaCard = React.forwardRef((props: IProps, ref) => { }, } = props; const classes = useStyles(); + const [serverAddress] = useLocalStorage('serverBaseURL', ''); return ( @@ -62,7 +64,7 @@ const MangaCard = React.forwardRef((props: IProps, ref) => { className={classes.image} component="img" alt={title} - image={thumbnailUrl} + image={serverAddress + thumbnailUrl} title={title} />
diff --git a/webUI/react/src/components/SourceCard.tsx b/webUI/react/src/components/SourceCard.tsx index be4bfa3..20df650 100644 --- a/webUI/react/src/components/SourceCard.tsx +++ b/webUI/react/src/components/SourceCard.tsx @@ -9,6 +9,7 @@ import CardContent from '@material-ui/core/CardContent'; import Button from '@material-ui/core/Button'; import Avatar from '@material-ui/core/Avatar'; import Typography from '@material-ui/core/Typography'; +import useLocalStorage from '../util/useLocalStorage'; const useStyles = makeStyles((theme) => ({ root: { @@ -47,6 +48,8 @@ export default function SourceCard(props: IProps) { }, } = props; + const [serverAddress] = useLocalStorage('serverBaseURL', ''); + const classes = useStyles(); return ( @@ -57,7 +60,7 @@ export default function SourceCard(props: IProps) { variant="rounded" className={classes.icon} alt={name} - src={iconUrl} + src={serverAddress + iconUrl} />