diff --git a/composables/tray.ts b/composables/tray.ts index 088f191..8fc5631 100644 --- a/composables/tray.ts +++ b/composables/tray.ts @@ -121,9 +121,10 @@ export async function MenuItemTheme() { text: "主题切换", action: async () => { const mainStore = useMainStore(); - mainStore.theme = !mainStore.theme; - // const appWindow = getCurrentWindow(); - // appWindow.emitTo("main", "config", { theme: mainStore.theme }); + mainStore.$patch({ + theme: !mainStore.theme + }); + // mainStore.$persist(); await setTheme(mainStore.theme); }, }); diff --git a/env/.env.dev b/env/.env.dev index 7f166d0..74122f0 100644 --- a/env/.env.dev +++ b/env/.env.dev @@ -3,5 +3,6 @@ VITE_CONFIG_ADMIN_PATH=easytier/config/.admin/ VITE_CONFIG_FILE_NAME=easytier/config.json VITE_LOG_PATH=easytier/logs/ VITE_CACHE_PATH=easytier/cache/ +VITE_GAME_LIST_PATH=easytier/gameList/ VITE_PUBLIC_PEERS_URL=https://easytier.gd.nkbpal.cn/status/easytier VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart \ No newline at end of file diff --git a/env/.env.prod b/env/.env.prod index 7f166d0..74122f0 100644 --- a/env/.env.prod +++ b/env/.env.prod @@ -3,5 +3,6 @@ VITE_CONFIG_ADMIN_PATH=easytier/config/.admin/ VITE_CONFIG_FILE_NAME=easytier/config.json VITE_LOG_PATH=easytier/logs/ VITE_CACHE_PATH=easytier/cache/ +VITE_GAME_LIST_PATH=easytier/gameList/ VITE_PUBLIC_PEERS_URL=https://easytier.gd.nkbpal.cn/status/easytier VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index 094f476..e40e5d9 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -3,107 +3,107 @@ import path from "path"; import vueJSX from "@vitejs/plugin-vue-jsx"; export default defineNuxtConfig({ - ssr: false, + ssr: false, - devServer: { - port: 5000 - }, - - telemetry: false, + devServer: { + port: 5000 + }, + + telemetry: false, - imports: { - autoImport: false - }, + imports: { + autoImport: false + }, - css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"], - modules: [ - "@element-plus/nuxt", - "@pinia/nuxt", - [ - "pinia-plugin-persistedstate/nuxt", - { - key: "__glj_persisted_%id", - storage: "localStorage" - } - ], - "@nuxtjs/tailwindcss" - ], + css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"], + modules: [ + "@element-plus/nuxt", + "@pinia/nuxt", + [ + "pinia-plugin-persistedstate/nuxt", + { + key: "__glj_persisted_%id", + storage: "localStorage" + } + ], + "@nuxtjs/tailwindcss" + ], - alias: { - "@": path.resolve(__dirname, "./") - }, + alias: { + "@": path.resolve(__dirname, "./") + }, - experimental: { - payloadExtraction: false - }, + experimental: { + payloadExtraction: false + }, - devtools: { - enabled: false - }, + devtools: { + enabled: false + }, - router: { - options: { - hashMode: true - } - }, + router: { + options: { + hashMode: true + } + }, - vite: { - plugins: [vueJSX({})], - envDir: "env", - optimizeDeps: { - // include: [...optimizeDepsElementPlusIncludes] - }, - // prevent vite from obscuring rust errors - clearScreen: false, - // Tauri expects a fixed port, fail if that port is not available - server: { - strictPort: true - }, - // to access the Tauri environment variables set by the CLI with information about the current target - envPrefix: ["VITE_", "TAURI_"], - build: { - // minify: "esbuild", - chunkSizeWarningLimit: 1500, - // Tauri uses Chromium on Windows and WebKit on macOS and Linux - target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13", - // don't minify for debug builds - minify: !process.env.TAURI_DEBUG ? "esbuild" : false, - // 为调试构建生成源代码映射 (sourcemap) - sourcemap: !!process.env.TAURI_DEBUG - }, - esbuild: { - // pure: ["console.log"], - drop: ["debugger"] - } - }, + vite: { + plugins: [vueJSX({})], + envDir: "env", + optimizeDeps: { + // include: [...optimizeDepsElementPlusIncludes] + }, + // prevent vite from obscuring rust errors + clearScreen: false, + // Tauri expects a fixed port, fail if that port is not available + server: { + strictPort: true + }, + // to access the Tauri environment variables set by the CLI with information about the current target + envPrefix: ["VITE_", "TAURI_"], + build: { + // minify: "esbuild", + chunkSizeWarningLimit: 1500, + // Tauri uses Chromium on Windows and WebKit on macOS and Linux + target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13", + // don't minify for debug builds + minify: !process.env.TAURI_DEBUG ? "esbuild" : false, + // 为调试构建生成源代码映射 (sourcemap) + sourcemap: !!process.env.TAURI_DEBUG + }, + esbuild: { + // pure: ["console.log"], + drop: ["debugger"] + } + }, - postcss: { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } - }, + postcss: { + plugins: { + tailwindcss: {}, + autoprefixer: {} + } + }, - app: { - rootId: "__easytier", - cdnURL: "./", - buildAssetsDir: "__easytier/", - head: { - meta: [ - { - name: "viewport", - content: "width=device-width, initial-scale=1" - }, - { - charset: "utf-8" - } - ], - title: "easytier-game" - // link: [], - // style: [], - // script: [], - // noscript: [] - } - }, - compatibilityDate: "2024-11-12" + app: { + rootId: "__easytier", + cdnURL: "./", + buildAssetsDir: "__easytier/", + head: { + meta: [ + { + name: "viewport", + content: "width=device-width, initial-scale=1" + }, + { + charset: "utf-8" + } + ], + title: "easytier-game" + // link: [], + // style: [], + // script: [], + // noscript: [] + } + }, + compatibilityDate: "2024-11-12" }); diff --git a/package.json b/package.json index db7db5f..8027fed 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "author": "leizi97", "description": "A simple network initiator based on Easytier", - "version": "1.3.9", + "version": "1.4.0", "scripts": { "dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0", "build": "nuxt generate --dotenv env/.env.prod", diff --git a/pages/gameList.vue b/pages/gameList.vue new file mode 100644 index 0000000..0c0bec5 --- /dev/null +++ b/pages/gameList.vue @@ -0,0 +1,397 @@ + + diff --git a/pages/index.vue b/pages/index.vue index 9f69ab0..12b5448 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -44,16 +44,24 @@ - - 内核管理 - + + 内核管理 + + @@ -310,6 +318,12 @@ > 保存当前房间配置 + + 本地游戏列表 + @@ -684,9 +698,10 @@ SetUp, Folder, CopyDocument, - Platform + Platform, + SwitchFilled } from "@element-plus/icons-vue"; - import { reactive, onBeforeUnmount, onMounted, ref, toRaw } from "vue"; + import { reactive, onBeforeUnmount, onMounted, ref, toRaw, computed } from "vue"; import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion } from "~/composables/tray"; import { getMatches } from "@tauri-apps/plugin-cli"; import { initStartWinIpBroadcast } from "~/composables/netcard"; @@ -694,7 +709,7 @@ import { ElMessage, ElMessageBox, ElTooltip } from "element-plus"; import { getCurrentWindow, type Window } from "@tauri-apps/api/window"; import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow"; - import etWindows from "@/composables/windows"; + import etWindows, { dataSubscribe } from "@/composables/windows"; import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path"; import { readDir, exists, mkdir, BaseDirectory, readTextFile, readFile, writeFile, remove as removeFile } from "@tauri-apps/plugin-fs"; import { updateConfigJson } from "~/composables/configJson"; @@ -731,6 +746,7 @@ cidrVisible: false, advanceVisible: false, toolVisible: false, + gameListVisible: false, serverVisible: false, winipBcPid: 0, //WinIPBroadcast进程id winipBcStart: false, @@ -962,6 +978,18 @@ data.coreVersion = (coreVersion as string).replace("easytier-core ", ""); }; + const haveNewCoreVersion = computed(() => { + if (!data.coreVersion) return false; + const releaseLatestVersion = data?.releaseList?.[0]?.[0]; + if (!releaseLatestVersion) return false; + const version = `v${/(\d+\.\d+\.\d+)/g.exec(data.coreVersion || "")?.[1]}`; + // console.log(version, releaseLatestVersion) + if (releaseLatestVersion != version) { + return true; + } + return false; + }); + const checkUpdate = async () => { // const latestVersionFileName = data.releaseList?.[0]?.[0]?.[1] as string; let [downloadUrl, versionFileName] = (coreManagementData.data as string).split("<>"); @@ -993,7 +1021,7 @@ const handleCoreManagement = async () => { coreManagementData.visible = true; - await getReleaseList(); + // await getReleaseList(); }; const handleInstallCore = async () => { @@ -1160,14 +1188,14 @@ mountedShow(); // 不需要await closePrevent(); data.hasNewVersion = await checkNewVersion(); - window.addEventListener("storage", () => { - mainStore.$hydrate(); + dataSubscribe(async () => { if (mainStore.createConfigInEasytier) { b(async () => { await updateConfigJson(data.configJsonSeverUrl); }); } }); + getReleaseList(); }); onBeforeUnmount(() => { @@ -1550,6 +1578,27 @@ } } } + + if (command === "game_start_config") { + await etWindows( + "gameList", + { + title: "本地游戏列表", + width: 800, + height: 400, + minWidth: 800, + minHeight: 400, + resizable: true, + url: "#/gameList" + }, + (_, appWindow) => { + data.gameListVisible = true; + }, + () => { + data.gameListVisible = false; + } + ); + } }; const handleDeleteAdminConfig = async () => { diff --git a/pages/tool.vue b/pages/tool.vue index cab7e96..9b14f21 100644 --- a/pages/tool.vue +++ b/pages/tool.vue @@ -42,7 +42,7 @@
方案2 diff --git a/public/default.png b/public/default.png new file mode 100644 index 0000000..b6c4810 Binary files /dev/null and b/public/default.png differ diff --git a/public/icon.png b/public/icon.png deleted file mode 100644 index 23be565..0000000 Binary files a/public/icon.png and /dev/null differ diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a07a7d7..a6c0f21 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1290,7 +1290,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "easytier-game" -version = "1.3.9" +version = "1.4.0" dependencies = [ "hashbrown 0.15.2", "log", @@ -2075,6 +2075,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + [[package]] name = "httparse" version = "1.9.5" @@ -4745,6 +4751,7 @@ dependencies = [ "gtk", "heck 0.5.0", "http", + "http-range", "image", "jni", "libc", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2aa445f..f28e4b2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "easytier-game" -version = "1.3.9" +version = "1.4.0" homepage = "https://github.com/EasyTier/EasyTier" repository = "https://github.com/EasyTier/EasytierGame" description = "A simple network initiator based on Easytier" @@ -25,7 +25,7 @@ tauri-build = { version = "2.0.5", features = [] } serde_json = "1.0.137" serde = { version = "1.0.217", features = ["derive"] } log = "0.4.25" -tauri = { version = "2.2.5", features = [ +tauri = { version = "2.2.5", features = [ "protocol-asset", "tray-icon", "image-png", "image-ico", diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 54f774c..6240e6e 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -2,7 +2,7 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "enables the default permissions", - "windows": ["main", "log", "member", "cidr", "advance", "tool", "server"], + "windows": ["main", "log", "member", "cidr", "advance", "tool", "server", "gameList"], "permissions": [ "core:default", "core:window:allow-minimize", diff --git a/src-tauri/easytier/easytier-cli.exe b/src-tauri/easytier/easytier-cli.exe index 90034f1..b10fc21 100644 Binary files a/src-tauri/easytier/easytier-cli.exe and b/src-tauri/easytier/easytier-cli.exe differ diff --git a/src-tauri/easytier/easytier-core.exe b/src-tauri/easytier/easytier-core.exe index b3f3edd..07e44e2 100644 Binary files a/src-tauri/easytier/easytier-core.exe and b/src-tauri/easytier/easytier-core.exe differ diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index dcb30f5..d367c69 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.3.9", + "version": "1.4.0", "identifier": "com.tauri.easytier-game", "build": { @@ -12,7 +12,7 @@ "app": { "windows": [ { - "title": "easytier-game 1.3.9", + "title": "easytier-game 1.4.0", "label": "main", "minWidth": 340, "width": 340, @@ -30,7 +30,11 @@ } ], "security": { - "csp": null + "csp": null, + "assetProtocol": { + "enable": true, + "scope": ["**"] + } } }, "plugins": { diff --git a/stores/index.ts b/stores/index.ts index c7aeebc..18d8471 100644 --- a/stores/index.ts +++ b/stores/index.ts @@ -57,7 +57,7 @@ const store = defineStore("main", { configPath: "", //配置文件路径 winIpBcAutoStart: true, createConfigInEasytier: false, //在easytier目录生成config.json文件吗 - githubFastUrl: "https://ghproxy.cc/", + githubFastUrl: "https://ghfast.top/", // forceBindIp配置 forceBindIpBit: "64", @@ -66,7 +66,9 @@ const store = defineStore("main", { forceBindFile: "", winipBcPid: 0, - winipBcStart: false + winipBcStart: false, + + gameList: [] as Array<{name: string, exePath: string, id: string, coverImg: string; showImg: string}>, // 游戏列表 }; }, persist: { @@ -133,7 +135,9 @@ const store = defineStore("main", { "forceBindIpBit", "delayInjectDll", "forceBindInput", - "forceBindFile" + "forceBindFile", + + "gameList" ] // // 除了这些,其他都要存下来 // omit: ["winipBcPid", "winipBcStart"] diff --git a/typings/index.d.ts b/typings/index.d.ts index 4d085e1..f89978b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -4,6 +4,7 @@ interface ImportMetaEnv { readonly VITE_LOG_PATH: string; readonly VITE_CACHE_PATH: string; readonly VITE_AUTO_START_SERVICE_NAME: string; + readonly VITE_GAME_LIST_PATH: string; } interface ImportMeta {