Bilibili-Evolved/registry/lib/components/utils/dev-client/options.ts
2022-05-21 16:23:44 +08:00

40 lines
1.3 KiB
TypeScript

import type { AutoUpdateOptions } from '@/components/auto-update'
import { defineOptionsMetadata } from '@/components/define'
import { getComponentSettings } from '@/core/settings'
import { getNumberValidator } from '@/core/utils'
import { CoreUpdateMethod, RegistryUpdateMethod, PluginUpdateMethod } from './update-method'
export const { options: autoUpdateOptions } = getComponentSettings<AutoUpdateOptions>('autoUpdate')
export interface DevRecord {
name: string
originalUrl: string
}
export const devClientOptionsMetadata = defineOptionsMetadata({
port: {
defaultValue: 23333,
displayName: '端口',
validator: getNumberValidator(1024, 65535),
},
coreUpdateMethod: {
defaultValue: CoreUpdateMethod.AlwaysReload,
displayName: '本体刷新策略',
dropdownEnum: CoreUpdateMethod,
},
registryUpdateMethod: {
defaultValue: RegistryUpdateMethod.PreferInstantStyles,
displayName: '功能刷新策略',
dropdownEnum: RegistryUpdateMethod,
},
pluginUpdateMethod: {
// 同本体
defaultValue: PluginUpdateMethod.AlwaysReload,
displayName: '插件刷新策略',
dropdownEnum: PluginUpdateMethod,
},
devRecords: {
defaultValue: {} as Record<string, DevRecord>,
displayName: '调试模式临时存储',
hidden: true,
},
})