Skip to content

Commit d38b13f

Browse files
committed
fix: moved download link to /dl, removed redundant field raw, cron build to 30mins
1 parent 50f1d2a commit d38b13f

12 files changed

Lines changed: 17766 additions & 4613 deletions

File tree

web/src/components/app.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import FormulaLinks from "./formula-links";
99
interface AppProps {
1010
data: { [key: string]: any };
1111
logs: string;
12+
repo: string;
1213
}
1314

1415
type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags";
@@ -202,7 +203,7 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
202203
}
203204
}
204205

205-
export default function App({ data, logs: build }: AppProps) {
206+
export default function App({ data, logs: build, repo }: AppProps) {
206207
const { copy, copied } = useClipboard();
207208
return (
208209
<TooltipProvider delayDuration={0}>
@@ -214,20 +215,22 @@ export default function App({ data, logs: build }: AppProps) {
214215
</h1>
215216
<FormulaLinks
216217
webpage_url={data.pkg_webpage}
218+
repo={repo}
219+
arch={data.host}
217220
family={data.pkg_family}
218221
name={data.pkg_name}
219222
download_url={data.download_url}
220223
/>
221224
<Table className="border border-muted/70 mt-4 rounded-xl">
222225
<TableBody>
223-
<TableRow>
226+
{/* <TableRow>
224227
<TableCell className="min-w-28 bg-muted/70 font-medium">
225228
Raw
226229
</TableCell>
227230
<TableCell className="text-wrap break-all whitespace-normal">
228-
<Show value={`${data.pkg_webpage}/raw.json`} props={{ data, logs: build }} />
231+
<Show value={`${data.pkg_webpage}/raw.json`} props={{ data, logs: build, repo }} />
229232
</TableCell>
230-
</TableRow>
233+
</TableRow> */}
231234

232235
{
233236
Object.entries(data)
@@ -238,7 +241,7 @@ export default function App({ data, logs: build }: AppProps) {
238241
{(resolver[Key]?.label || Key)}
239242
</TableCell>
240243
<TableCell className="text-wrap break-all whitespace-normal">
241-
<Show value={Value} props={{ data, logs: build }} Key={Key} />
244+
<Show value={Value} props={{ data, logs: build, repo }} Key={Key} />
242245
</TableCell>
243246
</TableRow>
244247
))

web/src/components/formula-links.tsx

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,47 @@ interface Props {
77
download_url: string;
88
family: string;
99
name: string;
10+
repo: string;
11+
arch: string;
1012
}
1113

12-
const FormulaLinks = ({ webpage_url, download_url, family, name }: Props) => {
13-
const {copied, copy} = useClipboard();
14+
const FormulaLinks = ({ webpage_url, family, name, arch, repo, download_url }: Props) => {
1415
const jsonApiUrl = `${webpage_url}/raw.json`;
1516

17+
const downloadUrl = new URL(`/dl/${repo}/${arch.toLowerCase()}/${family}/${name}/raw.dl`, window.location.origin);
18+
1619
return (
1720
<div className="grid gap-3 p-4 bg-blue-50/30 dark:bg-blue-950/30 rounded-lg border border-blue-100 dark:border-blue-900">
1821
<div className="space-y-2">
1922
<h2 className="text-sm font-medium text-blue-700/70 dark:text-blue-300/70">Package Links</h2>
2023
<div className="grid gap-2">
21-
<Tooltip>
22-
<TooltipTrigger asChild>
23-
<button
24-
onClick={() => copy(jsonApiUrl)}
25-
className="flex items-center gap-3 w-full group"
26-
>
27-
<FileJson className={`h-5 w-5 transition-transform duration-200 ${
28-
copied ? 'text-green-500' : 'text-blue-600/70 dark:text-blue-400/70'
29-
} group-hover:scale-110`} />
30-
<div className="flex flex-col items-start">
31-
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">JSON API</span>
32-
<code className="text-xs text-gray-500 dark:text-gray-400 font-mono">
33-
/{family}/{name}/raw.json
34-
</code>
35-
</div>
36-
</button>
37-
</TooltipTrigger>
38-
<TooltipContent>
39-
<p>{copied ? "Copied!" : "Click to copy API URL"}</p>
40-
</TooltipContent>
41-
</Tooltip>
24+
<a
25+
href={jsonApiUrl}
26+
target="_blank"
27+
rel="noreferrer"
28+
className="flex items-center gap-3 w-full group"
29+
>
30+
<FileJson className="h-5 w-5 transition-transform duration-200 text-blue-600/70 dark:text-blue-400/70 group-hover:scale-110" />
31+
<div className="flex flex-col items-start">
32+
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">JSON API</span>
33+
<code className="text-xs text-gray-500 dark:text-gray-400 font-mono">
34+
/{family}/{name}/raw.json
35+
</code>
36+
</div>
37+
</a>
4238

43-
<a
44-
href="raw.dl"
45-
target="_blank"
39+
<a
40+
href={downloadUrl.toString()}
41+
target="_blank"
4642
rel="noreferrer"
4743
className="flex items-center gap-3 w-full group"
4844
>
4945
<DownloadCloud className="h-5 w-5 text-blue-600/70 dark:text-blue-400/70 group-hover:scale-110 transition-transform duration-200" />
5046
<div className="flex flex-col items-start">
5147
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Download</span>
52-
<span className="text-xs text-gray-500 dark:text-gray-400">
48+
<code className="text-xs text-gray-500 dark:text-gray-400 font-mono">
5349
/{family}/{name}/raw.dl
54-
</span>
50+
</code>
5551
</div>
5652
</a>
5753
</div>

web/src/metadata_bincache_aarch64-linux.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

web/src/metadata_bincache_x86_64-linux.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

web/src/pages/repo/bincache/x86_64-linux/[family]/[package]/raw.dl.astro renamed to web/src/pages/dl/bincache/aarch64-linux/[family]/[package]/raw.dl.astro

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
---
22
import Layout from "@/layouts/Layout.astro";
3-
import { getStaticPaths } from "./index.astro";
4-
export { getStaticPaths };
3+
4+
export async function getStaticPaths() {
5+
const { default: apps } = await import("../../../../../repo/bincache/aarch64-linux/_apps.json");
6+
7+
return apps.map((app) => {
8+
return {
9+
params: {
10+
family: app.pkg_family,
11+
package: app.pkg_name || app.pkg,
12+
},
13+
props: {
14+
data: app,
15+
logs: app.build_log || "",
16+
},
17+
};
18+
});
19+
}
20+
521
const { data } = Astro.props;
622
---
723

web/src/pages/repo/bincache/aarch64-linux/[family]/[package]/raw.dl.astro renamed to web/src/pages/dl/bincache/x86_64-linux/[family]/[package]/raw.dl.astro

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
---
22
import Layout from "@/layouts/Layout.astro";
3-
import { getStaticPaths } from "./index.astro";
4-
export { getStaticPaths };
3+
4+
export async function getStaticPaths() {
5+
const { default: apps } = await import("../../../../../repo/bincache/x86_64-linux/_apps.json");
6+
7+
return apps.map((app) => {
8+
return {
9+
params: {
10+
family: app.pkg_family,
11+
package: app.pkg_name || app.pkg,
12+
},
13+
props: {
14+
data: app,
15+
logs: app.build_log || "",
16+
},
17+
};
18+
});
19+
}
20+
521
const { data } = Astro.props;
622
---
723

web/src/pages/repo/bincache/aarch64-linux/[family]/[package]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ const { data, logs } = Astro.props;
2323
---
2424

2525
<Layout>
26-
<App data={data} logs={logs} client:only />
26+
<App data={data} logs={logs} repo="bincache" client:only />
2727
</Layout>

0 commit comments

Comments
 (0)