This commit is contained in:
2023-07-14 14:46:10 +00:00
parent fef1e4f3c6
commit 0c6c49a041
32 changed files with 66 additions and 63 deletions

View File

@@ -12,7 +12,10 @@ const STATIC_FILES = ["/common.css", "/scrollBar.css", "/sw.js", "/sw.js.map"];
export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
const url = new URL(req.url);
if (url.pathname == "/sw.js") {
const base = import.meta.resolve("../static").slice(8);
let base = import.meta.resolve("../static").slice(7);
if (Deno.build.os === "windows") {
base = base.slice(1);
}
const map_file = join(base, "sw.meta.json");
if (!(await checkMapFile(map_file))) {
const data = await build({
@@ -57,7 +60,10 @@ export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
}
}
if (STATIC_FILES.includes(url.pathname)) {
const base = import.meta.resolve("../static").slice(8);
let base = import.meta.resolve("../static").slice(7);
if (Deno.build.os === "windows") {
base = base.slice(1);
}
const file = join(base, url.pathname.slice(1));
const opts: GetFileResponseOptions = {};
opts.range = req.headers.get("Range");

View File

@@ -2,7 +2,7 @@ import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../../../../server.ts";
import { get_export_zip_response } from "../../../../../server/export_zip.ts";
import { parse_bool, parse_int } from "../../../../../server/parse_form.ts";
import { ExportZipConfig } from "../../../../../tasks/export_zip.ts";
import type { ExportZipConfig } from "../../../../../tasks/export_zip.ts";
export const handler: Handlers = {
async GET(req, ctx) {

View File

@@ -1,5 +1,5 @@
import { Handlers } from "$fresh/server.ts";
import { EhFileMeta } from "../../db.ts";
import type { EhFileMeta } from "../../db.ts";
import { get_task_manager } from "../../server.ts";
import { get_string, parse_bool, parse_int } from "../../server/parse_form.ts";
import { return_data, return_error } from "../../server/utils.ts";

View File

@@ -1,6 +1,6 @@
import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../../server.ts";
import { EhFiles } from "../../../server/files.ts";
import type { EhFiles } from "../../../server/files.ts";
import { return_data } from "../../../server/utils.ts";
export const handler: Handlers = {

View File

@@ -1,6 +1,6 @@
import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../../server.ts";
import { GalleryData } from "../../../server/gallery.ts";
import type { GalleryData } from "../../../server/gallery.ts";
import { return_data, return_error } from "../../../server/utils.ts";
export const handler: Handlers = {

View File

@@ -1,6 +1,6 @@
import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../server.ts";
import { StatusData } from "../../server/status.ts";
import type { StatusData } from "../../server/status.ts";
import { return_data } from "../../server/utils.ts";
import { check_ffmpeg_binary } from "../../thumbnail/ffmpeg_binary.ts";

View File

@@ -1,7 +1,7 @@
import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../server.ts";
import { Task, TaskProgress } from "../../task.ts";
import {
import type { Task, TaskProgress } from "../../task.ts";
import type {
TaskClientSocketData,
TaskServerSocketData,
} from "../../server/task.ts";