mirror of
https://git.netzspielplatz.de/docker-multiarch/openwrt-firmware-selector.git
synced 2025-11-08 20:49:24 +00:00
fix snapshot download links
This commit is contained in:
parent
849c4b6366
commit
b3b52baf11
5 changed files with 27 additions and 8 deletions
|
|
@ -11,7 +11,9 @@ const config = {
|
||||||
default_version: '19.07.7',
|
default_version: '19.07.7',
|
||||||
|
|
||||||
// Image download URL (optional)
|
// Image download URL (optional)
|
||||||
image_url: 'https://downloads.openwrt.org/releases/{version}/targets/{target}',
|
base_url: 'https://downloads.openwrt.org',
|
||||||
|
releases_directory: 'releases',
|
||||||
|
target_directory: 'targets',
|
||||||
|
|
||||||
// Info link URL (optional)
|
// Info link URL (optional)
|
||||||
info_url: 'https://openwrt.org/start?do=search&id=toh&q={title}',
|
info_url: 'https://openwrt.org/start?do=search&id=toh&q={title}',
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import config from '../../../config';
|
||||||
import { getTitle } from '../utils/title';
|
import { getTitle } from '../utils/title';
|
||||||
import asu from '../../../utils/asu';
|
import asu from '../../../utils/asu';
|
||||||
import { GetBuildResponse } from '../../../types/asu';
|
import { GetBuildResponse } from '../../../types/asu';
|
||||||
|
import { getAsuDownloadLink, getStockDownloadLink } from '../utils/links';
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles(() => ({
|
||||||
chip: {
|
chip: {
|
||||||
|
|
@ -153,9 +154,11 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
|
||||||
|
|
||||||
const buildCustomImage = async () => {
|
const buildCustomImage = async () => {
|
||||||
setBuildStatus('Please wait...');
|
setBuildStatus('Please wait...');
|
||||||
|
setBuildError(undefined);
|
||||||
try {
|
try {
|
||||||
const response = await asu.build(
|
const response = await asu.build(
|
||||||
Array.from(customPackages.values()),
|
Array.from(customPackages.values()),
|
||||||
|
profile.target,
|
||||||
profile.id,
|
profile.id,
|
||||||
profile.version_number,
|
profile.version_number,
|
||||||
onBuildStatusChange
|
onBuildStatusChange
|
||||||
|
|
@ -254,9 +257,11 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{profile.images?.map((i) => {
|
{profile.images?.map((i) => {
|
||||||
const downloadURL = `${config.image_url
|
const downloadURL = getStockDownloadLink(
|
||||||
.replace('{target}', profile.target)
|
profile.version_number,
|
||||||
.replace('{version}', profile.version_number)}/${i.name}`;
|
profile.target,
|
||||||
|
i.name
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<TableRow key={downloadURL + i.type}>
|
<TableRow key={downloadURL + i.type}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
|
@ -426,8 +431,7 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{buildResponse.images?.map((i) => {
|
{buildResponse.images?.map((i) => {
|
||||||
// eslint-disable-next-line max-len
|
const downloadURL = getAsuDownloadLink(buildResponse.bin_dir, i.name);
|
||||||
const downloadURL = `${config.asu_url}/store/${buildResponse.bin_dir}/${i.name}`;
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={downloadURL + i.type}>
|
<TableRow key={downloadURL + i.type}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
|
|
||||||
11
src/containers/home/utils/links.ts
Normal file
11
src/containers/home/utils/links.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import config from '../../../config';
|
||||||
|
|
||||||
|
export const getAsuDownloadLink = (bin_dir: string, name: string) => {
|
||||||
|
return `${config.asu_url}/store/${bin_dir}/${name}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getStockDownloadLink = (version: string, target: string, name: string) => {
|
||||||
|
return `${config.base_url}/${
|
||||||
|
version === 'SNAPSHOT' ? 'snapshots' : `${config.releases_directory}/${version}`
|
||||||
|
}/${config.target_directory}/${target}/${name}`;
|
||||||
|
};
|
||||||
|
|
@ -3,8 +3,9 @@ import config from '../config';
|
||||||
import { GetBuildResponse } from '../types/asu';
|
import { GetBuildResponse } from '../types/asu';
|
||||||
|
|
||||||
const asu = {
|
const asu = {
|
||||||
buildNew: (packages: string[], profile: string, version: string) =>
|
buildNew: (packages: string[], target: string, profile: string, version: string) =>
|
||||||
axios.post<GetBuildResponse>(`${config.asu_url}/api/build`, {
|
axios.post<GetBuildResponse>(`${config.asu_url}/api/build`, {
|
||||||
|
target,
|
||||||
version,
|
version,
|
||||||
profile,
|
profile,
|
||||||
packages,
|
packages,
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ import { sleep } from './common';
|
||||||
|
|
||||||
const build = async (
|
const build = async (
|
||||||
packages: string[],
|
packages: string[],
|
||||||
|
target: string,
|
||||||
profile: string,
|
profile: string,
|
||||||
version: string,
|
version: string,
|
||||||
buildStatusCallback: (status: string) => void
|
buildStatusCallback: (status: string) => void
|
||||||
) => {
|
) => {
|
||||||
const buildResponse = await api.asu.buildNew(packages, profile, version);
|
const buildResponse = await api.asu.buildNew(packages, target, profile, version);
|
||||||
if (buildResponse.status === 202) {
|
if (buildResponse.status === 202) {
|
||||||
buildStatusCallback(`#${buildResponse} in queue`);
|
buildStatusCallback(`#${buildResponse} in queue`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue