mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Update
This commit is contained in:
12
server.ts
12
server.ts
@@ -1,18 +1,26 @@
|
||||
import { start } from "$fresh/server.ts";
|
||||
import { Config } from "./config.ts";
|
||||
import { load_settings } from "./config.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import { TaskManager } from "./task_manager.ts";
|
||||
import twindPlugin from "$fresh/plugins/twind.ts";
|
||||
import twindConfig from "./twind.config.ts";
|
||||
|
||||
let task_manager: TaskManager | undefined = undefined;
|
||||
let cfg_path: string | undefined = undefined;
|
||||
|
||||
export function get_task_manager() {
|
||||
if (!task_manager) throw Error("task manager undefined.");
|
||||
return task_manager;
|
||||
}
|
||||
|
||||
export function startServer(cfg: Config) {
|
||||
export function get_cfg_path() {
|
||||
if (!cfg_path) throw Error("cfg_path undefined.");
|
||||
return cfg_path;
|
||||
}
|
||||
|
||||
export async function startServer(path: string) {
|
||||
cfg_path = path;
|
||||
const cfg = await load_settings(path);
|
||||
task_manager = new TaskManager(cfg);
|
||||
return start(manifest, {
|
||||
signal: task_manager.aborts,
|
||||
|
||||
Reference in New Issue
Block a user