补上真正日常要点的那个动作:切换策略组当前选中谁
之前的面板只做了「这个入站指向哪个出站」,那是改配置文件。但 metacubexd 里点一条线路
改的根本不是入站,是策略组的当前选中——调 PUT /proxies/{组},不写文件、立刻生效。
mixed-port 走规则表,末尾 MATCH,PROXY 把流量交给 PROXY 组,所以换那个组的选中就等于
换了这个端口的出口。这是每天都要点的动作,之前整个漏了。
面板顶部现在显示完整链条(PROXY → AUTO → 某条线路),并让人在最后一个策略组上换选中。
只显示第一层等于没回答「这个端口现在走哪条线」。
透传的白名单里为此开了唯一一个写操作,单独一条路由而不是放开整个转发。
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { collectInbounds, collectOutboundNames, outboundToProxyField } from '@shared/inbounds.ts'
|
||||
import {
|
||||
collectInbounds,
|
||||
collectOutboundNames,
|
||||
outboundToProxyField,
|
||||
resolveDestination,
|
||||
} from '@shared/inbounds.ts'
|
||||
import type { Inbound, OutboundMode } from '@shared/inbounds.ts'
|
||||
import type { ConfigObject } from '../../vendor/config-editor/index.ts'
|
||||
import { ApiError, api } from '../api'
|
||||
@@ -162,6 +167,24 @@ async function submitForm(entry: ConfigObject) {
|
||||
if (editingIndex === null) selectedId.value = `listener:${String(listeners.length - 1)}`
|
||||
}
|
||||
|
||||
/** 切换策略组当前选中谁。运行时动作,不写配置文件,所以不走那条落盘链路。 */
|
||||
async function selectMember(group: string, member: string) {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
failure.value = null
|
||||
done.value = ''
|
||||
try {
|
||||
await api.selectProxy(group, member)
|
||||
done.value = `${group} 切到了 ${member}`
|
||||
emit('changed')
|
||||
} catch (error) {
|
||||
const message = error instanceof ApiError ? String(error.payload.error ?? error.message) : String(error)
|
||||
failure.value = { message, hint: '这一步只改内核的运行状态,配置文件没有被动过。' }
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function removeSelected() {
|
||||
const target = selected.value
|
||||
if (!target || target.listenerIndex === null || saving.value) return
|
||||
@@ -235,6 +258,7 @@ async function removeSelected() {
|
||||
:groups="outbounds.groups"
|
||||
:own-proxies="outbounds.ownProxies"
|
||||
:provider-lines="providerLines"
|
||||
:destination="resolveDestination(data, selected)"
|
||||
:runtime="runtime"
|
||||
:kernel-online="kernelOnline"
|
||||
:saving="saving"
|
||||
@@ -242,6 +266,7 @@ async function removeSelected() {
|
||||
@edit="openEdit"
|
||||
@remove="removeSelected"
|
||||
@convert="openConvert"
|
||||
@select="selectMember"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user