From 3e0faecaaebd8394a1a9d18ec11b5a60f210b654 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 18 Apr 2023 21:34:06 +0330 Subject: improve reality setting split xtls from tls - remove iran warp - remove old setting reality from franzkafka (it was a messy code) -and other improvement Co-Authored-By: Alireza Ahmadi --- web/html/xui/client_bulk_modal.html | 46 ++++++++++++++--- web/html/xui/client_modal.html | 9 +++- web/html/xui/form/client.html | 6 +-- web/html/xui/form/protocol/trojan.html | 4 +- web/html/xui/form/protocol/vless.html | 4 +- web/html/xui/form/protocol/vmess.html | 2 +- web/html/xui/form/tls_settings.html | 92 +++++++++++++++++++++++++--------- web/html/xui/inbound_info_modal.html | 6 ++- web/html/xui/inbound_modal.html | 55 ++++++++++++-------- web/html/xui/inbounds.html | 34 ++++++------- web/html/xui/setting.html | 18 ------- 11 files changed, 180 insertions(+), 96 deletions(-) (limited to 'web/html') diff --git a/web/html/xui/client_bulk_modal.html b/web/html/xui/client_bulk_modal.html index 4e282ccd..46bc6657 100644 --- a/web/html/xui/client_bulk_modal.html +++ b/web/html/xui/client_bulk_modal.html @@ -33,6 +33,30 @@ {{ i18n "pages.client.clientCount" }} + + + {{ i18n "pages.inbounds.IPLimit" }} + + + + + + + + + + {{ i18n "none" }} + [[ key ]] + + + + + {{ i18n "none" }} + [[ key ]] + + @@ -51,10 +75,10 @@ - + - + @@ -83,9 +107,9 @@ confirm: null, dbInbound: new DBInbound(), inbound: new Inbound(), - clients: [], quantity: 1, totalGB: 0, + limitIp: 0, expiryTime: '', emailMethod: 0, firstNum: 1, @@ -94,8 +118,10 @@ emailPostfix: "", subId: "", tgId: "", + flow: "", delayedStart: false, ok() { + clients = []; method=clientsBulkModal.emailMethod; if(method>1){ start=clientsBulkModal.firstNum; @@ -113,11 +139,18 @@ newClient.email += useNum ? prefix + i.toString() + postfix : prefix + postfix; newClient.subId = clientsBulkModal.subId; newClient.tgId = clientsBulkModal.tgId; + newClient.limitIp = clientsBulkModal.limitIp; newClient._totalGB = clientsBulkModal.totalGB; newClient._expiryTime = clientsBulkModal.expiryTime; - clientsBulkModal.clients.push(newClient); + if(clientsBulkModal.inbound.canEnableTlsFlow()){ + newClient.flow = clientsBulkModal.flow; + } + if(clientsBulkModal.inbound.xtls){ + newClient.flow = clientsBulkModal.flow; + } + clients.push(newClient); } - ObjectUtil.execute(clientsBulkModal.confirm, clientsBulkModal.inbound, clientsBulkModal.dbInbound); + ObjectUtil.execute(clientsBulkModal.confirm, clients, clientsBulkModal.dbInbound.id); }, show({ title='', okText='{{ i18n "sure" }}', dbInbound=null, confirm=(inbound, dbInbound)=>{} }) { this.visible = true; @@ -128,15 +161,16 @@ this.totalGB = 0; this.expiryTime = 0; this.emailMethod= 0; + this.limitIp= 0; this.firstNum= 1; this.lastNum= 1; this.emailPrefix= ""; this.emailPostfix= ""; this.subId= ""; this.tgId= ""; + this.flow= ""; this.dbInbound = new DBInbound(dbInbound); this.inbound = dbInbound.toInbound(); - this.clients = this.getClients(this.inbound.protocol, this.inbound.settings); this.delayedStart = false; }, getClients(protocol, clientSettings) { diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index d1078f23..d90e6156 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -12,6 +12,7 @@ confirmLoading: false, title: '', okText: '', + isEdit: false, dbInbound: new DBInbound(), inbound: new Inbound(), clients: [], @@ -21,9 +22,13 @@ isExpired: false, delayedStart: false, ok() { - ObjectUtil.execute(clientModal.confirm, clientModal.inbound, clientModal.dbInbound, clientModal.index); + if(clientModal.isEdit){ + ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id, clientModal.index); + } else { + ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id); + } }, - show({ title='', okText='{{ i18n "sure" }}', index=null, dbInbound=null, confirm=(index, dbInbound)=>{}, isEdit=false }) { + show({ title='', okText='{{ i18n "sure" }}', index=null, dbInbound=null, confirm=()=>{}, isEdit=false }) { this.visible = true; this.title = title; this.okText = okText; diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 1de05ac9..2d8c5d2b 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -68,7 +68,7 @@ - + {{ i18n "none" }} [[ key ]] @@ -100,10 +100,10 @@ - + - + diff --git a/web/html/xui/form/protocol/trojan.html b/web/html/xui/form/protocol/trojan.html index 91fd7afd..9f5c120a 100644 --- a/web/html/xui/form/protocol/trojan.html +++ b/web/html/xui/form/protocol/trojan.html @@ -1,7 +1,7 @@ {{define "form/trojan"}} - + @@ -31,7 +31,7 @@ - + {{ i18n "none" }} [[ key ]] diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html index 029f2c9e..68c719dd 100644 --- a/web/html/xui/form/protocol/vless.html +++ b/web/html/xui/form/protocol/vless.html @@ -1,7 +1,7 @@ {{define "form/vless"}} - + @@ -31,7 +31,7 @@ - + {{ i18n "none" }} [[ key ]] diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index ad2b3960..d19e5cb7 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -1,7 +1,7 @@ {{define "form/vmess"}} - + diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index f954b76b..dcef3990 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -17,7 +17,7 @@ - + XTLS @@ -27,14 +27,14 @@ - + - - - + + + @@ -52,22 +52,22 @@ [[ key ]] - - + + + + + None [[ key ]] - - - [[ key ]] - + @@ -93,33 +93,79 @@ + + + + + + + + + [[ key ]] + + + + + + + + {{ i18n "pages.inbounds.certificatePath" }} + {{ i18n "pages.inbounds.certificateContent" }} + + + + + + + - + - + - + [[ key ]] + + + - + + + + - - + + - - + + - - + + - - + + Get New Key {{end}} \ No newline at end of file diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 049d529e..4e8c7dae 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -49,10 +49,14 @@ tls: {{ i18n "enabled" }}
tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]] - + xtls: {{ i18n "enabled" }}
xtls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]] + + reality: {{ i18n "enabled" }}
+ reality {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]] + tls: {{ i18n "disabled" }} diff --git a/web/html/xui/inbound_modal.html b/web/html/xui/inbound_modal.html index 6b140abc..98cb188f 100644 --- a/web/html/xui/inbound_modal.html +++ b/web/html/xui/inbound_modal.html @@ -43,6 +43,14 @@ loading(loading) { inModal.confirmLoading = loading; }, + 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; + } + }, }; const protocols = { @@ -62,6 +70,7 @@ inModal: inModal, Protocols: protocols, SSMethods: SSMethods, + delayedStart: false, get inbound() { return inModal.inbound; }, @@ -70,36 +79,40 @@ }, get isEdit() { return inModal.isEdit; - } - }, - methods: { - streamNetworkChange(oldValue) { - if (oldValue === 'kcp') { - this.inModal.inbound.tls = false; - } }, - addClient(protocol, clients) { - switch (protocol) { - case Protocols.VMESS: return clients.push(new Inbound.VmessSettings.Vmess()); - case Protocols.VLESS: return clients.push(new Inbound.VLESSSettings.VLESS()); - case Protocols.TROJAN: return clients.push(new Inbound.TrojanSettings.Trojan()); - default: return null; - } + get client() { + return inModal.getClients(this.inbound.protocol, this.inbound.settings)[0]; }, - removeClient(index, clients) { - clients.splice(index, 1); + get delayedExpireDays() { + return this.client && this.client.expiryTime < 0 ? this.client.expiryTime / -86400000 : 0; }, - isExpiry(index) { - return this.inbound.isExpiry(index) + set delayedExpireDays(days){ + this.client.expiryTime = -86400000 * days; }, - isClientEnable(email) { - clientStats = this.dbInbound.clientStats ? this.dbInbound.clientStats.find(stats => stats.email === email) : null - return clientStats ? clientStats['enable'] : true + }, + methods: { + streamNetworkChange() { + if (!inModal.inbound.canSetTls()) { + this.inModal.inbound.stream.security = 'none'; + } + if (!inModal.inbound.canEnableReality()) { + this.inModal.inbound.reality = false; + } }, setDefaultCertData(){ inModal.inbound.stream.tls.certs[0].certFile = app.defaultCert; inModal.inbound.stream.tls.certs[0].keyFile = app.defaultKey; }, + async getNewX25519Cert(){ + inModal.loading(true); + const msg = await HttpUtil.post('/server/getNewX25519Cert'); + inModal.loading(false); + if (!msg.success) { + return; + } + inModal.inbound.stream.reality.privateKey = msg.obj.privateKey; + inModal.inbound.stream.reality.settings.publicKey = msg.obj.publicKey; + }, getNewEmail(client) { var chars = 'abcdefghijklmnopqrstuvwxyz1234567890'; var string = ''; diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index b962efcb..15782b1d 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -133,26 +133,26 @@