|
|
|
@@ -24,16 +24,22 @@ module.exports = async (ctx) => {
|
|
|
|
const result = await ins.post("/panel/api/inbounds/addClient", {id, settings: JSON.stringify(settings)});
|
|
|
|
const result = await ins.post("/panel/api/inbounds/addClient", {id, settings: JSON.stringify(settings)});
|
|
|
|
if (result?.success) {
|
|
|
|
if (result?.success) {
|
|
|
|
const {remark, port, protocol, streamSettings = "{}"} = inbound.obj || {};
|
|
|
|
const {remark, port, protocol, streamSettings = "{}"} = inbound.obj || {};
|
|
|
|
const {
|
|
|
|
const setting = JSON.parse(streamSettings || "{}"), {network = "ws", security = "none"} = setting;
|
|
|
|
network = "ws",
|
|
|
|
if (network === "ws") {
|
|
|
|
security = "none",
|
|
|
|
const {wsSettings: {host, path}} = setting
|
|
|
|
wsSettings: { host, path },
|
|
|
|
|
|
|
|
} = JSON.parse(streamSettings);
|
|
|
|
|
|
|
|
ctx.body = {
|
|
|
|
ctx.body = {
|
|
|
|
code: "0",
|
|
|
|
code: "0", message: "success",
|
|
|
|
data: `${protocol}://${uuid}@vless.jjcp52.com:${port}?type=${network}&path=${path}&host=${host}&security=${security}#${remark}-${email}`,
|
|
|
|
data: `${protocol}://${uuid}@vless.jjcp52.com:${port}?type=${network}&path=${path}&host=${host}&security=${security}#${remark}-${email}`,
|
|
|
|
message: "success",
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} else if (network === "tcp") {
|
|
|
|
|
|
|
|
// 生成的链接格式 vless://842f52b6-4945-46c8-89ed-165bf51123fc@206.237.11.232:34261?type=tcp&security=reality&pbk=3-yeUp9rz5KacCLJqaLt_rHUY_6EKw6tveLpVB2hxQI&fp=random&sni=yahoo.com&sid=0f7f86d03b646595&spx=%2F#temu-reality-kubbo
|
|
|
|
|
|
|
|
const {serverNames: [sni], shortIds: [sid], settings: {publicKey, fingerprint, spiderX}} = (setting.realitySettings || {})
|
|
|
|
|
|
|
|
ctx.body = {
|
|
|
|
|
|
|
|
code: "0", message: "success",
|
|
|
|
|
|
|
|
data: `${protocol}://${uuid}@vless.jjcp52.com:${port}?type=${network}&security=${security}&pbk=${publicKey}&fp=${fingerprint}&sni=${sni}&sid=${sid}&spx=${spiderX}#${remark}-${email}`,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ctx.body = {
|
|
|
|
ctx.body = {
|
|
|
|
code: 1,
|
|
|
|
code: 1,
|
|
|
|
|