mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add new settings hostname
This commit is contained in:
@@ -14,6 +14,7 @@ export type ConfigType = {
|
||||
download_original_img: boolean;
|
||||
port: number;
|
||||
export_zip_jpn_title: boolean;
|
||||
hostname: string;
|
||||
};
|
||||
|
||||
export class Config {
|
||||
@@ -93,6 +94,9 @@ export class Config {
|
||||
get export_zip_jpn_title() {
|
||||
return this._return_bool("export_zip_jpn_title") || false;
|
||||
}
|
||||
get hostname() {
|
||||
return this._return_string("hostname") || "localhost";
|
||||
}
|
||||
to_json(): ConfigType {
|
||||
return {
|
||||
cookies: typeof this.cookies === "string",
|
||||
@@ -107,6 +111,7 @@ export class Config {
|
||||
download_original_img: this.download_original_img,
|
||||
port: this.port,
|
||||
export_zip_jpn_title: this.export_zip_jpn_title,
|
||||
hostname: this.hostname,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,6 +191,12 @@ export default class Settings extends Component<SettingsProps> {
|
||||
min={0}
|
||||
max={65535}
|
||||
/>
|
||||
<SettingsText
|
||||
name="hostname"
|
||||
value={settings.hostname}
|
||||
description={t("settings.hostname")}
|
||||
type="text"
|
||||
/>
|
||||
</SettingsContext>
|
||||
<Button onClick={loadData}>{t("common.reload")}</Button>
|
||||
<Button onClick={showDlg} disabled={disabled}>
|
||||
|
||||
@@ -2,7 +2,12 @@ import { Handlers } from "$fresh/server.ts";
|
||||
import { ConfigType, load_settings, save_settings } from "../../config.ts";
|
||||
import { get_cfg_path, get_task_manager } from "../../server.ts";
|
||||
|
||||
const UNSAFE_TYPE: (keyof ConfigType)[] = ["base", "db_path", "port"];
|
||||
const UNSAFE_TYPE: (keyof ConfigType)[] = [
|
||||
"base",
|
||||
"db_path",
|
||||
"port",
|
||||
"hostname",
|
||||
];
|
||||
const UNSAFE_TYPE2 = UNSAFE_TYPE as string[];
|
||||
|
||||
export const handler: Handlers = {
|
||||
|
||||
@@ -39,5 +39,6 @@ export async function startServer(path: string) {
|
||||
plugins: [twindPlugin(twindConfig)],
|
||||
render: renderFn,
|
||||
port: cfg.port,
|
||||
hostname: cfg.hostname,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
"db_path": "The folder where the database is stored: ",
|
||||
"db_path_help": "If not set, the download location is used.",
|
||||
"port": "Listening port: ",
|
||||
"export_zip_jpn_title": "Use japanese title first when exporting zip."
|
||||
"export_zip_jpn_title": "Use japanese title first when exporting zip.",
|
||||
"hostname": "Listening host: "
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
"db_path": "存放数据库的文件夹位置:",
|
||||
"db_path_help": "如果未设置,将使用下载位置。",
|
||||
"port": "监听端口:",
|
||||
"export_zip_jpn_title": "导出Zip时优先使用日语标题。"
|
||||
"export_zip_jpn_title": "导出Zip时优先使用日语标题。",
|
||||
"hostname": "监听主机:"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user