work on db
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
||||
import { FirRouteInput, FirRouteOptions } from "../util/routewrap";
|
||||
import {git} from "../util/git.ts";
|
||||
import { randomUUID } from "crypto";
|
||||
@@ -13,9 +14,26 @@ const url = "/api/release";
|
||||
|
||||
const payloadT = Type.Any();
|
||||
|
||||
const manifestT = Type.Object({
|
||||
picobook_version: Type.Number(),
|
||||
id: Type.String(),
|
||||
version: Type.String(),
|
||||
carts: Type.Array(Type.String()),
|
||||
repo: Type.String(),
|
||||
title: Type.Optional(Type.String()),
|
||||
author: Type.Optional(Type.String()),
|
||||
readme: Type.Optional(Type.String()),
|
||||
});
|
||||
|
||||
const ManifestType = TypeCompiler.Compile(manifestT)
|
||||
|
||||
const handler = async ({payload}: FirRouteInput<typeof payloadT>) => {
|
||||
const {manifest, token} = payload;
|
||||
|
||||
if (!ManifestType.Check(manifest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uuid = randomUUID();
|
||||
const repoPath = path.join(reposPath, uuid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user