add isExpiry

This commit is contained in:
Hossin Asaadi
2022-11-11 07:46:32 -05:00
parent 6755b8613f
commit dd83130a47
3 changed files with 45 additions and 1 deletions

View File

@@ -810,6 +810,17 @@ class Inbound extends XrayCommonClass {
return this.stream.grpc.serviceName;
}
isExpiry(index) {
switch (this.protocol) {
case Protocols.VMESS:
return this.settings.vmesses[index].expiryTime < new Date().getTime();
case Protocols.VLESS:
return this.settings.vlesses[index].expiryTime < new Date().getTime();
default:
return false;
}
}
canEnableTls() {
switch (this.protocol) {
case Protocols.VMESS:
@@ -1178,6 +1189,20 @@ Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
);
}
get _expiryTime() {
if (this.expiryTime === 0) {
return null;
}
return moment(this.expiryTime);
}
set _expiryTime(t) {
if (t == null) {
this.expiryTime = 0;
} else {
this.expiryTime = t.valueOf();
}
}
};
Inbound.VLESSSettings = class extends Inbound.Settings {
@@ -1215,6 +1240,21 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
fallbacks: Inbound.VLESSSettings.toJsonArray(this.fallbacks),
};
}
get _expiryTime() {
if (this.expiryTime === 0) {
return null;
}
return moment(this.expiryTime);
}
set _expiryTime(t) {
if (t == null) {
this.expiryTime = 0;
} else {
this.expiryTime = t.valueOf();
}
}
};
Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {

View File

@@ -3,6 +3,7 @@
<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-form layout="inline">
<a-form-item label="Email">
@@ -68,7 +69,7 @@
</a-tooltip>
</span>
<a-date-picker :show-time="{ format: 'HH:mm' }" format="YYYY-MM-DD HH:mm"
v-model="vmess.expiryTime" style="width: 300px;"></a-date-picker>
v-model="vmess._expiryTime" style="width: 300px;"></a-date-picker>
</a-form-item>
<!--Add Svg Icon-->

View File

@@ -112,6 +112,9 @@
}
event.target.value = ""
},
isExpiry(index) {
return this.inbound.isExpiry(index)
},
},
});