mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d6e93d796 | ||
|
|
0253d95597 | ||
|
|
5875b30c34 |
+23
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["prettier-plugin-tailwindcss"],
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "ignore",
|
||||||
|
"insertPragma": false,
|
||||||
|
"singleAttributePerLine": true,
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"printWidth": 150,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"requirePragma": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": false,
|
||||||
|
"tabWidth": 4,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"useTabs": true,
|
||||||
|
"embeddedLanguageFormatting": "auto",
|
||||||
|
"vueIndentScriptAndStyle": true
|
||||||
|
}
|
||||||
@@ -46,4 +46,8 @@ html.dark body {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
font-size: 12px!important;
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
|||||||
serverUrl,
|
serverUrl,
|
||||||
port,
|
port,
|
||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
|
enablePreventSleep,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
...otherConfig
|
...otherConfig
|
||||||
} = mainStore.config;
|
} = mainStore.config;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const handleWinipBcStart = async () => {
|
|||||||
await getWinIpBroadcastPid();
|
await getWinIpBroadcastPid();
|
||||||
if (mainStore.winipBcPid <= 0) {
|
if (mainStore.winipBcPid <= 0) {
|
||||||
mainStore.$patch({
|
mainStore.$patch({
|
||||||
winIpBcAutoStart: true
|
winIpBcAutoStart: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -3,7 +3,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"author": "leizi97",
|
"author": "leizi97",
|
||||||
"description": "A simple network initiator based on Easytier",
|
"description": "A simple network initiator based on Easytier",
|
||||||
"version": "1.2.9",
|
"version": "1.3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||||
"build": "nuxt generate --dotenv env/.env.prod",
|
"build": "nuxt generate --dotenv env/.env.prod",
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
"pinia": "^2.2.6",
|
"pinia": "^2.2.6",
|
||||||
"pinia-plugin-persistedstate": "^4.1.3",
|
"pinia-plugin-persistedstate": "^4.1.3",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
|
"prettier": "^3.4.1",
|
||||||
|
"prettier-plugin-tailwindcss": "^0.6.9",
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
"vue-clipboard3": "^2.0.0"
|
"vue-clipboard3": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
打开config.json目录
|
打开config.json目录
|
||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止休眠</ElCheckbox></div>
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||||
@@ -184,6 +185,7 @@
|
|||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
import { dataSubscribe } from "@/composables/windows";
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
import { supportProtocols } from "~/utils";
|
import { supportProtocols } from "~/utils";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
const protocols = supportProtocols();
|
const protocols = supportProtocols();
|
||||||
const listenerDialogData = reactive<{ [key: string]: any }>({
|
const listenerDialogData = reactive<{ [key: string]: any }>({
|
||||||
|
|||||||
+17
-5
@@ -523,7 +523,7 @@
|
|||||||
import { updateConfigJson } from "~/composables/configJson";
|
import { updateConfigJson } from "~/composables/configJson";
|
||||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { sortedUniq, uniq } from "lodash-es";
|
import { sortedUniq, uniq } from "lodash-es";
|
||||||
import { bounce, addQQGroup, supportProtocols } from "~/utils";
|
import { bounce, addQQGroup, supportProtocols, preventSleep, stopPreventSleep } from "~/utils";
|
||||||
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
|
|
||||||
@@ -668,9 +668,9 @@
|
|||||||
mainStore.config.ipv4 = configIpv4;
|
mainStore.config.ipv4 = configIpv4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.payload.includes("peer connection removed")) {
|
// if (event.payload.includes("peer connection removed")) {
|
||||||
data.isSuccessGetIp = false;
|
// data.isSuccessGetIp = false;
|
||||||
}
|
// }
|
||||||
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
|
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
|
||||||
await setTrayRunState(tray, true);
|
await setTrayRunState(tray, true);
|
||||||
data.isSuccessGetIp = true;
|
data.isSuccessGetIp = true;
|
||||||
@@ -737,10 +737,14 @@
|
|||||||
async listenConfigStart() {
|
async listenConfigStart() {
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
const unListen = await listen("config", event => {
|
const unListen = await listen("config", event => {
|
||||||
// console.error("config", event.payload);
|
|
||||||
const ipv4 = config.ipv4;
|
const ipv4 = config.ipv4;
|
||||||
mainStore.$patch(event.payload as any);
|
mainStore.$patch(event.payload as any);
|
||||||
config.ipv4 = ipv4;
|
config.ipv4 = ipv4;
|
||||||
|
if(mainStore.config.enablePreventSleep) {
|
||||||
|
preventSleep();
|
||||||
|
}else {
|
||||||
|
stopPreventSleep();
|
||||||
|
}
|
||||||
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
||||||
});
|
});
|
||||||
const unListen2 = mainStore.$subscribe(() => {
|
const unListen2 = mainStore.$subscribe(() => {
|
||||||
@@ -949,6 +953,12 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initPreventSleep = async () => {
|
||||||
|
if (mainStore.config.enablePreventSleep) {
|
||||||
|
preventSleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mountedShow = async () => {
|
const mountedShow = async () => {
|
||||||
const args = await getMatches();
|
const args = await getMatches();
|
||||||
if (!args.args?.["task-auto-start"]?.value) {
|
if (!args.args?.["task-auto-start"]?.value) {
|
||||||
@@ -974,6 +984,7 @@
|
|||||||
await initConfigDir();
|
await initConfigDir();
|
||||||
await initAutoStartServer();
|
await initAutoStartServer();
|
||||||
await initConnectAfterStart();
|
await initConnectAfterStart();
|
||||||
|
initPreventSleep();
|
||||||
mountedShow(); // 不需要await
|
mountedShow(); // 不需要await
|
||||||
closePrevent();
|
closePrevent();
|
||||||
});
|
});
|
||||||
@@ -986,6 +997,7 @@
|
|||||||
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
||||||
logsTimer && clearInterval(logsTimer);
|
logsTimer && clearInterval(logsTimer);
|
||||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||||
|
stopPreventSleep();
|
||||||
});
|
});
|
||||||
|
|
||||||
const getArgs = async () => {
|
const getArgs = async () => {
|
||||||
|
|||||||
+9
-6
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="overflow-auto h-full">
|
<div class="overflow-auto h-full">
|
||||||
<div class="w-[1200px]">
|
<div class="w-[1200px]">
|
||||||
<span v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</span>
|
<ElText size="small" v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</ElText>
|
||||||
<ElTable
|
<ElTable
|
||||||
stripe
|
stripe
|
||||||
border
|
border
|
||||||
@@ -22,10 +22,11 @@
|
|||||||
sortable
|
sortable
|
||||||
width="90"
|
width="90"
|
||||||
prop="cost"
|
prop="cost"
|
||||||
label="路由"
|
label="方式"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<ElTag
|
<ElTag
|
||||||
|
size="small"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:type="row.cost == 'p2p' ? 'success' : 'info'"
|
:type="row.cost == 'p2p' ? 'success' : 'info'"
|
||||||
>
|
>
|
||||||
@@ -42,12 +43,12 @@
|
|||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
prop="lat_ms"
|
prop="lat_ms"
|
||||||
width="130"
|
width="100"
|
||||||
label="延迟/ms"
|
label="延迟/ms"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="100"
|
||||||
prop="loss_rate"
|
prop="loss_rate"
|
||||||
label="丢包率"
|
label="丢包率"
|
||||||
>
|
>
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="110"
|
||||||
label="NAT类型"
|
label="NAT类型"
|
||||||
prop="nat_type"
|
prop="nat_type"
|
||||||
>
|
>
|
||||||
@@ -67,17 +68,19 @@
|
|||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="122"
|
||||||
prop="version"
|
prop="version"
|
||||||
label="版本"
|
label="版本"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
|
width="100"
|
||||||
prop="tunnel_proto"
|
prop="tunnel_proto"
|
||||||
label="隧道协议"
|
label="隧道协议"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
|
width="90"
|
||||||
prop="rx_bytes"
|
prop="rx_bytes"
|
||||||
label="接收"
|
label="接收"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
|
|||||||
Generated
+72
@@ -80,6 +80,12 @@ importers:
|
|||||||
postcss:
|
postcss:
|
||||||
specifier: ^8.4.38
|
specifier: ^8.4.38
|
||||||
version: 8.4.49
|
version: 8.4.49
|
||||||
|
prettier:
|
||||||
|
specifier: ^3.4.1
|
||||||
|
version: 3.4.1
|
||||||
|
prettier-plugin-tailwindcss:
|
||||||
|
specifier: ^0.6.9
|
||||||
|
version: 0.6.9(prettier@3.4.1)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.6.3
|
specifier: ^5.6.3
|
||||||
version: 5.6.3
|
version: 5.6.3
|
||||||
@@ -3125,6 +3131,66 @@ packages:
|
|||||||
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
|
prettier-plugin-tailwindcss@0.6.9:
|
||||||
|
resolution: {integrity: sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==}
|
||||||
|
engines: {node: '>=14.21.3'}
|
||||||
|
peerDependencies:
|
||||||
|
'@ianvs/prettier-plugin-sort-imports': '*'
|
||||||
|
'@prettier/plugin-pug': '*'
|
||||||
|
'@shopify/prettier-plugin-liquid': '*'
|
||||||
|
'@trivago/prettier-plugin-sort-imports': '*'
|
||||||
|
'@zackad/prettier-plugin-twig-melody': '*'
|
||||||
|
prettier: ^3.0
|
||||||
|
prettier-plugin-astro: '*'
|
||||||
|
prettier-plugin-css-order: '*'
|
||||||
|
prettier-plugin-import-sort: '*'
|
||||||
|
prettier-plugin-jsdoc: '*'
|
||||||
|
prettier-plugin-marko: '*'
|
||||||
|
prettier-plugin-multiline-arrays: '*'
|
||||||
|
prettier-plugin-organize-attributes: '*'
|
||||||
|
prettier-plugin-organize-imports: '*'
|
||||||
|
prettier-plugin-sort-imports: '*'
|
||||||
|
prettier-plugin-style-order: '*'
|
||||||
|
prettier-plugin-svelte: '*'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@ianvs/prettier-plugin-sort-imports':
|
||||||
|
optional: true
|
||||||
|
'@prettier/plugin-pug':
|
||||||
|
optional: true
|
||||||
|
'@shopify/prettier-plugin-liquid':
|
||||||
|
optional: true
|
||||||
|
'@trivago/prettier-plugin-sort-imports':
|
||||||
|
optional: true
|
||||||
|
'@zackad/prettier-plugin-twig-melody':
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-astro:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-css-order:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-import-sort:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-jsdoc:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-marko:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-multiline-arrays:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-organize-attributes:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-organize-imports:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-sort-imports:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-style-order:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-svelte:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
prettier@3.4.1:
|
||||||
|
resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
pretty-bytes@6.1.1:
|
pretty-bytes@6.1.1:
|
||||||
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
||||||
engines: {node: ^14.13.1 || >=16.0.0}
|
engines: {node: ^14.13.1 || >=16.0.0}
|
||||||
@@ -7257,6 +7323,12 @@ snapshots:
|
|||||||
picocolors: 1.1.1
|
picocolors: 1.1.1
|
||||||
source-map-js: 1.2.1
|
source-map-js: 1.2.1
|
||||||
|
|
||||||
|
prettier-plugin-tailwindcss@0.6.9(prettier@3.4.1):
|
||||||
|
dependencies:
|
||||||
|
prettier: 3.4.1
|
||||||
|
|
||||||
|
prettier@3.4.1: {}
|
||||||
|
|
||||||
pretty-bytes@6.1.1: {}
|
pretty-bytes@6.1.1: {}
|
||||||
|
|
||||||
process-nextick-args@2.0.1: {}
|
process-nextick-args@2.0.1: {}
|
||||||
|
|||||||
Generated
+1
-1
@@ -1227,7 +1227,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.2.9"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"planif",
|
"planif",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.2.9"
|
version = "1.3.0"
|
||||||
homepage = "https://github.com/EasyTier/EasyTier"
|
homepage = "https://github.com/EasyTier/EasyTier"
|
||||||
repository = "https://github.com/EasyTier/EasytierGame"
|
repository = "https://github.com/EasyTier/EasytierGame"
|
||||||
description = "A simple network initiator based on Easytier"
|
description = "A simple network initiator based on Easytier"
|
||||||
@@ -34,7 +34,7 @@ tauri = { version = "2.1.1", features = [
|
|||||||
tauri-plugin-log = "2.0.2"
|
tauri-plugin-log = "2.0.2"
|
||||||
tauri-plugin-shell = "2.0.2"
|
tauri-plugin-shell = "2.0.2"
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
zip = "2.2.0"
|
zip = "2.2"
|
||||||
sysinfo = '0.32.0'
|
sysinfo = '0.32.0'
|
||||||
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"
|
whoami = "1.5.2"
|
||||||
@@ -47,7 +47,7 @@ tokio = { version = "1.41.1", features = ["process"] }
|
|||||||
|
|
||||||
[dependencies.windows]
|
[dependencies.windows]
|
||||||
version = "0.58.0"
|
version = "0.58.0"
|
||||||
features = ["Win32_System_TaskScheduler"]
|
features = ["Win32_System_TaskScheduler", "Win32_System_Power"]
|
||||||
|
|
||||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||||
tauri-plugin-cli = "2"
|
tauri-plugin-cli = "2"
|
||||||
|
|||||||
+26
-1
@@ -20,8 +20,31 @@ use windows::Win32::Foundation::VARIANT_BOOL;
|
|||||||
use windows::Win32::System::Com::*;
|
use windows::Win32::System::Com::*;
|
||||||
use windows::Win32::System::TaskScheduler::*;
|
use windows::Win32::System::TaskScheduler::*;
|
||||||
|
|
||||||
|
use windows::Win32::System::Power::SetThreadExecutionState;
|
||||||
|
use windows::Win32::System::Power::ES_CONTINUOUS;
|
||||||
|
use windows::Win32::System::Power::ES_SYSTEM_REQUIRED;
|
||||||
|
use windows::Win32::System::Power::EXECUTION_STATE;
|
||||||
|
|
||||||
use tokio::process::Command as tokioCommand;
|
use tokio::process::Command as tokioCommand;
|
||||||
|
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
fn prevent_sleep() -> bool {
|
||||||
|
unsafe {
|
||||||
|
let result = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||||
|
result != EXECUTION_STATE(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
fn allow_sleep() -> bool {
|
||||||
|
unsafe {
|
||||||
|
let result = SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
|
result != EXECUTION_STATE(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 定义GitHub Release的结构体
|
// 定义GitHub Release的结构体
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Release {
|
pub struct Release {
|
||||||
@@ -626,7 +649,9 @@ pub fn run() {
|
|||||||
search_pid_by_pname,
|
search_pid_by_pname,
|
||||||
get_exe_directory,
|
get_exe_directory,
|
||||||
spawn_autostart,
|
spawn_autostart,
|
||||||
autostart_is_enabled
|
autostart_is_enabled,
|
||||||
|
prevent_sleep,
|
||||||
|
allow_sleep
|
||||||
])
|
])
|
||||||
.run(context)
|
.run(context)
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"productName": "easytier-game",
|
"productName": "easytier-game",
|
||||||
"version": "1.2.9",
|
"version": "1.3.0",
|
||||||
"identifier": "com.tauri.easytier-game",
|
"identifier": "com.tauri.easytier-game",
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "easytier-game 1.2.9",
|
"title": "easytier-game 1.3.0",
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"minWidth": 340,
|
"minWidth": 340,
|
||||||
"width": 340,
|
"width": 340,
|
||||||
|
|||||||
+2
-1
@@ -34,7 +34,8 @@ export default defineStore("main", {
|
|||||||
enableCustonProtocol: false, //自定义默认协议
|
enableCustonProtocol: false, //自定义默认协议
|
||||||
customProtocol: "tcp", //自定义默认协议
|
customProtocol: "tcp", //自定义默认协议
|
||||||
enableNetCardMetric: false, //启用网卡自定义跃点
|
enableNetCardMetric: false, //启用网卡自定义跃点
|
||||||
netCardMetricValue: 1 //自定义网卡跃点值
|
netCardMetricValue: 1, //自定义网卡跃点值
|
||||||
|
enablePreventSleep: false, //组织系统休眠
|
||||||
},
|
},
|
||||||
serverConfig: {
|
serverConfig: {
|
||||||
enableWhiteList: true, // 是否启用白名单
|
enableWhiteList: true, // 是否启用白名单
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
import { open } from "@tauri-apps/plugin-shell";
|
||||||
export const ENV = import.meta.env;
|
export const ENV = import.meta.env;
|
||||||
|
|
||||||
@@ -70,6 +71,21 @@ export const supportProtocols = () => {
|
|||||||
return _supportProtocols.slice();
|
return _supportProtocols.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _prevent_timer: NodeJS.Timeout| null = null;
|
||||||
|
let _prevent_timer_count = 30; // 秒
|
||||||
|
export const preventSleep = () => {
|
||||||
|
_prevent_timer && clearInterval(_prevent_timer);
|
||||||
|
_prevent_timer = setInterval(async () => {
|
||||||
|
const result = await invoke('prevent_sleep');
|
||||||
|
// console.log(`trigger prevent sleep ${result}`);
|
||||||
|
}, _prevent_timer_count * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const stopPreventSleep = () => {
|
||||||
|
_prevent_timer && clearInterval(_prevent_timer);
|
||||||
|
_prevent_timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
export const parsePeerInfo = (content: string) => {
|
export const parsePeerInfo = (content: string) => {
|
||||||
if(!content) return [];
|
if(!content) return [];
|
||||||
// 将表格字符串分割成行
|
// 将表格字符串分割成行
|
||||||
|
|||||||
Reference in New Issue
Block a user