设置页第二轮:行内编辑、GEO 资源展开、恢复与导入分家
单值设置从常驻输入框改成 InlineEdit(纯文本加铅笔,Enter 或失焦提交, 失焦无效直接放弃——失焦是「我走了」,不该把人拽回来)。测速地址加恢复 默认按钮;内核参数逐项提交,不再攒一个保存按钮。 资源一节按文件展开:四类 GEO 文件的大小和更新时间由服务端 stat 内核 工作目录得来(GET /api/geo;文件名和大小写不敏感匹配照 constant/ path.go:18-20,193-224),下载地址可改(geox-url,config.go:363-368, 默认值 578-583)。行内的更新按钮仍是全量更新——内核只有这一个口子, 没变化的文件靠内容哈希跳过。 上传拆成两个入口:恢复只认带 Patchbay 标记的文件,导入收任意配置; 新增恢复策略(兼容只搬接管段落 listeners/proxy-groups/rules/ proxy-providers/rule-providers,覆盖整份替换)。平时是按钮,拖着文件 进窗口时整行变成投放区。
This commit is contained in:
+10
-6
@@ -7,6 +7,7 @@
|
||||
import type { ConfigDiagnostic, ConfigObject } from '../vendor/config-editor/index.ts'
|
||||
import type { ConnectionSnapshot } from '@shared/connections.ts'
|
||||
import type { ExitProbe, HostInfo } from '@shared/host-info.ts'
|
||||
import type { GeoFileStatus } from '@shared/geo.ts'
|
||||
import { DEFAULT_TEST_URL, testUrl } from './prefs'
|
||||
|
||||
const TOKEN_KEY = 'patchbay.token'
|
||||
@@ -156,11 +157,11 @@ export const api = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 用上传的 YAML 原文整份替换当前配置。走服务端完整的保护链路
|
||||
* (校验、备份、重载、失败回退),没有 baseRevision——整份替换本来就是覆盖语义。
|
||||
* 用上传的 YAML 替换当前配置:override 整份替换,compatible 只搬
|
||||
* Patchbay 接管的段落。走服务端完整的保护链路(校验、备份、重载、失败回退)。
|
||||
*/
|
||||
importConfig: (content: string) =>
|
||||
request<ApplySuccess>('POST', '/api/config/import', { content }),
|
||||
importConfig: (content: string, mode: 'override' | 'compatible') =>
|
||||
request<ApplySuccess>('POST', '/api/config/import', { content, mode }),
|
||||
|
||||
restoreBackup: (name: string) =>
|
||||
request<ApplySuccess>('POST', `/api/config/backups/${encodeURIComponent(name)}/restore`),
|
||||
@@ -189,11 +190,14 @@ export const api = {
|
||||
restartKernel: () => request<{ ok: true }>('POST', '/api/kernel/restart'),
|
||||
|
||||
/**
|
||||
* 让内核更新 GEO 数据库(GEOIP、GEOSITE、MMDB、ASN)。
|
||||
* 同步接口,下载完才回话,可能要等上几十秒。
|
||||
* 让内核更新 GEO 数据库。同步接口,下载完才回话,可能要等上几十秒。
|
||||
* 内核只有全量更新这一个口子,没变化的文件靠内容哈希跳过重写。
|
||||
*/
|
||||
updateGeo: () => request<{ ok: true }>('POST', '/api/kernel/geo'),
|
||||
|
||||
/** 四类 GEO 文件的本地状态:大小、更新时间、生效中的下载地址。 */
|
||||
geoStatus: () => request<{ files: GeoFileStatus[] }>('GET', '/api/geo'),
|
||||
|
||||
/**
|
||||
* 打开一个持续吐数据的流式接口(/traffic、/memory),每秒一行 JSON。
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user