once改为listen修复日志监听无法触发的bug 增加输入框右键菜单 增加成员列表接收和传输的字符大小 优化成员列表nat_type为中文 修复ipv4无法显示的问题

This commit is contained in:
黑先森
2024-11-30 15:16:40 +08:00
parent 02b53098e8
commit 3aa90dbb67
10 changed files with 70 additions and 59 deletions
+5 -9
View File
@@ -215,7 +215,7 @@
:icon="SetUp"
command="create_server"
>
自建服务({{ listenObj.server_thread_id.value ? "运行中" : "未运行" }})
自建服务<ElTag size="small" class="ml-[5px]" :type="listenObj.server_thread_id.value ? 'success' : 'info'">{{ listenObj.server_thread_id.value ? "运行中" : "未运行" }}</ElTag>
</ElDropdownItem>
<ElDropdownItem
:icon="Tools"
@@ -642,15 +642,11 @@
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
await setTrayRunState(tray, true);
data.isSuccessGetIp = true;
await setTrayTooltip(tray, `IP: ${config.ipv4}`);
await setTrayTooltip(tray, `IP: ${mainStore.config.ipv4}`);
}
if (config.dhcp || mainStore.configStartEnable) {
if (ipv4) {
config.ipv4 = ipv4;
await setTrayRunState(tray, true);
data.isSuccessGetIp = true;
await setTrayTooltip(tray, `IP: ${ipv4}`);
}
if (ipv4) {
mainStore.config.ipv4 = ipv4;
await setTrayTooltip(tray, `IP: ${ipv4}`);
}
if (
devName &&
+22 -5
View File
@@ -13,7 +13,11 @@
width="140"
label="主机名"
prop="hostname"
></ElTableColumn>
>
<template #default="{row}">
{{ (row.hostname || "").toLowerCase().includes('publicserver') ? (row.hostname || "").replace("PublicServer", "服务器") : (row.hostname || "-") }}
</template>
</ElTableColumn>
<ElTableColumn
sortable
width="90"
@@ -54,8 +58,8 @@
<ElTableColumn
sortable
width="120"
label="nat_type"
prop="NAT类型"
label="NAT类型"
prop="nat_type"
>
<template #default="{ row }">
{{ natMaps[row.nat_type.toLowerCase() as natKyes] || row.nat_type || "-" }}
@@ -72,6 +76,16 @@
prop="tunnel_proto"
label="隧道协议"
></ElTableColumn>
<ElTableColumn
sortable
prop="rx_bytes"
label="接收"
></ElTableColumn>
<ElTableColumn
sortable
prop="tx_bytes"
label="传输"
></ElTableColumn>
</ElTable>
</div>
</div>
@@ -109,7 +123,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
};
type natKyes = keyof typeof natMaps;
const data = reactive<{ member: any[] }>({
const data = reactive<{ member: {hostname: string, cost: string, ipv4: string, lat_msg: string, loss_rate: string, nat_type: string}[] }>({
member: []
});
@@ -121,7 +135,9 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
["loss_rate", "丢包率"],
["nat_type", "NAT类型"],
["version", "版本"],
["tunnel_proto", "隧道协议"]
["tunnel_proto", "隧道协议"],
['rx_bytes', '接收'],
['tx_bytes', '传输']
];
let timer: NodeJS.Timeout | null = null;
@@ -157,6 +173,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
value.ipv4 = value.ipv4.split("/")[0];
}
});
// console.log(peerInfo)
data.member = peerInfo;
startTimer();
};