mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor: ♻️ Don't use Bun global
This commit is contained in:
parent
d55668d529
commit
25ea870f71
15 changed files with 32 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { apiRoute, handleZodError } from "@/api";
|
||||
import { Application, User } from "@versia/kit/db";
|
||||
import { Users } from "@versia/kit/tables";
|
||||
import { password as bunPassword } from "bun";
|
||||
import { eq, or } from "drizzle-orm";
|
||||
import type { Context } from "hono";
|
||||
import { describeRoute } from "hono-openapi";
|
||||
|
|
@ -143,7 +144,7 @@ export default apiRoute((app) =>
|
|||
if (
|
||||
!(
|
||||
user &&
|
||||
(await Bun.password.verify(
|
||||
(await bunPassword.verify(
|
||||
password,
|
||||
user.data.password || "",
|
||||
))
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { apiRoute, handleZodError } from "@/api";
|
||||
import { User } from "@versia/kit/db";
|
||||
import { Users } from "@versia/kit/tables";
|
||||
import { password as bunPassword } from "bun";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { Context } from "hono";
|
||||
import { describeRoute } from "hono-openapi";
|
||||
import { validator } from "hono-openapi/zod";
|
||||
import { z } from "zod";
|
||||
import { config } from "~/config.ts";
|
||||
|
||||
const returnError = (
|
||||
context: Context,
|
||||
token: string,
|
||||
|
|
@ -68,7 +68,7 @@ export default apiRoute((app) =>
|
|||
}
|
||||
|
||||
await user.update({
|
||||
password: await Bun.password.hash(password),
|
||||
password: await bunPassword.hash(password),
|
||||
passwordResetToken: null,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { apiRoute, handleZodError } from "@/api";
|
||||
import { file as bunFile } from "bun";
|
||||
import { describeRoute } from "hono-openapi";
|
||||
import { resolver, validator } from "hono-openapi/zod";
|
||||
import { z } from "zod";
|
||||
|
|
@ -57,7 +58,7 @@ export default apiRoute((app) =>
|
|||
.map(Number); // [0, 100]
|
||||
|
||||
// Serve file from filesystem
|
||||
const file = Bun.file(`./uploads/${hash}/${name}`);
|
||||
const file = bunFile(`./uploads/${hash}/${name}`);
|
||||
|
||||
const buffer = await file.arrayBuffer();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue