From b829ebca2b18992011fca48488d695dbab2fb5dd Mon Sep 17 00:00:00 2001 From: Ho3ein Date: Tue, 13 Feb 2024 21:06:25 +0330 Subject: [PATCH] minor changes (#922) * ipv6 for family Protection * warp - ForceIP * fix bug in edit SOCKS and HTTP outbound Co-Authored-By: Saeid <43953720+surbiks@users.noreply.github.com> * lang - export inbound * reset button - publicKey & psk * fix - Ensure logs are not null in show method --------- Co-authored-by: Saeid <43953720+surbiks@users.noreply.github.com> --- web/assets/js/model/outbound.js | 10 +++++----- web/assets/js/model/xray.js | 2 +- web/html/xui/form/protocol/wireguard.html | 22 ++++++++++++++++++++-- web/html/xui/inbounds.html | 2 +- web/html/xui/index.html | 4 ++-- web/html/xui/warp_modal.html | 1 + web/html/xui/xray.html | 10 +++++----- web/translation/translate.en_US.toml | 2 +- web/translation/translate.fa_IR.toml | 2 +- web/translation/translate.ru_RU.toml | 2 +- web/translation/translate.vi_VN.toml | 2 +- web/translation/translate.zh_Hans.toml | 2 +- 12 files changed, 40 insertions(+), 21 deletions(-) diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index dc31465a..5420ef5e 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -860,13 +860,13 @@ Outbound.SocksSettings = class extends CommonClass { } static fromJson(json={}) { - servers = json.servers; + let servers = json.servers; if(ObjectUtil.isArrEmpty(servers)) servers=[{users: [{}]}]; return new Outbound.SocksSettings( servers[0].address, servers[0].port, ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user, - ObjectUtil.isArrEmpty(servers[0].pass) ? '' : servers[0].users[0].pass, + ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].pass, ); } @@ -890,13 +890,13 @@ Outbound.HttpSettings = class extends CommonClass { } static fromJson(json={}) { - servers = json.servers; + let servers = json.servers; if(ObjectUtil.isArrEmpty(servers)) servers=[{users: [{}]}]; return new Outbound.HttpSettings( servers[0].address, servers[0].port, ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user, - ObjectUtil.isArrEmpty(servers[0].pass) ? '' : servers[0].users[0].pass, + ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].pass, ); } @@ -912,7 +912,7 @@ Outbound.HttpSettings = class extends CommonClass { }; Outbound.WireguardSettings = class extends CommonClass { constructor( - mtu=1420, secretKey=Wireguard.generateKeypair().privateKey, + mtu=1420, secretKey='', address='', workers=2, domainStrategy='', reserved='', peers=[new Outbound.WireguardSettings.Peer()], kernelMode=false) { super(); diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 31257626..9587fbf6 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -2098,7 +2098,7 @@ Inbound.WireguardSettings = class extends XrayCommonClass { }; Inbound.WireguardSettings.Peer = class extends XrayCommonClass { - constructor(publicKey='', psk='', allowedIPs=['0.0.0.0/0','::/0'], keepAlive=0) { + constructor(publicKey=Wireguard.generateKeypair().publicKey, psk='', allowedIPs=['0.0.0.0/0','::/0'], keepAlive=0) { super(); this.publicKey = publicKey; this.psk = psk; diff --git a/web/html/xui/form/protocol/wireguard.html b/web/html/xui/form/protocol/wireguard.html index 553f5d42..ea2c3427 100644 --- a/web/html/xui/form/protocol/wireguard.html +++ b/web/html/xui/form/protocol/wireguard.html @@ -32,10 +32,28 @@ - + + - + + diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 7c5f18fa..c9f89488 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -236,7 +236,7 @@ - {{ i18n "pages.inbounds.copyToClipboard" }} + {{ i18n "pages.inbounds.exportInbound" }} {{ i18n "pages.inbounds.clone"}} diff --git a/web/html/xui/index.html b/web/html/xui/index.html index 51d15d3f..adc4d395 100644 --- a/web/html/xui/index.html +++ b/web/html/xui/index.html @@ -436,8 +436,8 @@ loading: false, show(logs) { this.visible = true; - this.logs = logs; - this.formattedLogs = logs.length > 0 ? this.formatLogs(logs) : "No Record..."; + this.logs = logs || []; + this.formattedLogs = this.logs.length > 0 ? this.formatLogs(this.logs) : "No Record..."; }, formatLogs(logs) { let formattedLogs = ''; diff --git a/web/html/xui/warp_modal.html b/web/html/xui/warp_modal.html index c9f86603..7b229f7f 100644 --- a/web/html/xui/warp_modal.html +++ b/web/html/xui/warp_modal.html @@ -140,6 +140,7 @@ mtu: 1420, secretKey: warpModal.warpData.private_key, address: Object.values(config.interface.addresses), + domainStrategy: 'ForceIP', peers: [{ publicKey: peer.public_key, endpoint: peer.endpoint.host, diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 367af3a7..e2046b04 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -553,17 +553,17 @@ ir: [ "regexp:.*\\.ir$", "regexp:.*\\.xn--mgba3a4f16a$", // .ایران - "ext:geosite_IR.dat:ir" // have rules to bypass all .ir domains. + "ext:geosite_IR.dat:ir" ] }, familyProtectDNS: { "servers": [ - "1.1.1.3", + "1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/ "1.0.0.3", - "94.140.14.15", - "94.140.15.16" + "2606:4700:4700::1113", + "2606:4700:4700::1003" ], - "queryStrategy": "UseIPv4" + "queryStrategy": "UseIP" }, } }, diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index b401a3a6..3b6f3643 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -171,7 +171,7 @@ "info" = "Info" "same" = "Same" "inboundData" = "Inbound's Data" -"copyToClipboard" = "Copy to Clipboard" +"exportInbound" = "Export Inbound" "import" = "Import" "importInbound" = "Import an Inbound" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index d5f59a43..04aaa588 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -170,7 +170,7 @@ "info" = "اطلاعات" "same" = "همسان" "inboundData" = "داده‌های ورودی" -"copyToClipboard" = "کپی در حافظه" +"exportInbound" = "استخراج ورودی" "import" = "افزودن" "importInbound" = "افزودن یک ورودی" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 5548a3a6..80e7d6d3 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -171,7 +171,7 @@ "info" = "Информация" "same" = "Тот же" "inboundData" = "Входящие данные" -"copyToClipboard" = "Копировать в буфер обмена" +"exportInbound" = "Экспорт входящих" "import" = "Импортировать" "importInbound" = "Импортировать входящее сообщение" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 39ceb4d8..328f5d12 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -171,7 +171,7 @@ "info" = "Thông tin" "same" = "Như nhau" "inboundData" = "Dữ liệu gửi đến" -"copyToClipboard" = "Sao chép vào bảng nhớ tạm" +"exportInbound" = "Xuất nhập khẩu" "import" = "Nhập" "importInbound" = "Nhập hàng gửi về" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index da28b4ec..0122b8e5 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -171,7 +171,7 @@ "info" = "信息" "same" = "相同" "inboundData" = "入站数据" -"copyToClipboard" = "复制到剪贴板" +"exportInbound" = "出口 入境" "import"="导入" "importInbound" = "导入入站"