合并配置页(task/config-page)
# Conflicts: # web/api.ts
This commit is contained in:
+17
-4
@@ -100,6 +100,13 @@ export function latestDelay(info: ProxyInfo | undefined): number | null {
|
||||
return last === undefined || last === 0 ? null : last
|
||||
}
|
||||
|
||||
/** 一个订阅的运行时状态。updatedAt 是上次拉取成功的时刻,没拉过是 Go 的零值时间。 */
|
||||
export interface ProviderInfo {
|
||||
vehicleType: string
|
||||
updatedAt?: string
|
||||
proxies: ProxyInfo[]
|
||||
}
|
||||
|
||||
export interface FieldSpec {
|
||||
key: string
|
||||
type: 'string' | 'number' | 'boolean' | 'string[]' | 'number[]' | 'object' | 'object[]'
|
||||
@@ -200,6 +207,15 @@ export const api = {
|
||||
/** 断开所有连接。 */
|
||||
closeAllConnections: () => request<{ message?: string }>('DELETE', '/api/kernel/connections'),
|
||||
|
||||
/**
|
||||
* 让内核立刻重新拉取某个订阅。
|
||||
*
|
||||
* 运行时动作,不写配置文件,所以不走 applyConfig 那条校验重载链路。成功时内核回
|
||||
* 204 空响应,拉取失败回 503 带错误消息(内核源码 hub/route/provider.go:52-60)。
|
||||
*/
|
||||
refreshProvider: (name: string) =>
|
||||
request<unknown>('PUT', `/api/kernel/providers/proxies/${encodeURIComponent(name)}`),
|
||||
|
||||
/**
|
||||
* 订阅及其线路。配置文件里只有订阅地址,有哪些线路只有运行中的内核知道。
|
||||
*
|
||||
@@ -207,8 +223,5 @@ export const api = {
|
||||
* 全局名字表里,这是拿到它们类型和延迟的唯一途径。
|
||||
*/
|
||||
providers: () =>
|
||||
request<{ providers: Record<string, { vehicleType: string; proxies: ProxyInfo[] }> }>(
|
||||
'GET',
|
||||
'/api/kernel/providers/proxies',
|
||||
),
|
||||
request<{ providers: Record<string, ProviderInfo> }>('GET', '/api/kernel/providers/proxies'),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user