2023-02-09 22:18:06 +03:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
{{template "head" .}}
|
|
|
|
|
<style>
|
|
|
|
|
@media (min-width: 769px) {
|
|
|
|
|
.ant-layout-content {
|
|
|
|
|
margin: 24px 16px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ant-col-sm-24 {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
}
|
2023-03-17 01:01:14 +03:00
|
|
|
|
|
|
|
|
|
.ant-table-row-expand-icon {
|
|
|
|
|
color: rgba(0,0,0,.65);
|
|
|
|
|
}
|
2023-02-09 22:18:06 +03:00
|
|
|
|
</style>
|
|
|
|
|
<body>
|
|
|
|
|
<a-layout id="app" v-cloak>
|
|
|
|
|
{{ template "commonSider" . }}
|
2023-03-17 01:01:14 +03:00
|
|
|
|
<a-layout id="content-layout" :style="siderDrawer.isDarkTheme ? bgDarkStyle : ''">
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-layout-content>
|
|
|
|
|
<a-spin :spinning="spinning" :delay="500" tip="loading">
|
|
|
|
|
<transition name="list" appear>
|
|
|
|
|
<a-tag v-if="false" color="red" style="margin-bottom: 10px">
|
|
|
|
|
Please go to the panel settings as soon as possible to modify the username and password, otherwise there may be a risk of leaking account information
|
|
|
|
|
</a-tag>
|
|
|
|
|
</transition>
|
|
|
|
|
<transition name="list" appear>
|
2023-03-17 01:01:14 +03:00
|
|
|
|
<a-card hoverable style="margin-bottom: 20px;" :class="siderDrawer.isDarkTheme ? darkClass : ''">
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-row>
|
|
|
|
|
<a-col :xs="24" :sm="24" :lg="12">
|
|
|
|
|
{{ i18n "pages.inbounds.totalDownUp" }}:
|
|
|
|
|
<a-tag color="green">[[ sizeFormat(total.up) ]] / [[ sizeFormat(total.down) ]]</a-tag>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :xs="24" :sm="24" :lg="12">
|
|
|
|
|
{{ i18n "pages.inbounds.totalUsage" }}:
|
|
|
|
|
<a-tag color="green">[[ sizeFormat(total.up + total.down) ]]</a-tag>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :xs="24" :sm="24" :lg="12">
|
|
|
|
|
{{ i18n "pages.inbounds.inboundCount" }}:
|
|
|
|
|
<a-tag color="green">[[ dbInbounds.length ]]</a-tag>
|
|
|
|
|
</a-col>
|
2023-03-17 01:01:14 +03:00
|
|
|
|
<a-col :xs="24" :sm="24" :lg="12">
|
|
|
|
|
{{ i18n "clients" }}:
|
|
|
|
|
<a-tag color="green">[[ total.clients ]]</a-tag>
|
|
|
|
|
<a-tag color="blue">{{ i18n "enabled" }} [[ total.active ]]</a-tag>
|
|
|
|
|
<a-tag color="red">{{ i18n "disabled" }} [[ total.deactive ]]</a-tag>
|
|
|
|
|
</a-col>
|
2023-02-09 22:18:06 +03:00
|
|
|
|
</a-row>
|
|
|
|
|
</a-card>
|
|
|
|
|
</transition>
|
|
|
|
|
<transition name="list" appear>
|
2023-03-17 01:01:14 +03:00
|
|
|
|
<a-card hoverable :class="siderDrawer.isDarkTheme ? darkClass : ''">
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<div slot="title">
|
|
|
|
|
<a-button type="primary" @click="openAddInbound">Add Inbound</a-button>
|
2023-02-28 22:54:29 +03:00
|
|
|
|
<a-button type="primary" @click="exportAllLinks" class="copy-btn">Export Links</a-button>
|
2023-02-09 22:18:06 +03:00
|
|
|
|
</div>
|
2023-02-12 16:50:09 +03:00
|
|
|
|
<a-input v-model.lazy="searchKey" placeholder="{{ i18n "search" }}" autofocus style="max-width: 300px"></a-input>
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-table :columns="columns" :row-key="dbInbound => dbInbound.id"
|
2023-02-12 16:50:09 +03:00
|
|
|
|
:data-source="searchedInbounds"
|
|
|
|
|
:loading="spinning" :scroll="{ x: 1300 }"
|
2023-02-09 22:18:06 +03:00
|
|
|
|
:pagination="false"
|
|
|
|
|
style="margin-top: 20px"
|
|
|
|
|
@change="() => getDBInbounds()">
|
|
|
|
|
<template slot="action" slot-scope="text, dbInbound">
|
2023-02-18 18:55:53 +03:00
|
|
|
|
<a-icon type="edit" style="font-size: 25px" @click="openEditInbound(dbInbound.id);"></a-icon>
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-dropdown :trigger="['click']">
|
|
|
|
|
<a @click="e => e.preventDefault()">{{ i18n "pages.inbounds.operate" }}</a>
|
|
|
|
|
<a-menu slot="overlay" @click="a => clickAction(a, dbInbound)">
|
2023-02-12 16:50:09 +03:00
|
|
|
|
<a-menu-item v-if="dbInbound.isSS" key="qrcode">
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-icon type="qrcode"></a-icon>
|
|
|
|
|
{{ i18n "qrCode" }}
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
<a-menu-item key="edit">
|
|
|
|
|
<a-icon type="edit"></a-icon>
|
|
|
|
|
{{ i18n "edit" }}
|
|
|
|
|
</a-menu-item>
|
2023-03-17 01:01:14 +03:00
|
|
|
|
<template v-if="dbInbound.isTrojan || dbInbound.isVLess || dbInbound.isVMess">
|
|
|
|
|
<a-menu-item key="export">
|
|
|
|
|
<a-icon type="export"></a-icon>
|
|
|
|
|
{{ i18n "pages.inbounds.export"}}
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
</template>
|
2023-02-09 22:18:06 +03:00
|
|
|
|
<a-menu-item key="resetTraffic">
|
|
|
|
|
<a-icon type="retweet"></a-icon> {{ i18n "pages.inbounds.resetTraffic" }}
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
<a-menu-item key="delete">
|
|
|
|
|
<span style="color: #FF4D4F">
|
|
|
|
|
<a-icon type="delete"></a-icon> {{ i18n "delete"}}
|
|
|
|
|
</span>
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
</a-menu>
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="protocol" slot-scope="text, dbInbound">
|
|
|
|
|
<a-tag color="blue">[[ dbInbound.protocol ]]</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="traffic" slot-scope="text, dbInbound">
|
|
|
|
|
<a-tag color="blue">[[ sizeFormat(dbInbound.up) ]] / [[ sizeFormat(dbInbound.down) ]]</a-tag>
|
|
|
|
|
<template v-if="dbInbound.total > 0">
|
|
|
|
|
<a-tag v-if="dbInbound.up + dbInbound.down < dbInbound.total" color="cyan">[[ sizeFormat(dbInbound.total) ]]</a-tag>
|
|
|
|
|
<a-tag v-else color="red">[[ sizeFormat(dbInbound.total) ]]</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<a-tag v-else color="green">{{ i18n "unlimited" }}</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="stream" slot-scope="text, dbInbound, index">
|
|
|
|
|
<template v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS">
|
|
|
|
|
<a-tag color="green">[[ inbounds[index].stream.network ]]</a-tag>
|
|
|
|
|
<a-tag v-if="inbounds[index].stream.isTls" color="blue">tls</a-tag>
|
|
|
|
|
<a-tag v-if="inbounds[index].stream.isXTls" color="blue">xtls</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>{{ i18n "none" }}</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="enable" slot-scope="text, dbInbound">
|
|
|
|
|
<a-switch v-model="dbInbound.enable" @change="switchEnable(dbInbound)"></a-switch>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="expiryTime" slot-scope="text, dbInbound">
|
|
|
|
|
<template v-if="dbInbound.expiryTime > 0">
|
|
|
|
|
<a-tag v-if="dbInbound.isExpiry" color="red">
|
|
|
|
|
[[ DateUtil.formatMillis(dbInbound.expiryTime) ]]
|
|
|
|
|
</a-tag>
|
|
|
|
|
<a-tag v-else color="blue">
|
|
|
|
|
[[ DateUtil.formatMillis(dbInbound.expiryTime) ]]
|
|
|
|
|
</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="expandedRowRender" slot-scope="record">
|
|
|
|
|
<a-table
|
2023-02-12 16:50:09 +03:00
|
|
|
|
v-if="(record.protocol === Protocols.VLESS) || (record.protocol === Protocols.VMESS)"
|
2023-02-09 22:18:06 +03:00
|
|
|
|
:row-key="client => client.id"
|
|
|
|
|
:columns="innerColumns"
|
|
|
|
|
:data-source="getInboundClients(record)"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
>
|
2023-02-12 16:50:09 +03:00
|
|
|
|
{{template "client_row"}}
|
|
|
|
|
</a-table>
|
|
|
|
|
<a-table
|
|
|
|
|
v-else-if="record.protocol === Protocols.TROJAN"
|
|
|
|
|
:row-key="client => client.id"
|
|
|
|
|
:columns="innerTrojanColumns"
|
|
|
|
|
:data-source="getInboundClients(record)"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
>
|
|
|
|
|
{{template "client_row"}}
|
|
|
|
|
</a-table>
|
|
|
|
|
<a-table
|
|
|
|
|
v-else
|
|
|
|
|
:row-key="client => client.id"
|
|
|
|
|
:columns="innerOneColumns"
|
|
|
|
|
:data-source="record"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
>
|
|
|
|
|
{{template "client_row"}}
|
2023-02-09 22:18:06 +03:00
|
|
|
|
</a-table>
|
|
|
|
|
</template>
|
|
|
|
|
</a-table>
|
|
|
|
|
</a-card>
|
|
|
|
|
</transition>
|
|
|
|
|
</a-spin>
|
|
|
|
|
</a-layout-content>
|
|
|
|
|
</a-layout>
|
|
|
|
|
</a-layout>
|
|
|
|
|
{{template "js" .}}
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
const columns = [{
|
|
|
|
|
title: '{{ i18n "pages.inbounds.operate" }}',
|
|
|
|
|
align: 'center',
|
2023-02-18 18:55:53 +03:00
|
|
|
|
width: 60,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
scopedSlots: { customRender: 'action' },
|
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.enable" }}',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 40,
|
|
|
|
|
scopedSlots: { customRender: 'enable' },
|
2023-02-18 15:37:32 +03:00
|
|
|
|
}, {
|
|
|
|
|
title: "Id",
|
|
|
|
|
align: 'center',
|
|
|
|
|
dataIndex: "id",
|
2023-02-18 18:55:53 +03:00
|
|
|
|
width: 30,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.remark" }}',
|
|
|
|
|
align: 'center',
|
2023-02-18 18:55:53 +03:00
|
|
|
|
width: 80,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
dataIndex: "remark",
|
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.protocol" }}',
|
|
|
|
|
align: 'center',
|
2023-02-18 18:55:53 +03:00
|
|
|
|
width: 50,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
scopedSlots: { customRender: 'protocol' },
|
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.port" }}',
|
|
|
|
|
align: 'center',
|
|
|
|
|
dataIndex: "port",
|
2023-02-12 16:50:09 +03:00
|
|
|
|
width: 40,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.traffic" }}↑|↓',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 150,
|
|
|
|
|
scopedSlots: { customRender: 'traffic' },
|
2023-02-12 16:50:09 +03:00
|
|
|
|
},{
|
2023-02-09 22:18:06 +03:00
|
|
|
|
title: '{{ i18n "pages.inbounds.transportConfig" }}',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 60,
|
|
|
|
|
scopedSlots: { customRender: 'stream' },
|
|
|
|
|
}, {
|
|
|
|
|
title: '{{ i18n "pages.inbounds.expireDate" }}',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 80,
|
|
|
|
|
scopedSlots: { customRender: 'expiryTime' },
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
const innerColumns = [
|
2023-02-18 15:37:32 +03:00
|
|
|
|
{ title: '', width: 70, scopedSlots: { customRender: 'actions' } },
|
|
|
|
|
{ title: '{{ i18n "pages.inbounds.client" }}', width: 60, scopedSlots: { customRender: 'client' } },
|
2023-02-18 18:55:53 +03:00
|
|
|
|
{ title: '{{ i18n "pages.inbounds.traffic" }}↑|↓', width: 100, scopedSlots: { customRender: 'traffic' } },
|
2023-02-16 18:58:20 +03:00
|
|
|
|
{ title: '{{ i18n "pages.inbounds.expireDate" }}', width: 70, scopedSlots: { customRender: 'expiryTime' } },
|
2023-03-17 01:01:14 +03:00
|
|
|
|
{ title: 'UID', width: 150, dataIndex: "id" },
|
2023-02-16 18:58:20 +03:00
|
|
|
|
|
2023-02-12 16:50:09 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const innerTrojanColumns = [
|
2023-02-18 15:37:32 +03:00
|
|
|
|
{ title: '', width: 70, scopedSlots: { customRender: 'actions' } },
|
|
|
|
|
{ title: '{{ i18n "pages.inbounds.client" }}', width: 60, scopedSlots: { customRender: 'client' } },
|
2023-02-18 18:55:53 +03:00
|
|
|
|
{ title: '{{ i18n "pages.inbounds.traffic" }}↑|↓', width: 100, scopedSlots: { customRender: 'traffic' } },
|
2023-02-16 18:58:20 +03:00
|
|
|
|
{ title: '{{ i18n "pages.inbounds.expireDate" }}', width: 70, scopedSlots: { customRender: 'expiryTime' } },
|
2023-02-18 18:55:53 +03:00
|
|
|
|
{ title: 'Password', width: 100, dataIndex: "password" },
|
2023-02-12 16:50:09 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const innerOneColumns = [
|
2023-02-18 15:37:32 +03:00
|
|
|
|
{ title: '', width: 70, scopedSlots: { customRender: 'actions' } },
|
2023-02-09 22:18:06 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const app = new Vue({
|
|
|
|
|
delimiters: ['[[', ']]'],
|
|
|
|
|
el: '#app',
|
|
|
|
|
data: {
|
|
|
|
|
siderDrawer,
|
|
|
|
|
spinning: false,
|
|
|
|
|
inbounds: [],
|
|
|
|
|
dbInbounds: [],
|
|
|
|
|
searchKey: '',
|
2023-02-12 16:50:09 +03:00
|
|
|
|
searchedInbounds: [],
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loading(spinning=true) {
|
|
|
|
|
this.spinning = spinning;
|
|
|
|
|
},
|
|
|
|
|
async getDBInbounds() {
|
|
|
|
|
this.loading();
|
|
|
|
|
const msg = await HttpUtil.post('/xui/inbound/list');
|
|
|
|
|
this.loading(false);
|
|
|
|
|
if (!msg.success) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.setInbounds(msg.obj);
|
|
|
|
|
},
|
|
|
|
|
setInbounds(dbInbounds) {
|
|
|
|
|
this.inbounds.splice(0);
|
|
|
|
|
this.dbInbounds.splice(0);
|
2023-02-12 16:50:09 +03:00
|
|
|
|
this.searchedInbounds.splice(0);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
for (const inbound of dbInbounds) {
|
|
|
|
|
const dbInbound = new DBInbound(inbound);
|
|
|
|
|
this.inbounds.push(dbInbound.toInbound());
|
|
|
|
|
this.dbInbounds.push(dbInbound);
|
2023-02-12 16:50:09 +03:00
|
|
|
|
this.searchedInbounds.push(dbInbound);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
searchInbounds(key) {
|
|
|
|
|
if (ObjectUtil.isEmpty(key)) {
|
|
|
|
|
this.searchedInbounds = this.dbInbounds.slice();
|
|
|
|
|
} else {
|
|
|
|
|
this.searchedInbounds.splice(0, this.searchedInbounds.length);
|
|
|
|
|
this.dbInbounds.forEach(inbound => {
|
|
|
|
|
if (ObjectUtil.deepSearch(inbound, key)) {
|
2023-02-16 18:58:20 +03:00
|
|
|
|
const newInbound = new DBInbound(inbound);
|
|
|
|
|
const inboundSettings = JSON.parse(inbound.settings);
|
|
|
|
|
if (inboundSettings.hasOwnProperty('clients')){
|
|
|
|
|
const searchedSettings = { "clients": [] };
|
|
|
|
|
inboundSettings.clients.forEach(client => {
|
|
|
|
|
if (ObjectUtil.deepSearch(client, key)){
|
|
|
|
|
searchedSettings.clients.push(client);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, searchedSettings);
|
|
|
|
|
}
|
|
|
|
|
this.searchedInbounds.push(newInbound);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
clickAction(action, dbInbound) {
|
|
|
|
|
switch (action.key) {
|
|
|
|
|
case "qrcode":
|
|
|
|
|
this.showQrcode(dbInbound);
|
|
|
|
|
break;
|
2023-03-17 01:01:14 +03:00
|
|
|
|
case "export":
|
|
|
|
|
this.inboundLinks(dbInbound.id);
|
|
|
|
|
break;
|
2023-02-09 22:18:06 +03:00
|
|
|
|
case "edit":
|
2023-02-18 15:37:32 +03:00
|
|
|
|
this.openEditInbound(dbInbound.id);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
break;
|
|
|
|
|
case "resetTraffic":
|
|
|
|
|
this.resetTraffic(dbInbound);
|
|
|
|
|
break;
|
|
|
|
|
case "delete":
|
|
|
|
|
this.delInbound(dbInbound);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
openAddInbound() {
|
|
|
|
|
inModal.show({
|
|
|
|
|
title: '{{ i18n "pages.inbounds.addInbound"}}',
|
|
|
|
|
okText: '{{ i18n "pages.inbounds.addTo"}}',
|
|
|
|
|
cancelText: '{{ i18n "close" }}',
|
|
|
|
|
confirm: async (inbound, dbInbound) => {
|
|
|
|
|
inModal.loading();
|
|
|
|
|
await this.addInbound(inbound, dbInbound);
|
|
|
|
|
inModal.close();
|
|
|
|
|
},
|
|
|
|
|
isEdit: false
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-02-18 15:37:32 +03:00
|
|
|
|
openEditInbound(dbInbound_id) {
|
|
|
|
|
dbInbound = this.dbInbounds.find(row => row.id === dbInbound_id);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
const inbound = dbInbound.toInbound();
|
|
|
|
|
inModal.show({
|
|
|
|
|
title: '{{ i18n "pages.inbounds.modifyInbound"}}',
|
|
|
|
|
okText: '{{ i18n "pages.inbounds.revise"}}',
|
|
|
|
|
cancelText: '{{ i18n "close" }}',
|
|
|
|
|
inbound: inbound,
|
|
|
|
|
dbInbound: dbInbound,
|
|
|
|
|
confirm: async (inbound, dbInbound) => {
|
|
|
|
|
inModal.loading();
|
|
|
|
|
await this.updateInbound(inbound, dbInbound);
|
|
|
|
|
inModal.close();
|
|
|
|
|
},
|
|
|
|
|
isEdit: true
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async addInbound(inbound, dbInbound) {
|
|
|
|
|
const data = {
|
|
|
|
|
up: dbInbound.up,
|
|
|
|
|
down: dbInbound.down,
|
|
|
|
|
total: dbInbound.total,
|
|
|
|
|
remark: dbInbound.remark,
|
|
|
|
|
enable: dbInbound.enable,
|
|
|
|
|
expiryTime: dbInbound.expiryTime,
|
|
|
|
|
|
|
|
|
|
listen: inbound.listen,
|
|
|
|
|
port: inbound.port,
|
|
|
|
|
protocol: inbound.protocol,
|
|
|
|
|
settings: inbound.settings.toString(),
|
|
|
|
|
streamSettings: inbound.stream.toString(),
|
|
|
|
|
sniffing: inbound.canSniffing() ? inbound.sniffing.toString() : '{}',
|
|
|
|
|
};
|
|
|
|
|
await this.submit('/xui/inbound/add', data, inModal);
|
|
|
|
|
},
|
|
|
|
|
async updateInbound(inbound, dbInbound) {
|
|
|
|
|
const data = {
|
|
|
|
|
up: dbInbound.up,
|
|
|
|
|
down: dbInbound.down,
|
|
|
|
|
total: dbInbound.total,
|
|
|
|
|
remark: dbInbound.remark,
|
|
|
|
|
enable: dbInbound.enable,
|
|
|
|
|
expiryTime: dbInbound.expiryTime,
|
|
|
|
|
|
|
|
|
|
listen: inbound.listen,
|
|
|
|
|
port: inbound.port,
|
|
|
|
|
protocol: inbound.protocol,
|
|
|
|
|
settings: inbound.settings.toString(),
|
|
|
|
|
streamSettings: inbound.stream.toString(),
|
|
|
|
|
sniffing: inbound.canSniffing() ? inbound.sniffing.toString() : '{}',
|
|
|
|
|
};
|
|
|
|
|
await this.submit(`/xui/inbound/update/${dbInbound.id}`, data, inModal);
|
|
|
|
|
},
|
|
|
|
|
resetTraffic(dbInbound) {
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: '{{ i18n "pages.inbounds.resetTraffic"}}',
|
|
|
|
|
content: '{{ i18n "pages.inbounds.resetTrafficContent"}}',
|
|
|
|
|
okText: '{{ i18n "reset"}}',
|
|
|
|
|
cancelText: '{{ i18n "cancel"}}',
|
|
|
|
|
onOk: () => {
|
|
|
|
|
const inbound = dbInbound.toInbound();
|
|
|
|
|
dbInbound.up = 0;
|
|
|
|
|
dbInbound.down = 0;
|
|
|
|
|
this.updateInbound(inbound, dbInbound);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
delInbound(dbInbound) {
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: '{{ i18n "pages.inbounds.deleteInbound"}}',
|
|
|
|
|
content: '{{ i18n "pages.inbounds.deleteInboundContent"}}',
|
|
|
|
|
okText: '{{ i18n "delete"}}',
|
|
|
|
|
cancelText: '{{ i18n "cancel"}}',
|
|
|
|
|
onOk: () => this.submit('/xui/inbound/del/' + dbInbound.id),
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-03-17 01:01:14 +03:00
|
|
|
|
getClients(protocol, clientSettings) {
|
|
|
|
|
switch(protocol){
|
|
|
|
|
case Protocols.VMESS: return clientSettings.vmesses;
|
|
|
|
|
case Protocols.VLESS: return clientSettings.vlesses;
|
|
|
|
|
case Protocols.TROJAN: return clientSettings.trojans;
|
|
|
|
|
default: return null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
showQrcode(dbInbound, clientIndex) {
|
2023-02-12 16:50:09 +03:00
|
|
|
|
const link = dbInbound.genLink(clientIndex);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
qrModal.show('{{ i18n "qrCode"}}', link, dbInbound);
|
|
|
|
|
},
|
2023-02-12 16:50:09 +03:00
|
|
|
|
showInfo(dbInbound, index) {
|
|
|
|
|
infoModal.show(dbInbound, index);
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
switchEnable(dbInbound) {
|
|
|
|
|
this.submit(`/xui/inbound/update/${dbInbound.id}`, dbInbound);
|
|
|
|
|
},
|
|
|
|
|
async submit(url, data, modal) {
|
|
|
|
|
const msg = await HttpUtil.postWithModal(url, data, modal);
|
|
|
|
|
if (msg.success) {
|
|
|
|
|
await this.getDBInbounds();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getInboundClients(dbInbound) {
|
|
|
|
|
if(dbInbound.protocol == Protocols.VLESS) {
|
|
|
|
|
return dbInbound.toInbound().settings.vlesses
|
|
|
|
|
} else if(dbInbound.protocol == Protocols.VMESS) {
|
|
|
|
|
return dbInbound.toInbound().settings.vmesses
|
|
|
|
|
} else if(dbInbound.protocol == Protocols.TROJAN) {
|
|
|
|
|
return dbInbound.toInbound().settings.trojans
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-02-12 16:50:09 +03:00
|
|
|
|
resetClientTraffic(client,inbound,event) {
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: '{{ i18n "pages.inbounds.resetTraffic"}}',
|
|
|
|
|
content: '{{ i18n "pages.inbounds.resetTrafficContent"}}',
|
|
|
|
|
okText: '{{ i18n "reset"}}',
|
|
|
|
|
cancelText: '{{ i18n "cancel"}}',
|
|
|
|
|
onOk: () => {
|
|
|
|
|
this.resetClTraffic(client,inbound,event);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async resetClTraffic(client,inbound,event) {
|
|
|
|
|
const msg = await HttpUtil.post('/xui/inbound/resetClientTraffic/'+ client.email);
|
|
|
|
|
if (!msg.success) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
clientStats = inbound.clientStats
|
|
|
|
|
if(clientStats.length > 0)
|
|
|
|
|
{
|
|
|
|
|
for (const key in clientStats) {
|
|
|
|
|
if (Object.hasOwnProperty.call(clientStats, key)) {
|
|
|
|
|
if(clientStats[key]['email'] == client.email){
|
|
|
|
|
clientStats[key]['up'] = 0
|
|
|
|
|
clientStats[key]['down'] = 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-02-09 22:18:06 +03:00
|
|
|
|
isExpiry(dbInbound, index) {
|
|
|
|
|
return dbInbound.toInbound().isExpiry(index)
|
|
|
|
|
},
|
|
|
|
|
getUpStats(dbInbound, email) {
|
2023-03-17 01:01:14 +03:00
|
|
|
|
if(email.length == 0) return 0
|
|
|
|
|
clientStats = dbInbound.clientStats.find(stats => stats.email === email)
|
|
|
|
|
return clientStats ? clientStats.up : 0
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
getDownStats(dbInbound, email) {
|
2023-03-17 01:01:14 +03:00
|
|
|
|
if(email.length == 0) return 0
|
|
|
|
|
clientStats = dbInbound.clientStats.find(stats => stats.email === email)
|
|
|
|
|
return clientStats ? clientStats.down : 0
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
isTrafficExhausted(dbInbound, email) {
|
2023-03-17 01:01:14 +03:00
|
|
|
|
if(email.length == 0) return false
|
|
|
|
|
clientStats = dbInbound.clientStats.find(stats => stats.email === email)
|
|
|
|
|
return clientStats ? clientStats.down + clientStats.up > clientStats.total : false
|
|
|
|
|
},
|
|
|
|
|
inboundLinks(dbInboundId) {
|
|
|
|
|
dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
|
|
|
|
|
txtModal.show('{{ i18n "pages.inbounds.export"}}',dbInbound.genInboundLinks,dbInbound.remark);
|
|
|
|
|
},
|
|
|
|
|
exportAllLinks() {
|
|
|
|
|
let copyText = '';
|
|
|
|
|
for (const dbInbound of this.dbInbounds) {
|
|
|
|
|
copyText += dbInbound.genInboundLinks
|
2023-02-09 22:18:06 +03:00
|
|
|
|
}
|
2023-03-17 01:01:14 +03:00
|
|
|
|
txtModal.show('{{ i18n "pages.inbounds.export"}}',copyText,'All-Inbounds');
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
isClientEnabled(dbInbound, email) {
|
2023-03-17 01:01:14 +03:00
|
|
|
|
clientStats = dbInbound.clientStats ? dbInbound.clientStats.find(stats => stats.email === email) : null
|
|
|
|
|
return clientStats ? clientStats['enable'] : true
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
2023-02-12 16:50:09 +03:00
|
|
|
|
searchKey: debounce(function (newVal) {
|
|
|
|
|
this.searchInbounds(newVal);
|
|
|
|
|
}, 500)
|
2023-02-09 22:18:06 +03:00
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getDBInbounds();
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
total() {
|
|
|
|
|
let down = 0, up = 0;
|
2023-03-17 01:01:14 +03:00
|
|
|
|
let clients = 0, active = 0, deactive = 0;
|
|
|
|
|
this.dbInbounds.forEach(dbInbound => {
|
|
|
|
|
down += dbInbound.down;
|
|
|
|
|
up += dbInbound.up;
|
|
|
|
|
inbound = dbInbound.toInbound();
|
|
|
|
|
clients = this.getClients(dbInbound.protocol, inbound.settings);
|
|
|
|
|
if(clients){
|
|
|
|
|
if(dbInbound.enable){
|
|
|
|
|
isClientEnable = false;
|
|
|
|
|
clients.forEach(client => {
|
|
|
|
|
isClientEnable = client.email == "" ? true: this.isClientEnabled(dbInbound,client.email);
|
|
|
|
|
isClientEnable ? active++ : deactive++;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
deactive += clients.length;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dbInbound.enable ? active++ : deactive++;
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-02-09 22:18:06 +03:00
|
|
|
|
return {
|
|
|
|
|
down: down,
|
|
|
|
|
up: up,
|
2023-03-17 01:01:14 +03:00
|
|
|
|
clients: active + deactive,
|
|
|
|
|
active: active,
|
|
|
|
|
deactive: deactive,
|
2023-02-09 22:18:06 +03:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{{template "inboundModal"}}
|
|
|
|
|
{{template "promptModal"}}
|
|
|
|
|
{{template "qrcodeModal"}}
|
|
|
|
|
{{template "textModal"}}
|
|
|
|
|
{{template "inboundInfoModal"}}
|
|
|
|
|
</body>
|
2023-02-18 18:55:53 +03:00
|
|
|
|
</html>
|