高级选项增加魔法DNS( 2.3.0内核以上) 优化成员列表延迟排序,1.4.5发布

This commit is contained in:
heixiansen
2025-05-26 17:20:56 +08:00
parent fb8e127198
commit 8e9bb114d6
6 changed files with 99 additions and 37 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"private": true,
"author": "leizi97",
"description": "A simple network initiator based on Easytier",
"version": "1.4.4",
"version": "1.4.5",
"scripts": {
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
"build": "nuxt generate --dotenv env/.env.prod",
+48 -1
View File
@@ -54,9 +54,11 @@
prop="lat_ms"
width="100"
label="延迟/ms"
:sort-method="sortLatMs"
:sort-orders="['ascending', 'descending', null]"
>
<template #default="{ row }">
{{ row.lat_ms && !isNaN(Number(row.lat_ms)) ? Number(row.lat_ms).toFixed(0) : row.lat_ms || "-" }}
{{ formatLatency(row.lat_ms) }}
</template>
</ElTableColumn>
<ElTableColumn
@@ -144,6 +146,51 @@
member: []
});
// 延迟排序函数
const sortLatMs = (a: any, b: any): number => {
const getLatencyValue = (row: any): number => {
const latMs = row.lat_ms;
if (latMs === null || latMs === undefined || latMs === "") {
return Infinity;
}
const num = Number(latMs);
if (isNaN(num) || num < 0) {
return Infinity;
}
return Math.floor(num);
};
const valueA = getLatencyValue(a);
const valueB = getLatencyValue(b);
if (valueA === Infinity && valueB === Infinity) {
return 0;
}
return valueA - valueB;
};
// 格式化延迟显示
const formatLatency = (latMs: any): string => {
if (latMs === null || latMs === undefined || latMs === "") {
return "-";
}
const num = Number(latMs);
if (isNaN(num)) {
return "-";
}
if (num < 0) {
return "-";
}
return num.toFixed(0);
};
const _showTableHeader = [
["hostname", "主机名"],
["cost", "路由"],
+1 -19
View File
@@ -1253,11 +1253,10 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "easytier-game"
version = "1.4.4"
version = "1.4.5"
dependencies = [
"hashbrown 0.15.2",
"log",
"planif",
"rand 0.9.0",
"reqwest",
"serde",
@@ -3496,14 +3495,6 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "planif"
version = "1.0.0"
source = "git+https://github.com/mattrobineau/planif?tag=1.0.1#90e228e2bc0f142b16a0ba415ec242e1c836cc35"
dependencies = [
"windows 0.48.0",
]
[[package]]
name = "plist"
version = "1.7.0"
@@ -5999,15 +5990,6 @@ dependencies = [
"windows-version",
]
[[package]]
name = "windows"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows"
version = "0.57.0"
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "easytier-game"
version = "1.4.4"
version = "1.4.5"
homepage = "https://github.com/EasyTier/EasyTier"
repository = "https://github.com/EasyTier/EasytierGame"
description = "A simple network initiator based on Easytier"
@@ -39,7 +39,7 @@ tauri-plugin-shell = "2.2.1"
reqwest = { version = "0.12.12", features = ["json"] }
zip = "2.2.3"
sysinfo = '0.33.1'
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
# planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
whoami = "1.5.2"
tauri-plugin-fs = "2.3.0"
tauri-plugin-clipboard-manager = "2.2.2"
+45 -12
View File
@@ -13,7 +13,7 @@ use sysinfo::System;
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
use tauri::Emitter;
use tauri::Manager;
use windows::core::{BSTR, VARIANT};
use windows::core::{Interface, BSTR, VARIANT};
use windows::Win32::Foundation::VARIANT_BOOL;
use windows::Win32::NetworkManagement::IpHelper::{
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
@@ -738,29 +738,62 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
&VARIANT::default(),
&VARIANT::default(),
)?;
let folder_path = BSTR::from("\\easytierGame");
let task_name = BSTR::from("auto start");
// 使用优化的文件夹处理函数
let task_folder = ensure_task_folder_and_cleanup(&task_service, &folder_path, &task_name)?;
// 创建任务定义...
let task_definition = task_service.NewTask(0)?;
// ... existing task creation logic ...
// 设置任务信息
let registration_info = task_definition.RegistrationInfo()?;
registration_info.SetDescription(&BSTR::from("EasytierGame auto start task"))?;
registration_info.SetAuthor(&BSTR::from("EasytierGame"))?;
// 改为用户登录触发
let triggers = task_definition.Triggers()?;
let trigger = triggers.Create(TASK_TRIGGER_LOGON)?;
let logon_trigger: ILogonTrigger = trigger.cast()?;
logon_trigger.SetEnabled(VARIANT_BOOL::from(true))?;
// 设置动作
let actions = task_definition.Actions()?;
let action = actions.Create(TASK_ACTION_EXEC)?;
let exec_action: IExecAction = action.cast()?;
let exe = std::env::current_exe()?;
let exe_path: &str = exe.to_str().unwrap();
exec_action.SetPath(&BSTR::from(exe_path))?;
exec_action.SetArguments(&BSTR::from("--task-auto-start"))?;
// 使用当前用户运行
let principal = task_definition.Principal()?;
principal.SetUserId(&BSTR::from(whoami::username().as_str()))?;
principal.SetLogonType(TASK_LOGON_INTERACTIVE_TOKEN)?;
principal.SetRunLevel(TASK_RUNLEVEL_HIGHEST)?;
// 注册任务
// 设置任务设置
let settings = task_definition.Settings()?;
settings.SetEnabled(VARIANT_BOOL::from(true))?;
settings.SetCompatibility(TASK_COMPATIBILITY_V2)?; // Windows 7
settings.SetStartWhenAvailable(VARIANT_BOOL::from(true))?;
// settings.SetHidden(VARIANT_BOOL::from(true))?; // 注释掉让任务可见
settings.SetExecutionTimeLimit(&BSTR::from("PT0S"))?;
// 获取文件夹并注册任务
let task_folder = ensure_task_folder_and_cleanup(&task_service, &folder_path, &task_name)?;
let _auto_task = task_folder.RegisterTaskDefinition(
&task_name,
&task_definition,
TASK_CREATE_OR_UPDATE.0,
&VARIANT::default(),
&VARIANT::default(),
TASK_LOGON_SERVICE_ACCOUNT,
TASK_LOGON_INTERACTIVE_TOKEN,
&VARIANT::default()
)?;
println!("任务注册成功");
CoUninitialize();
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "easytier-game",
"version": "1.4.4",
"version": "1.4.5",
"identifier": "com.tauri.easytier-game",
"build": {
@@ -12,7 +12,7 @@
"app": {
"windows": [
{
"title": "easytier-game 1.4.4",
"title": "easytier-game 1.4.5",
"label": "main",
"minWidth": 340,
"width": 340,