diff --git a/web/api.ts b/web/api.ts index 6388925..10d0e7b 100644 --- a/web/api.ts +++ b/web/api.ts @@ -89,6 +89,20 @@ export function latestDelay(info: ProxyInfo | undefined): number | null { return last === undefined || last === 0 ? null : last } +export interface FieldSpec { + key: string + type: 'string' | 'number' | 'boolean' | 'string[]' | 'number[]' | 'object' | 'object[]' + required: boolean + default: unknown + enum: (string | number)[] | null + note: string +} + +export interface ListenerFields { + common: FieldSpec[] + types: Record +} + export const api = { readConfig: () => request('GET', '/api/config'), @@ -102,6 +116,9 @@ export const api = { kernel: () => request<{ online: boolean; version?: string }>('GET', '/api/kernel'), + /** 入站类型的字段表,从内核源码提取,用来驱动表单。 */ + listenerFields: () => request('GET', '/api/meta/listener-fields'), + /** * 所有出站的运行时状态:协议类型、策略组当前选中了谁、最近一次延迟。 * 这些配置文件里都没有,只能问运行中的内核。 diff --git a/web/nav.ts b/web/nav.ts index 4fcee59..28631b3 100644 --- a/web/nav.ts +++ b/web/nav.ts @@ -1,8 +1,7 @@ /** * 左侧导航。 * - * 顺序按使用频率排:路由是这个工具存在的理由,放在最上面;仪表盘和连接是「看一眼」 - * 类的,中间;设置很少动,垫底。 + * 仪表盘打头(打开先看一眼状态),路由紧随其后(这个工具存在的理由),设置垫底。 */ import IconRoute from '~icons/ri/route-line' import IconDashboard from '~icons/ri/dashboard-line' @@ -21,8 +20,8 @@ export interface NavItem { } export const NAV: NavItem[] = [ - { key: 'router', label: '路由', icon: IconRoute }, { key: 'dashboard', label: '仪表盘', icon: IconDashboard, pending: true }, + { key: 'router', label: '路由', icon: IconRoute }, { key: 'config', label: '配置', icon: IconConfig, pending: true }, { key: 'requests', label: '请求', icon: IconRequests, pending: true }, { key: 'connections', label: '连接', icon: IconConnections, pending: true }, diff --git a/web/views/InboundDetail.vue b/web/views/InboundDetail.vue index 813d83f..a7044e5 100644 --- a/web/views/InboundDetail.vue +++ b/web/views/InboundDetail.vue @@ -3,8 +3,9 @@ import { computed } from 'vue' import type { Inbound, OutboundMode } from '@shared/inbounds.ts' import { latestDelay } from '../api' import type { ProxyInfo } from '../api' -import IconLock from '~icons/ri/lock-line' import IconOffline from '~icons/ri/cloud-off-line' +import IconEdit from '~icons/ri/edit-line' +import IconDelete from '~icons/ri/delete-bin-line' const props = defineProps<{ inbound: Inbound @@ -17,7 +18,7 @@ const props = defineProps<{ saving: boolean }>() -const emit = defineEmits<{ pick: [mode: OutboundMode] }>() +const emit = defineEmits<{ pick: [mode: OutboundMode]; edit: []; remove: [] }>() interface Option { key: string @@ -111,6 +112,13 @@ function delayClass(ms: number | null): string { {{ inbound.port }} {{ inbound.name }} +
+ + +
+
类型
{{ inbound.type }}
@@ -121,13 +129,12 @@ function delayClass(ms: number | null): string {
-
-

出站

+

+ 由 {{ inbound.legacyKey }} 声明,这种写法没有 proxy 字段,出站固定是 RULE +

-

- - 由 {{ inbound.legacyKey }} 声明,没有 proxy 字段,只能走 RULE -

+
+

出站