Optimize dependency import
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-07-31 20:22:09 +02:00
parent ef4ce98ebb
commit d2e2b49c46
2 changed files with 5 additions and 4 deletions

View File

@ -11,6 +11,8 @@ export * as LoggerMW from "https://deno.land/x/abc@v1/middleware/logger.ts";
export * as Path from "https://deno.land/std@0.62.0/path/mod.ts";
export * as FS from "https://deno.land/std@0.62.0/fs/mod.ts";
export * as Base64 from "https://deno.land/std@0.62.0/encoding/base64.ts";
export * as Compress from "https://git.stamm.me/Deno/DenReg/raw/branch/master/tar/mod.ts";
export { Marked } from "https://deno.land/x/markdown/mod.ts";

View File

@ -1,5 +1,4 @@
import { ABC } from "./deps.ts";
import { decode } from "https://deno.land/std/encoding/base64.ts";
import { ABC, Base64 } from "./deps.ts";
import config from "./config.ts";
const packageNameRegex = /^[@]?[a-zA-Z][\d\w\-\_]*$/g.compile();
@ -42,7 +41,7 @@ export const basicauth = (realm: string) => (next: ABC.HandlerFunc) => (
if (value && value.toLowerCase().startsWith("basic ")) {
const credentials = value.slice(6);
const [username, passwd] = new TextDecoder()
.decode(decode(credentials))
.decode(Base64.decode(credentials))
.split(":", 2);
if (config?.user[username]?.password === passwd) {
@ -97,7 +96,7 @@ export async function getFile(
pkgName: string,
version: string | null | undefined,
file: string
): Promise<Uint8Array | null> {
): Promise<Uint8Array | null | undefined> {
const meta = await db.package.findOne({ name: pkgName });
if (!meta || meta.versions.length < 1) return null;