Fix depreacted api

This commit is contained in:
2024-03-26 17:52:58 +08:00
parent 9aa1bba248
commit 867756a70e
3 changed files with 7 additions and 7 deletions

View File

@@ -1,10 +1,10 @@
import { MiddlewareHandlerContext } from "$fresh/server.ts";
import { FreshContext } from "$fresh/server.ts";
import { get_task_manager } from "../../server.ts";
import { parse_cookies } from "../../server/cookies.ts";
import { return_error } from "../../server/utils.ts";
import type { Token } from "../../db.ts";
function handle_auth(req: Request, ctx: MiddlewareHandlerContext) {
function handle_auth(req: Request, ctx: FreshContext) {
if (req.method === "OPTIONS") return true;
const m = get_task_manager();
if (m.db.get_user_count() === 0) return true;
@@ -40,7 +40,7 @@ function handle_auth(req: Request, ctx: MiddlewareHandlerContext) {
return true;
}
export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
export async function handler(req: Request, ctx: FreshContext) {
const m = get_task_manager();
if (!(handle_auth(req, ctx))) {
const headers: HeadersInit = {};