Skip to content

Commit 7606f80

Browse files
committed
new stuff
1 parent a308a2a commit 7606f80

14 files changed

Lines changed: 3509 additions & 77 deletions

File tree

web/load.mjs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,27 @@ const run = async (url, branch, arch) => {
2222
response.push(data);
2323

2424
if (!data.pkg_webpage) {
25-
console.log(`⚠️ Auto guessed pkg_webpage for ${branch}-${arch}/${data.pkg_family}/${data.pkg_name || data.pkg}`)
25+
console.log(
26+
`⚠️ Auto guessed pkg_webpage for ${branch}-${arch}/${data.pkg_family}/${
27+
data.pkg_name || data.pkg
28+
}`
29+
);
2630
data.pkg_webpage = `https://pkgs.pkgforge.dev/repo/${branch}/${arch}/${
2731
data.pkg_family
2832
}/${data.pkg_name || data.pkg}`;
2933
}
3034

31-
if (familyMap[data.pkg_family]) {
32-
familyMap[data.pkg_family].push([
33-
data.pkg_name || data.pkg,
35+
const [, , , , , category, pkg_family, pkg] = data.pkg_webpage.split("/");
36+
37+
if (familyMap[pkg_family || data.pkg_family]) {
38+
familyMap[pkg_family || data.pkg_family].push([
39+
category,
40+
pkg,
3441
data.pkg_webpage,
3542
]);
3643
} else {
37-
familyMap[data.pkg_family] = [
38-
[data.pkg_name || data.pkg, data.pkg_webpage],
44+
familyMap[pkg_family || data.pkg_family] = [
45+
[category, pkg, data.pkg_webpage],
3946
];
4047
}
4148
});
@@ -84,7 +91,7 @@ const run = async (url, branch, arch) => {
8491
await run(binX86, "bincache", "x86_64-linux");
8592

8693
console.log("⏲️ Downloading soarpkgs");
87-
await run(soarpkgs, "soarpkgs", "linux");
94+
await run(soarpkgs, "soarpkgs", "[category]");
8895

8996
// console.log("⏲️ Downloading Community");
9097
// await run(community, "community", "universal-linux");

web/src/components/app.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Table, TableBody, TableCell, TableRow } from "./ui/table";
22
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
33
import { Badge } from "./ui/badge";
4-
import { ExternalLink, Image as ImageIcon, LucideTerminalSquare, Package, ScrollText, Download, Bug } from "lucide-react";
4+
import { ExternalLink, LucideTerminalSquare, Package, ScrollText, Download, Bug } from "lucide-react";
55
import { buttonVariants } from "./ui/button";
66
import { useClipboard } from "../hooks/use-clipboard";
77
import FormulaLinks from "./formula-links";
@@ -10,9 +10,10 @@ interface AppProps {
1010
data: { [key: string]: any };
1111
logs: string;
1212
repo: string;
13+
downloadable?: boolean;
1314
}
1415

15-
type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]";
16+
type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]" | "license";
1617

1718
interface ResolverField {
1819
label: string;
@@ -29,7 +30,7 @@ const resolver: { [key: string]: ResolverField } = {
2930
bsum: { label: "BLAKE3SUM", type: "hash" },
3031
repology: { label: "Repology", type: "repology" },
3132
appstream: { label: "AppStream", type: "link" },
32-
license: { label: "License", type: "string[]", joinWith: ", " },
33+
license: { label: "License", type: "license" },
3334
snapshots: { label: "Snapshots", type: "version" },
3435
tag: { label: "Tags", type: "tags" },
3536
app_id: { label: "Application ID", type: "default" },
@@ -49,10 +50,10 @@ const resolver: { [key: string]: ResolverField } = {
4950
icon: { label: "Icon", type: "link" },
5051
provides: { label: "Provides", type: "provides" },
5152
description: { label: "Description", type: "default" },
52-
host: { label: "Host", type: "default" },
5353
pkg_type: { label: "Package Type", type: "default" },
5454
pkg_webpage: { label: "Package Webpage", type: "link" },
55-
maintainer: { label: "Maintainer", type: "string[]", joinWith: ", " },
55+
maintainer: { label: "Maintainer", type: "string[]", joinWith: "\n" },
56+
host: { label: "Host", type: "tags" },
5657
rank: { label: "Rank", type: "metric" },
5758
build_ghactions: { label: "GH Actions Build", type: "link" },
5859
ghcr_blob: { label: "GHCR Blob", type: "link" },
@@ -175,6 +176,24 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
175176
</div>
176177
);
177178

179+
case "license":
180+
const l = value as string[];
181+
return (
182+
<div className="flex flex-wrap gap-1">
183+
{l.map((s) => {
184+
return (
185+
<div key={s} className="flex">
186+
<a href={`https://spdx.org/licenses/${s}.html`} target="_blank" rel="noreferrer"
187+
className="underline underline-offset-4">
188+
<Badge className="bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-100">
189+
{s}
190+
</Badge>
191+
</a>
192+
</div>
193+
);
194+
})}
195+
</div>
196+
);
178197
case "repology":
179198
const repology = value as string[];
180199
return (
@@ -256,7 +275,7 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
256275
}
257276
}
258277

259-
export default function App({ data, logs: build, repo }: AppProps) {
278+
export default function App({ data, logs: build, repo, downloadable = true }: AppProps) {
260279
const { copy, copied } = useClipboard();
261280

262281
// Thanks @Azathothas for forcing us to write this hellifying script
@@ -276,7 +295,7 @@ export default function App({ data, logs: build, repo }: AppProps) {
276295
arch={data.host}
277296
family={pkg_family}
278297
name={pkg}
279-
download_url={data.download_url}
298+
download_url={downloadable ? data.download_url : "none"}
280299
/>
281300
<Table className="border border-muted/70 mt-4 rounded-xl">
282301
<TableBody>

web/src/components/data-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import binX86 from "../metadata_bincache_x86_64-linux.json";
3939

4040
const binArm64 = import("../metadata_bincache_aarch64-linux.json");
4141

42-
const soarPkgs = import("../metadata_soarpkgs_linux.json");
42+
const soarPkgs = import("../metadata_soarpkgs_[category].json");
4343

4444
interface DataTableProps<TData, TValue> {
4545
columns: ColumnDef<TData, TValue>[]

web/src/components/formula-links.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const FormulaLinks = ({ webpage_url, family, name, arch, repo, download_url }: P
3737
</div>
3838
</a>
3939

40-
<a
40+
{download_url != "none" && <a
4141
href={downloadUrl.toString()}
4242
target="_blank"
4343
rel="noreferrer"
@@ -50,7 +50,7 @@ const FormulaLinks = ({ webpage_url, family, name, arch, repo, download_url }: P
5050
/{family}/{name}/raw.dl
5151
</code>
5252
</div>
53-
</a>
53+
</a>}
5454
</div>
5555
</div>
5656
</div>

web/src/metadata_soarpkgs_[category].json

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

web/src/metadata_soarpkgs_linux.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/src/pages/dl/soarpkgs/linux/[family]/[package]/raw.dl.astro

Lines changed: 0 additions & 39 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function getStaticPaths() {
99
params: { family },
1010
props: {
1111
name: family,
12-
apps: apps.map(([name, url]) => ({
12+
apps: apps.map(([, name, url]) => ({
1313
name,
1414
url,
1515
})),

0 commit comments

Comments
 (0)