Enable E-Tags for GUI and RAW

This commit is contained in:
Fabian Stamm
2020-08-02 16:33:41 +02:00
parent 5337b44b11
commit cece103504
7 changed files with 86 additions and 52 deletions

View File

@ -33,16 +33,13 @@ function Package({ pkg }: { pkg: IPackage }) {
import { Main, Menu } from "./_default.tsx";
export default async function index({ search }: any) {
let packages: IPackage[] = [];
if (search && search !== "") {
packages = await DB.package.find({
name: RegExp(`${search}`),
});
} else {
packages = await DB.package.find({});
}
export default async function index({
packages,
search,
}: {
packages: IPackage[];
search: string;
}) {
return (
<Base>
<Main>

View File

@ -30,9 +30,7 @@ import { sortVersions, getFile } from "../utils.ts";
import { Main, Menu } from "./_default.tsx";
export default async function index({ packageName }: any) {
const pkg = await DB.package.findOne({ name: packageName });
export default async function index({ pkg }: { pkg: IPackage }) {
if (!pkg)
return (
<Base>
@ -40,15 +38,14 @@ export default async function index({ packageName }: any) {
</Base>
);
const readmeContent = await getFile(
packageName,
undefined,
"README.md"
).then((res) => {
if (res)
return Marked.parse(new TextDecoder().decode(res)).content as string;
else return undefined;
});
const readmeContent = await getFile(pkg.name, undefined, "README.md").then(
(res) => {
if (res)
return Marked.parse(new TextDecoder().decode(res.data))
.content as string;
else return undefined;
}
);
return (
<Base>