Compare commits

..

4 Commits

Author SHA1 Message Date
c1d81b9af5 🎨 2024-06-07 10:10:24 +08:00
36951a5bb8 🐛fix a bug 2024-06-07 09:54:30 +08:00
911bc95b16 🎨下线客户端后刷新客户端链接列表 2024-06-07 09:06:11 +08:00
b1b49e2605 🎨修复下线客户端bug 2024-06-07 08:47:47 +08:00
5 changed files with 24 additions and 13 deletions

View File

@@ -79,7 +79,7 @@ func asyncWireguardConfigFile() {
var renderClients []template_data.Client
for _, v := range serverEnt.Clients {
// 如果不是确认后创建或者未启用就不写入到wireguard配置文件当中
if *v.EnableAfterCreation != 1 || *v.Enabled != 1 {
if *v.Enabled != 1 {
continue
}
var clientKey template_data.Keys

View File

@@ -229,5 +229,5 @@ func (r clientRepo) GetByPublicKey(publicKey string) (data entity.Client, err er
// @param id
// @return err
func (r clientRepo) Disabled(id string) (err error) {
return r.Model(&entity.Client{}).Where("id = ?", id).Update("status", 0).Error
return r.Model(&entity.Client{}).Where("id = ?", id).Update("enabled", 0).Error
}

View File

@@ -132,6 +132,7 @@ const getRule = () => {
rule.value = res.data.rule === "hand";
}
});
storageLocal().setItem("restart-rule", rule.value);
return rule;
};

View File

@@ -2,9 +2,9 @@
import { useServerStoreHook } from "@/store/modules/server";
import { getSystemLog } from "@/api/dashboard";
import { reactive } from "vue";
import {getClientConnects, offlineClient} from "@/api/clients";
import {Refresh} from "@element-plus/icons-vue";
import {message} from "@/utils/message";
import { getClientConnects, offlineClient } from "@/api/clients";
import { Refresh } from "@element-plus/icons-vue";
import { message } from "@/utils/message";
defineOptions({
name: "Dashboard"
@@ -71,6 +71,7 @@ const offlineClientHandler = (clientID: string) => {
offlineClient(clientID).then(res => {
if (res.code === 200) {
message("下线客户端成功", { type: "success" });
getClientsStatus();
}
});
};
@@ -86,7 +87,13 @@ getClientsStatus();
<template #header>
<div class="card-header">
<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>
</template>
<el-table
@@ -193,7 +200,13 @@ getClientsStatus();
<template #header>
<div class="card-header">
<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>
</template>
<el-table
@@ -255,11 +268,7 @@ getClientsStatus();
min-width="80"
align="center"
/>
<el-table-column
label="操作"
min-width="80"
align="center"
>
<el-table-column label="操作" min-width="80" align="center">
<template #default="scope">
<el-button
v-if="scope.row.isOnline"

View File

@@ -151,6 +151,7 @@ const openAddClientDialog = () => {
}
});
const serverInfo = storageLocal().getItem("server-info");
const restartRule = storageLocal().getItem("restart-rule") ? 1 : 0;
addDialog({
width: "40%",
title: "新增",
@@ -167,7 +168,7 @@ const openAddClientDialog = () => {
extraAllowedIPS: "",
endpoint: "",
useServerDNS: 0,
enableAfterCreation: 0,
enableAfterCreation: restartRule,
keys: {
privateKey: "",
publicKey: "",