From d13b80611cd5b05420dd3e4cce28dee8dd9d7e1c Mon Sep 17 00:00:00 2001 From: Kubbo <390378816@qq.com> Date: Fri, 7 Mar 2025 20:28:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api/client):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在请求体中增加 uuid 参数 - 如果请求体中提供了 uuid,则使用该值,否则生成新的 UUID - 优化 email 的生成逻辑,使用 UUID 的第一部分作为用户名 --- api/client/add.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/client/add.js b/api/client/add.js index 607b23a..cb9644d 100644 --- a/api/client/add.js +++ b/api/client/add.js @@ -4,7 +4,7 @@ const dayjs = require("dayjs"); const getCookie = require("../../auth/3xuiLogin"); module.exports = async (ctx) => { - let { id = 4, limitIp, expiryTime = 0, enable = !0, totalGB = 1, subId = "2rv0gb458kbfl532", email } = ctx.request.body; + let { id = 4, limitIp, expiryTime = 0, enable = !0, totalGB = 1, subId = "2rv0gb458kbfl532", email, uuid } = ctx.request.body; if (!ctx.state.cookie) { ctx.state.cookie = await getCookie(); ins.interceptors.request.use((config) => { @@ -14,7 +14,7 @@ module.exports = async (ctx) => { } const inbound = await ins.get(`/panel/api/inbounds/get/${id}`); if (!inbound?.success) return (ctx.body = { code: "1", msg: "获取节点失败" }); - const uuid = randomUUID(); + uuid = uuid || randomUUID(); email = email || uuid.split("-")[0]; if (expiryTime != 0) { expiryTime = dayjs(expiryTime, "YYYY-MM-DD HH:mm:ss").valueOf();