diff --git a/.env b/.env index 50a7579..f336828 100644 --- a/.env +++ b/.env @@ -4,4 +4,3 @@ VITE_PORT = 8848 # 是否隐藏首页 隐藏 true 不隐藏 false (勿删除,VITE_HIDE_HOME只需在.env文件配置) VITE_HIDE_HOME = false -VITE_PUBLIC_PATH = // diff --git a/.env.development b/.env.development index fc93654..90d1146 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ VITE_PORT = 8848 # 开发环境读取配置文件路径 -VITE_PUBLIC_PATH = // +VITE_PUBLIC_PATH = / # 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数") VITE_ROUTER_HISTORY = "hash" diff --git a/app/static.go b/app/static.go deleted file mode 100644 index 3b49155..0000000 --- a/app/static.go +++ /dev/null @@ -1,6 +0,0 @@ -package web - -import "embed" - -//go:embed index.html logo.svg favicon.ico platform-config.json public/platform-config.json static assets -var Static embed.FS diff --git a/src/api/clients.ts b/src/api/clients.ts index b10a7dc..ebf771e 100644 --- a/src/api/clients.ts +++ b/src/api/clients.ts @@ -13,6 +13,16 @@ export const downloadClient = (id: string) => { }); }; +// 客户端IP生成 +export const generateClientIP = (data?: object) => { + return http.request("post", baseUri("/client/assignIP"), { data }); +}; + +// 生成客户端密钥对 +export const generateClientKeys = () => { + return http.request("post", baseUri("/client/generate-keys")); +}; + // 获取客户端配置二维码 export const clientQrCode = (id: string) => { return http.request("post", baseUri("/client/generate-qrcode/" + id)); @@ -32,3 +42,8 @@ export const deleteClient = (id: string) => { export const getClientConnects = () => { return http.request("get", baseUri("/client/status")); }; + +// 强制下线客户端 +export const offlineClient = (id: string) => { + return http.request("post", baseUri("/client/offline/" + id)); +}; diff --git a/src/api/server.ts b/src/api/server.ts index fe1fcbd..a18283b 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -25,3 +25,15 @@ export const updateGlobalSetting = (data?: object) => { export const getPublicIP = () => { return http.request("get", baseUri("/setting/public-ip")); }; + +// 获取服务端重启规则 +export const getServerRestartRule = () => { + return http.request("get", baseUri("/setting/restart-rule")); +}; + +// 重启服务端 +export const restartServer = (data?: object) => { + return http.request("post", baseUri("/server/control-server"), { + data + }); +}; diff --git a/src/layout/components/lay-navbar/index.vue b/src/layout/components/lay-navbar/index.vue index 3bf2a9b..53c3b11 100644 --- a/src/layout/components/lay-navbar/index.vue +++ b/src/layout/components/lay-navbar/index.vue @@ -24,6 +24,9 @@ import changePwdForms, { } from "./component/change-password.vue"; import { useRouter } from "vue-router"; import useGetGlobalProperties from "@/hooks/useGetGlobalProperties"; +import { Refresh } from "@element-plus/icons-vue"; +import { getServerRestartRule, restartServer } from "@/api/server"; +import { message } from "@/utils/message"; const { layout, @@ -121,6 +124,29 @@ const openChangePasswordDialog = () => { } }); }; +let rule = ref(false); +// 判断是否展示重载配置按钮 +const getRule = () => { + getServerRestartRule().then(res => { + if (res.code === 200) { + rule.value = res.data.rule === "hand"; + } + }); + return rule; +}; + +// 重启服务端 +const restartServerCommand = () => { + restartServer({ + status: "RESTART" + }).then(res => { + if (res.code === 200) { + message("应用配置成功", { type: "success" }); + } + }); +}; + +getRule(); + > + + + + + diff --git a/src/views/server/clients.vue b/src/views/server/clients.vue index 67a2d3b..5522ca3 100644 --- a/src/views/server/clients.vue +++ b/src/views/server/clients.vue @@ -1,7 +1,7 @@ @@ -132,6 +141,32 @@ defineExpose({ getDetailFormRef }); + + + + + + + + + + + + + + 生成密钥对 + diff --git a/src/views/server/server.vue b/src/views/server/server.vue index 4427803..85bcade 100644 --- a/src/views/server/server.vue +++ b/src/views/server/server.vue @@ -5,6 +5,7 @@ import { useServerStoreHook } from "@/store/modules/server"; import { serverFormRules } from "@/views/server/utils/rules"; import { useGlobalSettingStoreHook } from "@/store/modules/globalSetting"; import { getPublicIP } from "@/api/server"; +import { useUserStoreHook } from "@/store/modules/user"; defineOptions({ // name 作为一种规范最好必须写上并且和路由的name保持一致 @@ -113,6 +114,10 @@ const getPublicIPApi = () => { }); }; +const isEditServerKeys = () => { + return useUserStoreHook().isAdmin && useUserStoreHook().account === "admin"; +}; + getServerApi(); getGlobalSettingApi(); @@ -144,10 +149,18 @@ getGlobalSettingApi(); /> - + + - + +