mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
#Fix 内置WinIPBroadcast默认开启,成员列表显示优化 1.0.5发布
This commit is contained in:
+59
-6
@@ -232,15 +232,27 @@
|
||||
>
|
||||
easytier发布页
|
||||
</ElLink>
|
||||
<div>
|
||||
<div class="flex items-center gap-[0_5px]">
|
||||
<ElLink
|
||||
class="!text-[11px]"
|
||||
type="danger"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
|
||||
>
|
||||
找不到房间?安装WinIPBroadcast
|
||||
WinIPBroadcast
|
||||
<ElTooltip content="找不到游戏房间时,就开启它后再刷新尝试(默认开启)">
|
||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</ElLink>
|
||||
<ElSwitch
|
||||
inline-prompt
|
||||
:model-value="data.winipBcStart"
|
||||
@change="handleWinipBcStart"
|
||||
size="small"
|
||||
label="WinIPBroadcast"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
></ElSwitch>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -249,7 +261,7 @@
|
||||
<script setup lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { open } from "@tauri-apps/plugin-shell";
|
||||
import { open, Command } from "@tauri-apps/plugin-shell";
|
||||
import { QuestionFilled, Delete, List, UserFilled } from "@element-plus/icons-vue";
|
||||
import { reactive, onBeforeUnmount, onMounted } from "vue";
|
||||
import { useTray } from "~/composables/tray";
|
||||
@@ -263,6 +275,7 @@
|
||||
useTray(true, async () => {
|
||||
is_close = true;
|
||||
await invoke("stop_command", { child_id: listenObj.thread_id || 0 });
|
||||
await invoke("stop_command", { child_id: data.winipBcPid || 0 });
|
||||
});
|
||||
|
||||
const mainStore = useMainStore();
|
||||
@@ -270,6 +283,8 @@
|
||||
const protocols = ["tcp", "udp", "ws", "wss", "wg"];
|
||||
const data = reactive({
|
||||
logVisible: false,
|
||||
winipBcPid: 0, //WinIPBroadcast进程id
|
||||
winipBcStart: false,
|
||||
memberVisible: false,
|
||||
log: "",
|
||||
update: false,
|
||||
@@ -284,7 +299,7 @@
|
||||
const appWindow = getCurrentWindow();
|
||||
if (appWindow.label == "main") {
|
||||
appWindow.onCloseRequested(async event => {
|
||||
console.log(appWindow.label);
|
||||
// console.log(appWindow.label);
|
||||
if (!is_close) {
|
||||
event.preventDefault();
|
||||
appWindow.hide();
|
||||
@@ -397,8 +412,47 @@
|
||||
data.releaseList = list as never[];
|
||||
};
|
||||
|
||||
const getWinIpBroadcastPid = async () => {
|
||||
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
||||
data.winipBcPid = (pid as number) || 0;
|
||||
if (data.winipBcPid && data.winipBcPid > 0) {
|
||||
data.winipBcStart = true;
|
||||
} else {
|
||||
data.winipBcStart = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleWinipBcStart = async () => {
|
||||
if (!data.winipBcStart) {
|
||||
try {
|
||||
await invoke("stop_command", { child_id: data.winipBcPid || 0 });
|
||||
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
||||
data.winipBcPid = child.pid || 0;
|
||||
if (data.winipBcPid) {
|
||||
data.winipBcStart = true;
|
||||
} else {
|
||||
Elmessage.error(`启动失败`);
|
||||
}
|
||||
} catch (err) {
|
||||
Elmessage.error(`启动失败`);
|
||||
console.log(err);
|
||||
}
|
||||
} else {
|
||||
await invoke("stop_command", { child_id: data.winipBcPid || 0 });
|
||||
await getWinIpBroadcastPid();
|
||||
}
|
||||
};
|
||||
|
||||
const initStartWinIpBroadcast = async () => {
|
||||
await getWinIpBroadcastPid();
|
||||
if (!data.winipBcStart) {
|
||||
await handleWinipBcStart();
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// await handleUpdateCore(); //默认不自动更新
|
||||
await initStartWinIpBroadcast();
|
||||
await getCoreVersion();
|
||||
await listenObj.listenThreadId();
|
||||
closePrevent();
|
||||
@@ -519,7 +573,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleShowLogDialog = async () => {
|
||||
try {
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
|
||||
+24
-3
@@ -9,9 +9,23 @@
|
||||
>
|
||||
<ElTableColumn
|
||||
v-for="prop in showTableHeader"
|
||||
:prop="prop[0]"
|
||||
:label="prop[1]"
|
||||
></ElTableColumn>
|
||||
:key="prop[0]"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="prop[0] == 'loss_rate'">
|
||||
{{ row[prop[0]] && row[prop[0]] != "-" ? Number(row[prop[0]] * 100).toFixed(2) + "%" : row[prop[0]] }}
|
||||
</span>
|
||||
<span v-else-if="prop[0] != 'cost'">{{ row[prop[0]] }}</span>
|
||||
<ElTag
|
||||
v-else
|
||||
effect="dark"
|
||||
:type="row[prop[0]] == 'p2p' ? 'success' : 'info'"
|
||||
>
|
||||
{{ row[prop[0]] }}
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,7 +37,14 @@
|
||||
member: []
|
||||
});
|
||||
|
||||
const showTableHeader = [["ipv4", "虚拟网IP"], ["hostname", "主机名"], ["lat_ms", "延迟"], ["loss_rate", "丢包率"], ["version", '版本']];
|
||||
const showTableHeader = [
|
||||
["ipv4", "虚拟网IP"],
|
||||
["hostname", "主机名"],
|
||||
["cost", "方式"],
|
||||
["lat_ms", "延迟/ms"],
|
||||
["loss_rate", "丢包率"],
|
||||
["version", "版本"]
|
||||
];
|
||||
const headers = [
|
||||
"ipv4",
|
||||
"hostname",
|
||||
|
||||
Reference in New Issue
Block a user