mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
自建服务器功能重写: 基础配置
This commit is contained in:
+39
-50
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElForm
|
<ElForm
|
||||||
v-if="!mainStore.enableCreateServer"
|
|
||||||
size="small"
|
size="small"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
:model="config"
|
:model="config"
|
||||||
@@ -180,7 +179,7 @@
|
|||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</div>
|
</div>
|
||||||
</ElForm>
|
</ElForm>
|
||||||
<ElForm
|
<!-- <ElForm
|
||||||
v-else
|
v-else
|
||||||
size="small"
|
size="small"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
@@ -253,7 +252,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</ElForm>
|
</ElForm> -->
|
||||||
<div class="flex items-start mt-auto">
|
<div class="flex items-start mt-auto">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
@@ -266,15 +265,7 @@
|
|||||||
:disabled="data.startLoading || !data.coreVersion || data.update"
|
:disabled="data.startLoading || !data.coreVersion || data.update"
|
||||||
@click="handleConnection"
|
@click="handleConnection"
|
||||||
>
|
>
|
||||||
{{
|
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
||||||
!data.isStart
|
|
||||||
? mainStore.enableCreateServer
|
|
||||||
? "启动服务"
|
|
||||||
: "启动联机"
|
|
||||||
: mainStore.enableCreateServer
|
|
||||||
? "停止服务"
|
|
||||||
: "停止联机"
|
|
||||||
}}
|
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<ElDropdownMenu>
|
<ElDropdownMenu>
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
@@ -289,16 +280,14 @@
|
|||||||
>
|
>
|
||||||
分享联机相关配置
|
分享联机相关配置
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem
|
<ElDropdownItem disabled>
|
||||||
disabled
|
|
||||||
>
|
|
||||||
<ElDivider class="!h-[2px] !m-0" />
|
<ElDivider class="!h-[2px] !m-0" />
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
:icon="SetUp"
|
:icon="SetUp"
|
||||||
command="create_server"
|
command="create_server"
|
||||||
>
|
>
|
||||||
{{ mainStore.enableCreateServer ? "我要联机" : "我要开服(自建)" }}
|
我要开服(自建)
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
:icon="Tools"
|
:icon="Tools"
|
||||||
@@ -598,7 +587,7 @@
|
|||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const config = mainStore.config;
|
const config = mainStore.config;
|
||||||
// console.error(config);
|
// console.error(config);
|
||||||
const protocols = ["tcp", "udp", "ws", "wss", "wg", "quic"];
|
const protocols = ["tcp", "udp", "ws", "wss", "quic"];
|
||||||
const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
|
const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
|
||||||
logVisible: false,
|
logVisible: false,
|
||||||
cidrVisible: false,
|
cidrVisible: false,
|
||||||
@@ -1017,23 +1006,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainStore.enableCreateServer) {
|
// if (mainStore.enableCreateServer) {
|
||||||
if (config.relayAllPeerrpc) {
|
// if (config.relayAllPeerrpc) {
|
||||||
args.push("--relay-all-peer-rpc");
|
// args.push("--relay-all-peer-rpc");
|
||||||
}
|
// }
|
||||||
const whiteList = mainStore.ServerWhiteList.trim()
|
// const whiteList = mainStore.ServerWhiteList.trim()
|
||||||
.split("\n")
|
// .split("\n")
|
||||||
.map(el => el.trim())
|
// .map(el => el.trim())
|
||||||
.filter(el => el)
|
// .filter(el => el)
|
||||||
.join(" ");
|
// .join(" ");
|
||||||
if (whiteList && mainStore.enableWhiteList) {
|
// if (whiteList && mainStore.enableWhiteList) {
|
||||||
args.push("--relay-network-whitelist", whiteList);
|
// args.push("--relay-network-whitelist", whiteList);
|
||||||
}
|
// }
|
||||||
if (!whiteList && mainStore.enableWhiteList) {
|
// if (!whiteList && mainStore.enableWhiteList) {
|
||||||
args.push("--relay-network-whitelist");
|
// args.push("--relay-network-whitelist");
|
||||||
}
|
// }
|
||||||
return args;
|
// return args;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (config.dhcp) {
|
if (config.dhcp) {
|
||||||
args.push("-d");
|
args.push("-d");
|
||||||
@@ -1205,22 +1194,22 @@
|
|||||||
importConfigData.visible = true;
|
importConfigData.visible = true;
|
||||||
}
|
}
|
||||||
if (command === "create_server") {
|
if (command === "create_server") {
|
||||||
if (data.isStart) {
|
// if (data.isStart) {
|
||||||
const [error] = await ElConfirmDanger("切换会停止{action},是否继续?", "提示", {
|
// const [error] = await ElConfirmDanger("切换会停止{action},是否继续?", "提示", {
|
||||||
action: "`联机/服务`",
|
// action: "`联机/服务`",
|
||||||
confirmButtonText: "继续",
|
// confirmButtonText: "继续",
|
||||||
cancelButtonText: "取消"
|
// cancelButtonText: "取消"
|
||||||
});
|
// });
|
||||||
if (!error) await reset();
|
// if (!error) await reset();
|
||||||
}
|
// }
|
||||||
mainStore.enableCreateServer = !mainStore.enableCreateServer;
|
// mainStore.enableCreateServer = !mainStore.enableCreateServer;
|
||||||
if (mainStore.config.relayAllPeerrpc && !mainStore.enableCreateServer) {
|
// if (mainStore.config.relayAllPeerrpc && !mainStore.enableCreateServer) {
|
||||||
const [error] = await ElConfirmPrimary("是否关闭RPC流量转发?", "提示", {
|
// const [error] = await ElConfirmPrimary("是否关闭RPC流量转发?", "提示", {
|
||||||
confirmButtonText: "关闭",
|
// confirmButtonText: "关闭",
|
||||||
cancelButtonText: "取消"
|
// cancelButtonText: "取消"
|
||||||
});
|
// });
|
||||||
if (!error) mainStore.config.relayAllPeerrpc = false;
|
// if (!error) mainStore.config.relayAllPeerrpc = false;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -31,6 +31,14 @@ export default defineStore("main", {
|
|||||||
enableNetCardMetric: false, //启用网卡自定义跃点
|
enableNetCardMetric: false, //启用网卡自定义跃点
|
||||||
netCardMetricValue: 1 //自定义网卡跃点值
|
netCardMetricValue: 1 //自定义网卡跃点值
|
||||||
},
|
},
|
||||||
|
serverConfig: {
|
||||||
|
enableCreateServer: false, // 自建服务器
|
||||||
|
enableWhiteList: true, // 是否启用白名单
|
||||||
|
|
||||||
|
serverWhiteList: "", // 服务器流量转发白名单
|
||||||
|
enableListener: true, // 是否启用监听
|
||||||
|
port: "11010", // 服务器端口
|
||||||
|
},
|
||||||
cidrEnable: false,
|
cidrEnable: false,
|
||||||
basePeers: ["public.easytier.top:11010"],
|
basePeers: ["public.easytier.top:11010"],
|
||||||
theme: false, //主题 false light true dark
|
theme: false, //主题 false light true dark
|
||||||
@@ -39,9 +47,7 @@ export default defineStore("main", {
|
|||||||
winIpBcAutoStart: true,
|
winIpBcAutoStart: true,
|
||||||
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
||||||
githubFastUrl: "https://ghproxy.cc/",
|
githubFastUrl: "https://ghproxy.cc/",
|
||||||
enableCreateServer: false, // 自建服务器
|
|
||||||
enableWhiteList: true, // 是否启用白名单
|
|
||||||
ServerWhiteList: "", // 服务器流量转发白名单
|
|
||||||
|
|
||||||
winipBcPid: 0,
|
winipBcPid: 0,
|
||||||
winipBcStart: false
|
winipBcStart: false
|
||||||
@@ -86,10 +92,6 @@ export default defineStore("main", {
|
|||||||
"winIpBcAutoStart",
|
"winIpBcAutoStart",
|
||||||
"createConfigInEasytier",
|
"createConfigInEasytier",
|
||||||
"githubFastUrl",
|
"githubFastUrl",
|
||||||
|
|
||||||
"enableCreateServer",
|
|
||||||
"enableWhiteList",
|
|
||||||
"ServerWhiteList"
|
|
||||||
],
|
],
|
||||||
// // 除了这些,其他都要存下来
|
// // 除了这些,其他都要存下来
|
||||||
// omit: ["winipBcPid", "winipBcStart"]
|
// omit: ["winipBcPid", "winipBcStart"]
|
||||||
|
|||||||
Reference in New Issue
Block a user