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

@@ -1,12 +1,12 @@
import { signal } from "@preact/signals";
import { ConfigType } from "../config.ts";
import { get_ws_host } from "./utils.ts";
import { ConfigClientSocketData, ConfigSeverSocketData } from "./config.ts";
import { DEFAULT_DOWNLOAD_CONFIG, DownloadConfig } from "../tasks/download.ts";
import {
DEFAULT_EXPORT_ZIP_CONFIG,
ExportZipConfig,
} from "../tasks/export_zip.ts";
import type {
ConfigClientSocketData,
ConfigSeverSocketData,
} from "./config.ts";
import type { DownloadConfig } from "../tasks/download.ts";
import type { ExportZipConfig } from "../tasks/export_zip.ts";
export const cfg = signal<ConfigType | undefined>(undefined);
@@ -30,7 +30,7 @@ export function initCfg() {
}
export function generate_download_cfg(): DownloadConfig {
if (!cfg.value) return DEFAULT_DOWNLOAD_CONFIG;
if (!cfg.value) return {};
const c = cfg.value;
return {
download_original_img: c.download_original_img,
@@ -42,7 +42,7 @@ export function generate_download_cfg(): DownloadConfig {
}
export function generate_export_zip_cfg(): ExportZipConfig {
if (!cfg.value) return DEFAULT_EXPORT_ZIP_CONFIG;
if (!cfg.value) return {};
const c = cfg.value;
return {
jpn_title: c.export_zip_jpn_title,

View File

@@ -1,4 +1,4 @@
import { ConfigType } from "../config.ts";
import type { ConfigType } from "../config.ts";
export type ConfigClientSocketData = { type: "close" };
export type ConfigSeverSocketData = { type: "close" } | {

View File

@@ -1,6 +1,6 @@
import { Uint8ArrayReader, ZipWriter } from "zipjs/index.js";
import { EhDb, PMeta } from "../db.ts";
import { ExportZipConfig } from "../tasks/export_zip.ts";
import type { EhDb, PMeta } from "../db.ts";
import type { ExportZipConfig } from "../tasks/export_zip.ts";
import { addZero, configureZipJs, limitFilename } from "../utils.ts";
export function get_export_zip_response(

View File

@@ -1,4 +1,4 @@
import { ExtendedPMeta, GMeta, Tag } from "../db.ts";
import type { ExtendedPMeta, GMeta, Tag } from "../db.ts";
import { JSONResult } from "./utils.ts";
export type GalleryData = {

View File

@@ -1,7 +1,7 @@
import { exists } from "std/fs/exists.ts";
import { parse } from "std/jsonc/mod.ts";
import { join } from "std/path/mod.ts";
import { I18NMap } from "./i18n.ts";
import type { I18NMap } from "./i18n.ts";
import { pick } from "accept-language-parser/";
import { get_host } from "./utils.ts";
@@ -11,7 +11,10 @@ type MODULE = "common" | "settings" | "task" | "user";
const MODULES: MODULE[] = ["common", "settings", "task", "user"];
export async function load_translation(signal?: AbortSignal) {
const base = import.meta.resolve("../translation").slice(8);
let base = import.meta.resolve("../translation").slice(7);
if (Deno.build.os === "windows") {
base = base.slice(1);
}
const enmap: I18NMap = {};
for (const m of MODULES) {
const t = await Deno.readTextFile(join(base, "en", m + ".jsonc"), {

View File

@@ -1,8 +1,8 @@
import { Task } from "../task.ts";
import { TaskEventData } from "../task_manager.ts";
import { DownloadConfig } from "../tasks/download.ts";
import { ExportZipConfig } from "../tasks/export_zip.ts";
import { DiscriminatedUnion } from "../utils.ts";
import type { Task } from "../task.ts";
import type { TaskEventData } from "../task_manager.ts";
import type { DownloadConfig } from "../tasks/download.ts";
import type { ExportZipConfig } from "../tasks/export_zip.ts";
import type { DiscriminatedUnion } from "../utils.ts";
export type TaskServerSocketData = TaskEventData | { type: "close" } | {
type: "tasks";