fix traffic and date condition bug

This commit is contained in:
Hossin Asaadi
2022-11-13 08:41:45 -05:00
parent bc38dd03d9
commit 8640499c48
2 changed files with 11 additions and 7 deletions

View File

@@ -818,9 +818,13 @@ class Inbound extends XrayCommonClass {
isExpiry(index) {
switch (this.protocol) {
case Protocols.VMESS:
return this.settings.vmesses[index].expiryTime < new Date().getTime();
if(this.settings.vmesses[index]._expiryTime != null)
return this.settings.vmesses[index]._expiryTime < new Date().getTime();
return false
case Protocols.VLESS:
return this.settings.vlesses[index].expiryTime < new Date().getTime();
if(this.settings.vlesses[index]._expiryTime != null)
return this.settings.vlesses[index]._expiryTime < new Date().getTime();
return false
default:
return false;
}
@@ -1197,14 +1201,14 @@ Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
);
}
get _expiryTime() {
if (this.expiryTime === 0) {
if (this.expiryTime === 0 || this.expiryTime === "") {
return null;
}
return moment(this.expiryTime);
}
set _expiryTime(t) {
if (t == null) {
if (t == null || t === "") {
this.expiryTime = 0;
} else {
this.expiryTime = t.valueOf();
@@ -1256,14 +1260,14 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
};
}
get _expiryTime() {
if (this.expiryTime === 0) {
if (this.expiryTime === 0 || this.expiryTime === "") {
return null;
}
return moment(this.expiryTime);
}
set _expiryTime(t) {
if (t == null) {
if (t == null || t === "") {
this.expiryTime = 0;
} else {
this.expiryTime = t.valueOf();

View File

@@ -3,7 +3,7 @@
<a-collapse activeKey="0" v-for="(vmess, index) in inbound.settings.vmesses"
:key="`vmess-${index}`">
<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-tag v-if="isExpiry(index) || ((getUpStats(vmess.email) + getDownStats(vmess.email)) > vmess.totalGB && vmess.totalGB != 0)" 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">