mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-26 22:16:48 +08:00
Fix depreacted api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { join } from "std/path/mod.ts";
|
||||
import {
|
||||
get_file_response,
|
||||
@@ -10,7 +10,7 @@ import { build_sw } from "../server/build_sw.ts";
|
||||
|
||||
const STATIC_FILES = ["/common.css", "/scrollBar.css", "/sw.js", "/sw.js.map"];
|
||||
|
||||
export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
|
||||
export async function handler(req: Request, ctx: FreshContext) {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname == "/sw.js") {
|
||||
build_sw();
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
import { get_task_manager } from "../../server.ts";
|
||||
|
||||
export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
|
||||
export async function handler(req: Request, ctx: FreshContext) {
|
||||
const res = await ctx.next();
|
||||
const m = get_task_manager();
|
||||
if (req.method === "OPTIONS" && res.status === 405) {
|
||||
|
||||
Reference in New Issue
Block a user