出站选项改成卡片,带协议和延迟
参照 fl-clash:一张卡三行——名字、协议(策略组显示「类型(当前选中)」)、最近一次延迟。 延迟按 200/500 毫秒分三档着色,没测过就留空而不是显示 0。 这些数据配置文件里都没有,全部来自内核的 /proxies。 另外主区最大宽度从 960 提到 1600,去掉选中行的左侧高亮条。
This commit is contained in:
+14
-2
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { ApiError, api, getToken, setToken } from './api'
|
||||
import type { ConfigSnapshot } from './api'
|
||||
import type { ConfigSnapshot, ProxyInfo } from './api'
|
||||
import { NAV } from './nav'
|
||||
import { density, toggleDensity } from './prefs'
|
||||
import RouterPage from './views/RouterPage.vue'
|
||||
@@ -12,6 +12,7 @@ import IconUnfold from '~icons/ri/sidebar-unfold-line'
|
||||
const snapshot = ref<ConfigSnapshot | null>(null)
|
||||
const kernel = ref<{ online: boolean; version?: string }>({ online: false })
|
||||
const providerLines = ref<string[]>([])
|
||||
const runtime = ref<Record<string, ProxyInfo>>({})
|
||||
const needsToken = ref(!getToken())
|
||||
const loadError = ref('')
|
||||
const loading = ref(false)
|
||||
@@ -28,6 +29,7 @@ async function load() {
|
||||
// 订阅里有哪些线路只有运行中的内核知道,配置文件里只有一个订阅地址。
|
||||
// 拿不到不算错误——界面照常能编辑,只是订阅线路那一档不可选。
|
||||
providerLines.value = status.online ? await readProviderLines() : []
|
||||
runtime.value = status.online ? await readRuntime() : {}
|
||||
} catch (error) {
|
||||
if (error instanceof ApiError && error.unauthorized) {
|
||||
needsToken.value = true
|
||||
@@ -51,6 +53,15 @@ async function readProviderLines(): Promise<string[]> {
|
||||
}
|
||||
}
|
||||
|
||||
/** 出站的运行时状态:协议类型、策略组当前选中了谁、最近一次延迟。 */
|
||||
async function readRuntime(): Promise<Record<string, ProxyInfo>> {
|
||||
try {
|
||||
return (await api.proxies()).proxies
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function submitToken(value: string) {
|
||||
setToken(value)
|
||||
void load()
|
||||
@@ -131,6 +142,7 @@ const current = computed(() => NAV.find((n) => n.key === active.value))
|
||||
:revision="snapshot.revision"
|
||||
:kernel-online="kernel.online"
|
||||
:provider-lines="providerLines"
|
||||
:runtime="runtime"
|
||||
@changed="load"
|
||||
/>
|
||||
|
||||
@@ -316,7 +328,7 @@ const current = computed(() => NAV.find((n) => n.key === active.value))
|
||||
/* ── 主区 ───────────────────────────────────── */
|
||||
.main {
|
||||
padding: var(--s-6) var(--s-6) var(--s-7);
|
||||
max-width: 960px;
|
||||
max-width: 1600px;
|
||||
}
|
||||
|
||||
.note {
|
||||
|
||||
Reference in New Issue
Block a user