Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
92f5f26ad5 | |||
97e6e80d5a | |||
0d28bd3445 | |||
c1d81b9af5 | |||
36951a5bb8 |
@@ -373,7 +373,7 @@ func (clients) Status(c *gin.Context) {
|
|||||||
ipAllocation += iaip.String() + ","
|
ipAllocation += iaip.String() + ","
|
||||||
}
|
}
|
||||||
ipAllocation = strings.TrimRight(ipAllocation, ",")
|
ipAllocation = strings.TrimRight(ipAllocation, ",")
|
||||||
isOnline := time.Since(p.LastHandshakeTime).Minutes() < 1
|
isOnline := time.Since(p.LastHandshakeTime).Minutes() < 3
|
||||||
data = append(data, vo.ClientStatus{
|
data = append(data, vo.ClientStatus{
|
||||||
ID: clientInfo.Id,
|
ID: clientInfo.Id,
|
||||||
Name: clientInfo.Name,
|
Name: clientInfo.Name,
|
||||||
|
@@ -79,7 +79,7 @@ func asyncWireguardConfigFile() {
|
|||||||
var renderClients []template_data.Client
|
var renderClients []template_data.Client
|
||||||
for _, v := range serverEnt.Clients {
|
for _, v := range serverEnt.Clients {
|
||||||
// 如果不是确认后创建或者未启用就不写入到wireguard配置文件当中
|
// 如果不是确认后创建或者未启用就不写入到wireguard配置文件当中
|
||||||
if *v.EnableAfterCreation != 1 || *v.Enabled != 1 {
|
if *v.Enabled != 1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var clientKey template_data.Keys
|
var clientKey template_data.Keys
|
||||||
|
@@ -59,6 +59,8 @@ func (r server) Update(p param.SaveServer) (err error) {
|
|||||||
"post_up_script": p.PostUpScript,
|
"post_up_script": p.PostUpScript,
|
||||||
"pre_down_script": p.PreDownScript,
|
"pre_down_script": p.PreDownScript,
|
||||||
"post_down_script": p.PostDownScript,
|
"post_down_script": p.PostDownScript,
|
||||||
|
"private_key": p.PrivateKey,
|
||||||
|
"public_key": p.PublicKey,
|
||||||
}
|
}
|
||||||
return r.Model(&entity.Server{}).Where("id = ?", p.Id).Updates(&update).Error
|
return r.Model(&entity.Server{}).Where("id = ?", p.Id).Updates(&update).Error
|
||||||
}
|
}
|
||||||
|
@@ -132,6 +132,7 @@ const getRule = () => {
|
|||||||
rule.value = res.data.rule === "hand";
|
rule.value = res.data.rule === "hand";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
storageLocal().setItem("restart-rule", rule.value);
|
||||||
return rule;
|
return rule;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
import { useServerStoreHook } from "@/store/modules/server";
|
import { useServerStoreHook } from "@/store/modules/server";
|
||||||
import { getSystemLog } from "@/api/dashboard";
|
import { getSystemLog } from "@/api/dashboard";
|
||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
import {getClientConnects, offlineClient} from "@/api/clients";
|
import { getClientConnects, offlineClient } from "@/api/clients";
|
||||||
import {Refresh} from "@element-plus/icons-vue";
|
import { Refresh } from "@element-plus/icons-vue";
|
||||||
import {message} from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "Dashboard"
|
name: "Dashboard"
|
||||||
@@ -87,7 +87,13 @@ getClientsStatus();
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>操作日志</span>
|
<span>操作日志</span>
|
||||||
<el-button style="float: right" type="primary" :icon="Refresh" @click="refreshClick('systemLog')">刷新</el-button>
|
<el-button
|
||||||
|
style="float: right"
|
||||||
|
type="primary"
|
||||||
|
:icon="Refresh"
|
||||||
|
@click="refreshClick('systemLog')"
|
||||||
|
>刷新</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -194,7 +200,13 @@ getClientsStatus();
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>客户端链接状态</span>
|
<span>客户端链接状态</span>
|
||||||
<el-button style="float: right" type="primary" :icon="Refresh" @click="refreshClick('clientStatus')">刷新</el-button>
|
<el-button
|
||||||
|
style="float: right"
|
||||||
|
type="primary"
|
||||||
|
:icon="Refresh"
|
||||||
|
@click="refreshClick('clientStatus')"
|
||||||
|
>刷新</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -256,11 +268,7 @@ getClientsStatus();
|
|||||||
min-width="80"
|
min-width="80"
|
||||||
align="center"
|
align="center"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column label="操作" min-width="80" align="center">
|
||||||
label="操作"
|
|
||||||
min-width="80"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.isOnline"
|
v-if="scope.row.isOnline"
|
||||||
|
@@ -151,6 +151,7 @@ const openAddClientDialog = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const serverInfo = storageLocal().getItem("server-info");
|
const serverInfo = storageLocal().getItem("server-info");
|
||||||
|
const restartRule = storageLocal().getItem("restart-rule") ? 1 : 0;
|
||||||
addDialog({
|
addDialog({
|
||||||
width: "40%",
|
width: "40%",
|
||||||
title: "新增",
|
title: "新增",
|
||||||
@@ -167,7 +168,7 @@ const openAddClientDialog = () => {
|
|||||||
extraAllowedIPS: "",
|
extraAllowedIPS: "",
|
||||||
endpoint: "",
|
endpoint: "",
|
||||||
useServerDNS: 0,
|
useServerDNS: 0,
|
||||||
enableAfterCreation: 0,
|
enableAfterCreation: restartRule,
|
||||||
keys: {
|
keys: {
|
||||||
privateKey: "",
|
privateKey: "",
|
||||||
publicKey: "",
|
publicKey: "",
|
||||||
@@ -308,10 +309,10 @@ getClientsApi(clientSearchForm.value);
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-card body-style="padding: inherit" shadow="hover">
|
<el-card body-style="padding: inherit" shadow="hover">
|
||||||
<div class="flex flex-wrap gap-4">
|
<div class="flex flex-wrap gap-4" style="display: flex;justify-content: center;">
|
||||||
<el-card
|
<el-card
|
||||||
v-for="val in clientsList.data"
|
v-for="val in clientsList.data"
|
||||||
style="width: 540px"
|
style="float: left; width: 500px"
|
||||||
shadow="hover"
|
shadow="hover"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
|
Reference in New Issue
Block a user