@@ -104,7 +117,8 @@
maxlength="100"
placeholder="请输入网络密码"
v-model="config.networkPassword"
- type="password">
+ type="password"
+ >
@@ -121,11 +135,13 @@
-
+
- {{ !data.isStart ? "开始联机" : "停止联机" }}
+ size="default"
+ >
+ {{ !data.isStart ? "启动联机" : "停止联机" }}
-
- 日志信息
-
+
+
+
+
+
+
+ size="small"
+ >
禁用p2p
+ size="small"
+ >
禁用ipv6
+ size="small"
+ >
禁用端口监听
+ @click="open('https://github.com/EasyTier/EasyTier/releases')"
+ >
easytier发布页
@@ -196,52 +237,62 @@
class="!text-[11px]"
type="danger"
:underline="false"
- @click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')">
- 找不到房间?建议安装WinIPBroadcast
+ @click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
+ >
+ 找不到房间?安装WinIPBroadcast
-
-
-
diff --git a/pages/log.vue b/pages/log.vue
new file mode 100644
index 0000000..02b482d
--- /dev/null
+++ b/pages/log.vue
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/pages/member.vue b/pages/member.vue
new file mode 100644
index 0000000..bb00b21
--- /dev/null
+++ b/pages/member.vue
@@ -0,0 +1,172 @@
+
+
+
+ {{ "等待成员信息中..." }}
+
+
+
+
+
+
+
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 0b0b79d..6d83d74 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -1059,7 +1059,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "easytier-game"
-version = "1.0.3"
+version = "1.0.4"
dependencies = [
"log",
"reqwest",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 9e23f8c..668ea15 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "easytier-game"
-version = "1.0.3"
+version = "1.0.4"
+homepage = "https://github.com/EasyTier/EasyTier"
+repository = "https://github.com/EasyTier/EasytierGame"
description = "A simple network initiator based on Easytier"
-authors = ["you"]
-license = ""
-repository = ""
+authors = ["leizi97"]
+license = "LICENSE"
+
edition = "2021"
rust-version = "1.77.2"
@@ -16,6 +18,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.0.1", features = [] }
+# prost-build = "0.13.2"
[dependencies]
serde_json = "1.0"
@@ -30,6 +33,8 @@ tauri-plugin-log = "2.0.0-rc"
tauri-plugin-shell = "2"
reqwest = { version = "0.12", features = ["json"] }
zip = "2.2.0"
+# prost = "0.13"
+# prost-types = "0.13"
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-single-instance = "2"
diff --git a/src-tauri/LICENSE b/src-tauri/LICENSE
new file mode 100644
index 0000000..ea5b606
--- /dev/null
+++ b/src-tauri/LICENSE
@@ -0,0 +1 @@
+../LICENSE
\ No newline at end of file
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index b50fe1d..c32b543 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -3,13 +3,25 @@
"identifier": "default",
"description": "enables the default permissions",
"windows": [
- "main"
+ "main",
+ "log"
],
"permissions": [
"core:default",
"core:window:allow-minimize",
"core:window:allow-hide",
"core:window:allow-close",
- "shell:allow-open"
+ "shell:allow-open",
+ "core:window:allow-show",
+ "core:window:allow-create",
+ "core:window:allow-set-position",
+ "core:window:allow-destroy",
+ "core:webview:allow-create-webview-window",
+ "core:webview:allow-set-webview-size",
+ "core:webview:allow-set-webview-position",
+ "core:webview:allow-create-webview",
+ "core:webview:allow-webview-show",
+ "core:webview:allow-webview-hide",
+ "core:webview:allow-webview-close"
]
}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 8ef6aab..eb7ac0b 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1,5 +1,6 @@
use reqwest::{Client, Error};
-use serde::Deserialize;
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
use std::fs::{self, File};
use std::io::{BufRead, BufReader, Write};
use std::os::windows::process::CommandExt;
@@ -11,8 +12,7 @@ use std::sync::{
use std::{path, thread};
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
use tauri::Emitter;
-use tauri::{Manager, WindowEvent};
-
+use tauri::Manager;
// 定义GitHub Release的结构体
#[derive(Debug, Deserialize)]
pub struct Release {
@@ -47,26 +47,6 @@ pub async fn fetch_releases() -> Result
, Error> {
response.json::>().await
}
-static mut IS_CLOSE: bool = false;
-
-#[tauri::command(rename_all = "snake_case")]
-fn my_commit_output(commit_msg: String, window: tauri::Window) -> Result {
- println!("{}", commit_msg);
- unsafe {
- IS_CLOSE = true;
- }
- window.close().unwrap();
- return Ok(true);
-}
-
-#[tauri::command(rename_all = "snake_case")]
-fn force_close(window: tauri::Window) {
- unsafe {
- IS_CLOSE = true;
- }
- window.close().unwrap();
-}
-
#[tauri::command(rename_all = "snake_case")]
fn get_core_version() -> String {
match Command::new("easytier-core.exe")
@@ -82,9 +62,74 @@ fn get_core_version() -> String {
}
}
+#[tauri::command(rename_all = "snake_case")]
+fn get_cli_version() -> String {
+ match Command::new("easytier-cli.exe")
+ .arg("--version")
+ .creation_flags(0x08000000)
+ .output()
+ {
+ Ok(output) => {
+ let output_str = String::from_utf8_lossy(&output.stdout);
+ return output_str.trim().to_string();
+ }
+ Err(_e) => return "".to_string(),
+ }
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+struct RoutePeerInfo {
+ peer_id: u64,
+ cost: u64,
+ hostname: Option,
+ udp_stun_info: String,
+ easytier_version: String,
+ network_length: u64,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+struct RouteTable {
+ peer_infos: HashMap,
+ ipv4_peer_id_map: HashMap,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+struct PeerRouteServiceImpl {
+ route_table_with_cost: RouteTable,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+struct PeerRoute {
+ my_peer_id: u64,
+ service_impl: PeerRouteServiceImpl,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+struct MyResponse {
+ response: PeerRoute
+}
+
+
+
+#[tauri::command(rename_all = "snake_case")]
+fn get_members_by_cli() -> String {
+ match Command::new("easytier-cli.exe")
+ .arg("peer")
+ .arg("list")
+ .creation_flags(0x08000000)
+ .output()
+ {
+ Ok(output) => {
+ let output_str = String::from_utf8_lossy(&output.stdout);
+ return output_str.trim().to_string();
+ }
+ Err(_e) => return _e.to_string(),
+ }
+}
+
#[tauri::command(rename_all = "snake_case")]
async fn download_easytier_zip(download_url: String, file_name: String) {
- let target = format!("https://ghp.ci/?q={}",download_url);
+ let target = format!("https://ghp.ci/{}", download_url);
let response = reqwest::get(target)
.await
.expect("error to download easytier url");
@@ -269,16 +314,17 @@ pub fn run() {
let context = tauri::generate_context!();
tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
- .on_window_event(move |window, event| {
- if let WindowEvent::CloseRequested { api, .. } = event {
- unsafe {
- if !IS_CLOSE {
- api.prevent_close();
- window.emit("window-close-event", "").unwrap();
- }
- }
- }
- })
+ // .on_window_event(move |window, event| {
+ // if let WindowEvent::CloseRequested { api, .. } = event {
+ // println!("close window");
+ // unsafe {
+ // if !IS_CLOSE && window.label() == "main" {
+ // api.prevent_close();
+ // window.emit("window-close-event", "").unwrap();
+ // }
+ // }
+ // }
+ // })
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
let _ = app
.get_webview_window("main")
@@ -316,13 +362,13 @@ pub fn run() {
})
.manage(stop_signal_clone)
.invoke_handler(tauri::generate_handler![
- my_commit_output,
- force_close,
run_command,
stop_command,
get_core_version,
fetch_easytier_list,
- download_easytier_zip
+ download_easytier_zip,
+ get_cli_version,
+ get_members_by_cli
])
.run(context)
.expect("error while running tauri application");
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 400271e..0be37eb 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "easytier-game",
- "version": "1.0.3",
+ "version": "1.0.4",
"identifier": "com.tauri.easytier-game",
"build": {