Fixed some minor issues
This commit is contained in:
parent
a45f17c1dc
commit
8b86a6e0b8
@ -488,6 +488,10 @@
|
|||||||
<a-tag :style="{ margin: '0', padding: '0 2px' }" color="blue" v-if="clientCount[dbInbound.id].online.length">[[ clientCount[dbInbound.id].online.length ]]</a-tag>
|
<a-tag :style="{ margin: '0', padding: '0 2px' }" color="blue" v-if="clientCount[dbInbound.id].online.length">[[ clientCount[dbInbound.id].online.length ]]</a-tag>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
|
<template slot="deviceLimit" slot-scope="text, dbInbound">
|
||||||
|
<span v-if="dbInbound.deviceLimit > 0">[[ dbInbound.deviceLimit ]]</span>
|
||||||
|
<span v-else>{{ i18n "pages.inbounds.unlimited" }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template slot="traffic" slot-scope="text, dbInbound">
|
<template slot="traffic" slot-scope="text, dbInbound">
|
||||||
<a-popover :overlay-class-name="themeSwitcher.currentTheme">
|
<a-popover :overlay-class-name="themeSwitcher.currentTheme">
|
||||||
@ -819,11 +823,13 @@
|
|||||||
width: 40,
|
width: 40,
|
||||||
scopedSlots: { customRender: 'clients' },
|
scopedSlots: { customRender: 'clients' },
|
||||||
}, {
|
}, {
|
||||||
|
// 【中文注释】: 这是修改后的“设备限制”列定义
|
||||||
title: '{{ i18n "pages.inbounds.deviceLimit" }}',
|
title: '{{ i18n "pages.inbounds.deviceLimit" }}',
|
||||||
dataIndex: "deviceLimit",
|
dataIndex: "deviceLimit",
|
||||||
align: "center",
|
align: "center",
|
||||||
width: 40,
|
width: 40,
|
||||||
customRender: (text) => (text > 0 ? text : {{ i18n "pages.inbounds.unlimited" }}),
|
// 【中文注释】: 将错误的 customRender 改为 scopedSlots
|
||||||
|
scopedSlots: { customRender: 'deviceLimit' },
|
||||||
}, {
|
}, {
|
||||||
title: '{{ i18n "pages.inbounds.traffic" }}',
|
title: '{{ i18n "pages.inbounds.traffic" }}',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@ -967,16 +973,32 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// 【中文注释】:这是唯一且正确的 mounted 钩子。
|
||||||
|
// 【修改】:将两个 mounted 钩子的逻辑合并到这里。
|
||||||
|
|
||||||
|
// 检查非 https 协议,用于安全提示
|
||||||
|
if (window.location.protocol !== "https:") {
|
||||||
|
this.showAlert = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化面板设置和入站列表
|
||||||
this.getDefaultSettings();
|
this.getDefaultSettings();
|
||||||
if (this.isRefreshEnabled) {
|
if (this.isRefreshEnabled) {
|
||||||
this.startDataRefreshLoop();
|
this.startDataRefreshLoop();
|
||||||
} else {
|
} else {
|
||||||
this.getDBInbounds();
|
this.getDBInbounds();
|
||||||
}
|
}
|
||||||
// 【新增】: 从本地存储加载历史记录
|
|
||||||
|
// 【修正】:从本地存储加载“一键配置”的历史记录
|
||||||
const history = localStorage.getItem('oneClickLinkHistory');
|
const history = localStorage.getItem('oneClickLinkHistory');
|
||||||
if (history) {
|
if (history) {
|
||||||
this.linkHistory = JSON.parse(history);
|
try {
|
||||||
|
this.linkHistory = JSON.parse(history);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("无法解析历史记录:", e);
|
||||||
|
// 如果解析失败,清空错误的记录
|
||||||
|
localStorage.removeItem('oneClickLinkHistory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1244,10 +1266,10 @@
|
|||||||
// 随机生成 10000-55535 之间的端口
|
// 随机生成 10000-55535 之间的端口
|
||||||
const port = Math.floor(Math.random() * (55535 - 10000 + 1)) + 10000;
|
const port = Math.floor(Math.random() * (55535 - 10000 + 1)) + 10000;
|
||||||
|
|
||||||
// 【中文注释】: 从预设列表中随机选择一个SNI
|
// 【中文注释】: 从预设列表中随机选择一个SNI
|
||||||
const randomDest = this.realityDestinations[Math.floor(Math.random() * this.realityDestinations.length)];
|
const randomDest = this.realityDestinations[Math.floor(Math.random() * this.realityDestinations.length)];
|
||||||
|
|
||||||
// 从 randomDest (例如 'microsoft.com:443') 中提取出域名 ('microsoft.com')
|
// 从 randomDest (例如 'microsoft.com:443') 中提取出域名 ('microsoft.com')
|
||||||
const randomSni = randomDest.split(':')[0];
|
const randomSni = randomDest.split(':')[0];
|
||||||
|
|
||||||
// 【随机生成】: 调用新的函数 generateShortIds()
|
// 【随机生成】: 调用新的函数 generateShortIds()
|
||||||
@ -1269,7 +1291,8 @@
|
|||||||
id: uuid, // 【中文注释】: 使用后端生成的 UUID
|
id: uuid, // 【中文注释】: 使用后端生成的 UUID
|
||||||
flow: "xtls-rprx-vision",
|
flow: "xtls-rprx-vision",
|
||||||
email: remark,
|
email: remark,
|
||||||
level: 0
|
level: 0,
|
||||||
|
enable: true
|
||||||
}],
|
}],
|
||||||
decryption: "none",
|
decryption: "none",
|
||||||
fallbacks: []
|
fallbacks: []
|
||||||
@ -1279,7 +1302,7 @@
|
|||||||
security: "reality",
|
security: "reality",
|
||||||
realitySettings: {
|
realitySettings: {
|
||||||
show: false,
|
show: false,
|
||||||
target: randomDest,
|
dest: randomDest,
|
||||||
xver: 0,
|
xver: 0,
|
||||||
serverNames: [ randomSni, `www.${randomSni}` ],
|
serverNames: [ randomSni, `www.${randomSni}` ],
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
@ -1385,7 +1408,8 @@
|
|||||||
id: uuid, // 【中文注释】: 使用后端生成的 UUID
|
id: uuid, // 【中文注释】: 使用后端生成的 UUID
|
||||||
flow: "xtls-rprx-vision",
|
flow: "xtls-rprx-vision",
|
||||||
email: remark,
|
email: remark,
|
||||||
level: 0
|
level: 0,
|
||||||
|
enable: true
|
||||||
}],
|
}],
|
||||||
decryption: decryption, // 使用从 API 获取的 decryption
|
decryption: decryption, // 使用从 API 获取的 decryption
|
||||||
encryption: encryption, // 【重要】: 加上 encryption 参数
|
encryption: encryption, // 【重要】: 加上 encryption 参数
|
||||||
@ -1879,16 +1903,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getInboundClients(dbInbound) {
|
getInboundClients(dbInbound) {
|
||||||
// 先把 dbInbound 转成 inbound 对象
|
return dbInbound.toInbound().clients;
|
||||||
const inbound = dbInbound.toInbound();
|
|
||||||
const clients = inbound.clients || [];
|
|
||||||
|
|
||||||
// 遍历 clients,保证 speedLimit 字段存在且是数字
|
|
||||||
return clients.map(c => ({
|
|
||||||
...c, // 保留原有字段
|
|
||||||
speedLimit: Number(c.speedLimit ?? 0), // 如果没设置就默认为 0
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetClientTraffic(client, dbInboundId, confirmation = true) {
|
resetClientTraffic(client, dbInboundId, confirmation = true) {
|
||||||
if (confirmation){
|
if (confirmation){
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
@ -2141,20 +2158,6 @@
|
|||||||
this.searchInbounds(newVal);
|
this.searchInbounds(newVal);
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
if (window.location.protocol !== "https:") {
|
|
||||||
this.showAlert = true;
|
|
||||||
}
|
|
||||||
this.loading();
|
|
||||||
this.getDefaultSettings();
|
|
||||||
if (this.isRefreshEnabled) {
|
|
||||||
this.startDataRefreshLoop();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.getDBInbounds();
|
|
||||||
}
|
|
||||||
this.loading(false);
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
total() {
|
total() {
|
||||||
let down = 0, up = 0, allTime = 0;
|
let down = 0, up = 0, allTime = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user