mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-28 07:25:53 +00:00
feat: 保存api服务的配置,实现随weflow静默启动
This commit is contained in:
@@ -65,6 +65,8 @@ export const CONFIG_KEYS = {
|
||||
NOTIFICATION_FILTER_MODE: 'notificationFilterMode',
|
||||
NOTIFICATION_FILTER_LIST: 'notificationFilterList',
|
||||
HTTP_API_TOKEN: 'httpApiToken',
|
||||
HTTP_API_ENABLED: 'httpApiEnabled',
|
||||
HTTP_API_PORT: 'httpApiPort',
|
||||
MESSAGE_PUSH_ENABLED: 'messagePushEnabled',
|
||||
WINDOW_CLOSE_BEHAVIOR: 'windowCloseBehavior',
|
||||
QUOTE_LAYOUT: 'quoteLayout',
|
||||
@@ -1484,3 +1486,26 @@ export async function getAnalyticsDenyCount(): Promise<number> {
|
||||
export async function setAnalyticsDenyCount(count: number): Promise<void> {
|
||||
await config.set(CONFIG_KEYS.ANALYTICS_DENY_COUNT, count)
|
||||
}
|
||||
|
||||
|
||||
// 获取 HTTP API 自动启动状态
|
||||
export async function getHttpApiEnabled(): Promise<boolean> {
|
||||
const value = await config.get(CONFIG_KEYS.HTTP_API_ENABLED)
|
||||
return value === true
|
||||
}
|
||||
|
||||
// 设置 HTTP API 自动启动状态
|
||||
export async function setHttpApiEnabled(enabled: boolean): Promise<void> {
|
||||
await config.set(CONFIG_KEYS.HTTP_API_ENABLED, enabled)
|
||||
}
|
||||
|
||||
// 获取 HTTP API 端口
|
||||
export async function getHttpApiPort(): Promise<number> {
|
||||
const value = await config.get(CONFIG_KEYS.HTTP_API_PORT)
|
||||
return typeof value === 'number' ? value : 5031
|
||||
}
|
||||
|
||||
// 设置 HTTP API 端口
|
||||
export async function setHttpApiPort(port: number): Promise<void> {
|
||||
await config.set(CONFIG_KEYS.HTTP_API_PORT, port)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user