fix image urls

This commit is contained in:
Aria Moradi 2021-03-07 22:35:27 +03:30
parent c1786f8e24
commit 893fba5b8c
5 changed files with 13 additions and 5 deletions

View File

@ -168,5 +168,5 @@ fun getExtensionIcon(apkName: String): Pair<InputStream, String> {
} }
fun getExtensionIconUrl(apkName: String): String { fun getExtensionIconUrl(apkName: String): String {
return "http://127.0.0.1:4567/api/v1/extension/icon/$apkName" return "/api/v1/extension/icon/$apkName"
} }

View File

@ -14,7 +14,7 @@ import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
fun proxyThumbnailUrl(mangaId: Int): String { 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 { fun getMangaList(sourceId: Long, pageNum: Int = 1, popular: Boolean): PagedMangaListDataClass {

View File

@ -10,6 +10,7 @@ import Button from '@material-ui/core/Button';
import Avatar from '@material-ui/core/Avatar'; import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import client from '../util/client'; import client from '../util/client';
import useLocalStorage from '../util/useLocalStorage';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@ -49,6 +50,8 @@ export default function ExtensionCard(props: IProps) {
} = props; } = props;
const [installedState, setInstalledState] = useState<string>((installed ? 'uninstall' : 'install')); const [installedState, setInstalledState] = useState<string>((installed ? 'uninstall' : 'install'));
const [serverAddress] = useLocalStorage<String>('serverBaseURL', '');
const classes = useStyles(); const classes = useStyles();
const langPress = lang === 'all' ? 'All' : lang.toUpperCase(); const langPress = lang === 'all' ? 'All' : lang.toUpperCase();
@ -84,7 +87,7 @@ export default function ExtensionCard(props: IProps) {
variant="rounded" variant="rounded"
className={classes.icon} className={classes.icon}
alt={name} alt={name}
src={iconUrl} src={serverAddress + iconUrl}
/> />
<div style={{ display: 'flex', flexDirection: 'column' }}> <div style={{ display: 'flex', flexDirection: 'column' }}>
<Typography variant="h5" component="h2"> <Typography variant="h5" component="h2">

View File

@ -10,6 +10,7 @@ import CardMedia from '@material-ui/core/CardMedia';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Grid } from '@material-ui/core'; import { Grid } from '@material-ui/core';
import useLocalStorage from '../util/useLocalStorage';
const useStyles = makeStyles({ const useStyles = makeStyles({
root: { root: {
@ -51,6 +52,7 @@ const MangaCard = React.forwardRef((props: IProps, ref) => {
}, },
} = props; } = props;
const classes = useStyles(); const classes = useStyles();
const [serverAddress] = useLocalStorage<String>('serverBaseURL', '');
return ( return (
<Grid item xs={6} sm={4} md={3} lg={2}> <Grid item xs={6} sm={4} md={3} lg={2}>
@ -62,7 +64,7 @@ const MangaCard = React.forwardRef((props: IProps, ref) => {
className={classes.image} className={classes.image}
component="img" component="img"
alt={title} alt={title}
image={thumbnailUrl} image={serverAddress + thumbnailUrl}
title={title} title={title}
/> />
<div className={classes.gradient} /> <div className={classes.gradient} />

View File

@ -9,6 +9,7 @@ import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import Avatar from '@material-ui/core/Avatar'; import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import useLocalStorage from '../util/useLocalStorage';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@ -47,6 +48,8 @@ export default function SourceCard(props: IProps) {
}, },
} = props; } = props;
const [serverAddress] = useLocalStorage<String>('serverBaseURL', '');
const classes = useStyles(); const classes = useStyles();
return ( return (
@ -57,7 +60,7 @@ export default function SourceCard(props: IProps) {
variant="rounded" variant="rounded"
className={classes.icon} className={classes.icon}
alt={name} alt={name}
src={iconUrl} src={serverAddress + iconUrl}
/> />
<div style={{ display: 'flex', flexDirection: 'column' }}> <div style={{ display: 'flex', flexDirection: 'column' }}>
<Typography variant="h5" component="h2"> <Typography variant="h5" component="h2">