diff --git a/api/client/add.js b/api/client/add.js index 31974a8..b6935ed 100644 --- a/api/client/add.js +++ b/api/client/add.js @@ -2,7 +2,6 @@ const { randomUUID } = require("crypto"); const ins = require("../../utils/http"); const dayjs = require("dayjs"); const getCookie = require("../../auth/3xuiLogin"); -const { log } = require("console"); module.exports = async (ctx) => { let { id = 4, limitIp, expiryTime = 0, enable = !0, totalGB = 1, subId = "2rv0gb458kbfl532", email } = ctx.request.body; diff --git a/api/client/status.js b/api/client/status.js new file mode 100644 index 0000000..5bffde1 --- /dev/null +++ b/api/client/status.js @@ -0,0 +1,19 @@ +const getCookie = require("../../auth/3xuiLogin"); +const instance = require("../../utils/http"); + +module.exports = async (ctx) => { + let { id } = ctx.request.query; + if (!ctx.state.cookie) { + ctx.state.cookie = await getCookie(); + instance.interceptors.request.use((config) => { + config.headers.Cookie = ctx.state.cookie; + return config; + }); + } + const status = await instance.get(`/panel/api/inbounds/getClientTrafficsById/${id}`); + ctx.body = { + code: 0, + data: status.obj?.[0] || {}, + msg: "success", + }; +};