Update default host and token length in config

Changed the default host to '0.0.0.0' and increased the default token length from 8 to 12 characters in WebUiConfigSchema. Also removed unused getDefaultHost import and made minor formatting adjustments.
This commit is contained in:
手瓜一十雪 2025-09-13 13:49:18 +08:00
parent 0e9aa43476
commit aae676fdc7

View File

@ -7,14 +7,14 @@ import { resolve } from 'node:path';
import { deepMerge } from '../utils/object'; import { deepMerge } from '../utils/object';
import { themeType } from '../types/theme'; import { themeType } from '../types/theme';
import { getRandomToken, getDefaultHost } from '../utils/url' import { getRandomToken } from '../utils/url'
// 限制尝试端口的次数,避免死循环 // 限制尝试端口的次数,避免死循环
// 定义配置的类型 // 定义配置的类型
const WebUiConfigSchema = Type.Object({ const WebUiConfigSchema = Type.Object({
host: Type.String({ default: getDefaultHost() }), host: Type.String({ default: '0.0.0.0' }),
port: Type.Number({ default: 6099 }), port: Type.Number({ default: 6099 }),
token: Type.String({ default: getRandomToken(8) }), token: Type.String({ default: getRandomToken(12) }),
loginRate: Type.Number({ default: 10 }), loginRate: Type.Number({ default: 10 }),
autoLoginAccount: Type.String({ default: '' }), autoLoginAccount: Type.String({ default: '' }),
theme: themeType, theme: themeType,
@ -64,7 +64,7 @@ export class WebUiConfigWrapper {
async GetWebUIConfig(): Promise<WebUiConfigType> { async GetWebUIConfig(): Promise<WebUiConfigType> {
if (this.WebUiConfigData) { if (this.WebUiConfigData) {
return this.WebUiConfigData return this.WebUiConfigData
} }
try { try {