diff --git a/registry/src/http/api.ts b/registry/src/http/api.ts index bcaa66f..36584c9 100644 --- a/registry/src/http/api.ts +++ b/registry/src/http/api.ts @@ -110,7 +110,7 @@ async function uploadPackage(ctx: ABC.Context) { if (!packageMeta) { packageMeta = { name: packageName, - author: meta.author, + author: ctx.customContext.user, description: meta.description, deprecated: false, versions: [], @@ -157,7 +157,7 @@ async function uploadPackage(ctx: ABC.Context) { { $set: { versions: [...packageMeta.versions, packageVersion], - author: meta.author || packageMeta.author, + author: ctx.customContext.user, description: meta.description || packageMeta.description, deprecated: meta.deprecated === true, }, diff --git a/registry/src/http/views.ts b/registry/src/http/views.ts index e0018ce..d7bcc9b 100644 --- a/registry/src/http/views.ts +++ b/registry/src/http/views.ts @@ -57,7 +57,7 @@ export default function views(g: ABC.Application) { .update(`${packageName}:${packageVersion}`) .toString("base64"); - await ctx.render("package", { pkg }); + await ctx.render("package", { pkg, version: packageVersion }); ctx.response.headers.set("cache-control", CACHE_CONTROL); ctx.response.headers.set("E-Tag", etag); }); diff --git a/registry/src/utils.ts b/registry/src/utils.ts index 648369b..33fa1d5 100644 --- a/registry/src/utils.ts +++ b/registry/src/utils.ts @@ -64,6 +64,7 @@ export const basicauth = (realm: string) => (next: ABC.HandlerFunc) => ( export function extractPackagePath(path: string): [string, string | undefined] { let packageName = ""; path = path.toLowerCase(); + if (path.startsWith("@")) { packageName = "@"; path = path.slice(1); @@ -81,7 +82,6 @@ export function extractPackagePath(path: string): [string, string | undefined] { if (packageVersion !== "") { if (!isValidVersion(packageVersion)) throw new Error("Invalid package version!"); - else packageVersion = undefined; } return [packageName, packageVersion]; diff --git a/registry/src/views/_base.tsx b/registry/src/views/_base.tsx index 9dd798d..878fac3 100644 --- a/registry/src/views/_base.tsx +++ b/registry/src/views/_base.tsx @@ -5,7 +5,8 @@ const styles = new TextDecoder().decode( Deno.readFileSync("src/views/styles.css") ); -export default function Base(d: any, children: any[]) { +export default function Base(p: any, children: any[]) { + const title = p.title || "DenReg"; return ( @@ -18,6 +19,12 @@ export default function Base(d: any, children: any[]) { href="https://unpkg.com/papercss@1.6.1/dist/paper.min.css" /> + {title} + + {children} diff --git a/registry/src/views/_default.tsx b/registry/src/views/_default.tsx index fa886c7..e07099f 100644 --- a/registry/src/views/_default.tsx +++ b/registry/src/views/_default.tsx @@ -13,10 +13,10 @@ export function Menu({}: any, children: any) { return (
-
+ {/*
-
+
*/}