add fully function Multi User With ExpireDate & Traffic

This commit is contained in:
Hossin Asaadi
2022-11-12 08:25:29 -05:00
parent 77d24fbede
commit 47a48316ca
10 changed files with 166 additions and 53 deletions

View File

@@ -2,8 +2,8 @@
<a-form layout="inline">
<a-collapse activeKey="0" v-for="(vmess, index) in inbound.settings.vmesses"
:key="`vmess-${index}`">
<a-collapse-panel :header="vmess.email == '' ? 'Add User' : vmess.email">
<a-tag v-if="isExpiry(index)" color="red" style="margin-bottom: 10px;display: block;text-align: center;">Account is Expired And Disabled</a-tag>
<a-collapse-panel :header="getHeaderText(vmess.email)">
<a-tag v-if="isExpiry(index) || (getUpStats(vmess.email) + getDownStats(vmess.email)) > vmess.totalGB" color="red" style="margin-bottom: 10px;display: block;text-align: center;">Account is (Expired|Traffic Ended) And Disabled</a-tag>
<a-form layout="inline">
<a-form-item label="Email">
@@ -56,7 +56,7 @@
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
</span>
<a-input-number v-model="vmess.totalGB" :min="0"></a-input-number>
<a-input-number v-model="vmess._totalGB" :min="0"></a-input-number>
</a-form-item>
<a-form-item>
<span slot="label">
@@ -73,7 +73,7 @@
</a-form-item>
<a-form layout="inline">
<a-tag color="blue">[[ sizeFormat(getUpStats(vmess.email)) ]] / [[ sizeFormat(getDownStats(vmess.email)) ]]</a-tag>
<a-form v-if="vmess.totalGB > 0">
<a-form v-if="vmess._totalGB > 0">
<a-tag color="red">used : [[ sizeFormat(getUpStats(vmess.email) + getDownStats(vmess.email)) ]]</a-tag>
</a-form>
</a-form>

View File

@@ -116,14 +116,51 @@
return this.inbound.isExpiry(index)
},
getUpStats(email) {
console.log(email,this.inbound.clientStats[email])
if(this.inbound.clientStats[email])
return this.inbound.clientStats[email]["Up"]
clientStats = this.inbound.clientStats
if(clientStats.length > 0)
{
for (const key in clientStats) {
if (Object.hasOwnProperty.call(clientStats, key)) {
if(clientStats[key]['email'] == email)
return clientStats[key]['up']
}
}
}
},
getDownStats(email) {
if(this.inbound.clientStats[email])
return this.inbound.clientStats[email]["Down"]
clientStats = this.inbound.clientStats
if(clientStats.length > 0)
{
for (const key in clientStats) {
if (Object.hasOwnProperty.call(clientStats, key)) {
if(clientStats[key]['email'] == email)
return clientStats[key]['down']
}
}
}
},
isClientEnable(email) {
clientStats = this.inbound.clientStats
if(clientStats.length > 0)
{
for (const key in clientStats) {
if (Object.hasOwnProperty.call(clientStats, key)) {
if(clientStats[key]['email'] == email)
return clientStats[key]['enable']
}
}
}
},
getHeaderText(email) {
if(email == "")
return "Add Client"
return email + (this.isClientEnable(email) == true ? ' Active' : ' Deactive')
},