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

@ -5,10 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<meta name="description" content="A simple OpenWrt firmware selector using autocompletion." />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
@ -24,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>OpenWrt Firmware Selector Wizard</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

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>