feat: add new auth_request flow for logging in with comfy deploy

This commit is contained in:
BennyKok
2024-01-22 14:11:14 +08:00
parent 3043093d22
commit 47168930dc
25 changed files with 2424 additions and 272 deletions
+3 -16
View File
@@ -3,20 +3,7 @@ import { authError } from "@/routes/authError";
import { getFileDownloadUrl } from "@/server/getFileDownloadUrl";
import { handleResourceUpload } from "@/server/resource";
import { z, createRoute } from "@hono/zod-openapi";
import { customAlphabet } from "nanoid";
export const nanoid = customAlphabet(
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
);
const prefixes = {
img: "img",
vid: "vid",
} as const;
export function newId(prefix: keyof typeof prefixes): string {
return [prefixes[prefix], nanoid(16)].join("_");
}
import { newId } from "./newId";
const uploadUrlRoute = createRoute({
method: "get",
@@ -96,7 +83,7 @@ export const registerUploadRoute = (app: App) => {
file_id: id,
download_url: await getFileDownloadUrl(filePath),
},
200
200,
);
} catch (error: unknown) {
const errorMessage =
@@ -107,7 +94,7 @@ export const registerUploadRoute = (app: App) => {
},
{
status: 500,
}
},
);
}
});