diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 10b06e7e..bdf7a2cc 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -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 { diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index 2124623b..ad4e0db4 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -3,6 +3,7 @@ + Account is Expired And Disabled @@ -68,7 +69,7 @@ + v-model="vmess._expiryTime" style="width: 300px;"> diff --git a/web/html/xui/inbound_modal.html b/web/html/xui/inbound_modal.html index fc40883a..87aa5116 100644 --- a/web/html/xui/inbound_modal.html +++ b/web/html/xui/inbound_modal.html @@ -112,6 +112,9 @@ } event.target.value = "" }, + isExpiry(index) { + return this.inbound.isExpiry(index) + }, }, });