add download links

This commit is contained in:
Sudhanshu Gautam 2021-01-10 20:36:13 +05:30
parent 9f4d64e1c0
commit f3133a38a0
3 changed files with 25 additions and 21 deletions

View file

@ -11,7 +11,7 @@ const config = {
default_version: '19.07.5',
// Image download URL (optional)
image_url: 'https://downloads.openwrt.org/releases/{version}/{target}',
image_url: 'https://downloads.openwrt.org/releases/{version}/targets/{target}',
// Info link URL (optional)
info_url: 'https://openwrt.org/start?do=search&id=toh&q={title}',

View file

@ -172,21 +172,28 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
</TableRow>
</TableHead>
<TableBody>
{profile.images?.map((i) => (
<TableRow>
<TableCell>
<Button endIcon={<CloudDownload />} variant="contained" color="primary">
{i.type}
</Button>
</TableCell>
<TableCell>
<Box p={1}>
<Typography>{t(`tr-${getHelpKey(i.type)}`)}</Typography>
<Typography variant="caption">sha256sum: {i.sha256}</Typography>
</Box>
</TableCell>
</TableRow>
))}
{profile.images?.map((i) => {
const downloadURL = `${config.image_url
.replace('{target}', profile.target)
.replace('{version}', profile.version_number)}/${i.name}`;
return (
<TableRow>
<TableCell>
<Link href={downloadURL} target="_blank">
<Button endIcon={<CloudDownload />} variant="contained" color="primary">
{i.type}
</Button>
</Link>
</TableCell>
<TableCell>
<Box p={1}>
<Typography>{t(`tr-${getHelpKey(i.type)}`)}</Typography>
<Typography variant="caption">sha256sum: {i.sha256}</Typography>
</Box>
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>