3 Commits 3be204f272 ... c8e8c97afc

Author SHA1 Message Date
  Sanaei c8e8c97afc Merge pull request #2652 from Incognito-Coder/main 1 month ago
  AghayeCoder 46ba4c4518 fix getSubGroupClients for enable/disable and edit clients. 1 month ago
  AghayeCoder a787ab497c switcher for outbound traffic 1 month ago

+ 40 - 27
web/html/xui/inbounds.html

@@ -1195,35 +1195,48 @@
                 }
             },
             getSubGroupClients(dbInbounds, currentClient) {
-                const response = {
-                  inbounds: [],
-                  clients: [],
-                  editIds: []
+            const response = {
+              inbounds: [],
+              clients: [],
+              editIds: [],
+            };
+
+            if (!Array.isArray(dbInbounds) || dbInbounds.length === 0) {
+              return response;
+            }
+            if (!currentClient || !currentClient.subId) {
+              return response;
+            }
+
+            dbInbounds.forEach((dbInboundItem) => {
+              try {
+                const dbInbound = new DBInbound(dbInboundItem);
+                if (!dbInbound) {
+                  return;
                 }
-                if (dbInbounds && dbInbounds.length > 0 && currentClient) {
-                    dbInbounds.forEach((dbInboundItem) => {
-                        const dbInbound = new DBInbound(dbInboundItem);
-                        if (dbInbound) {
-                            const inbound = dbInbound.toInbound();
-                            if (inbound) {
-                                const clients = inbound.clients;
-                                if (clients.length > 0) {
-                                    clients.forEach((client) => {
-                                        if (client['subId'] === currentClient['subId']) {
-                                            client['inboundId'] = dbInboundItem.id
-                                            client['clientId'] = this.getClientId(dbInbound.protocol, client)
-                                            response.inbounds.push(dbInboundItem.id)
-                                            response.clients.push(client)
-                                            response.editIds.push(client['clientId'])
-                                        }
-                                    })
-                                }
-                            }
-                        }
-                    })
+
+                const inbound = dbInbound.toInbound();
+                if (!inbound || !Array.isArray(inbound.clients)) {
+                  return;
                 }
-                return response;
-            },
+
+                inbound.clients.forEach((client) => {
+                  if (client.subId === currentClient.subId) {
+                    client.inboundId = dbInboundItem.id;
+                    client.clientId = this.getClientId(dbInbound.protocol, client);
+
+                    response.inbounds.push(dbInboundItem.id);
+                    response.clients.push(client);
+                    response.editIds.push(client.clientId);
+                  }
+                });
+              } catch (error) {
+                console.error("Error processing dbInboundItem:", dbInboundItem, error);
+              }
+            });
+
+            return response;
+          },
             getClientId(protocol, client) {
                 switch (protocol) {
                     case Protocols.TROJAN: return client.password;

+ 13 - 0
web/html/xui/xray.html

@@ -143,6 +143,7 @@
                           </a-select>
                         </a-col>
                       </a-row>
+                      <setting-list-item type="switch" title='{{ i18n "pages.xray.outBoundTraffic"}}' desc='{{ i18n "pages.xray.outBoundTrafficDesc"}}' v-model="outboundTraffic"></setting-list-item>
                     </a-list-item>
                   </a-collapse-panel>
                   <a-collapse-panel header='{{ i18n "pages.xray.logConfigs" }}'>
@@ -1823,6 +1824,18 @@
                     this.templateSettings = newTemplateSettings;
                 }
             },
+            outboundTraffic: {
+                get: function () {
+                    if (!this.templateSettings || !this.templateSettings.policy.system || !this.templateSettings.policy.system.statsOutboundDownlink) return false;
+                    return this.templateSettings.policy.system.statsOutboundDownlink;
+                },
+                set: function (newValue) {
+                    newTemplateSettings = this.templateSettings;
+                    newTemplateSettings.policy.system.statsOutboundDownlink = newValue;
+                    newTemplateSettings.policy.system.statsOutboundUplink = newValue;
+                    this.templateSettings = newTemplateSettings;
+                }
+            },
             maskAddressLog: {
                 get: function () {
                     if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.maskAddress) return "";

+ 2 - 0
web/translation/translate.en_US.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "The file path for the error log. The special value 'none' disabled error logs"
 "dnsLog" = "DNS Log"
 "dnsLogDesc" = "Whether to enable DNS query logs"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Mask Address"
 "maskAddressDesc" = "IP address mask, when enabled, will automatically replace the IP address that appears in the log."
 

+ 2 - 0
web/translation/translate.es_ES.toml

@@ -371,6 +371,8 @@
 "errorLogDesc" = "La ruta del archivo para el registro de errores. El valor especial 'none' desactiva los registros de errores."
 "dnsLog" = "Registro DNS"
 "dnsLogDesc" = "Si habilitar los registros de consulta DNS"
+"outBoundTraffic" = "Tráfico saliente"
+"outBoundTrafficDesc" = "Si se debe habilitar el tráfico saliente"
 "maskAddress" = "Enmascarar Dirección"
 "maskAddressDesc" = "Máscara de dirección IP, cuando se habilita, reemplazará automáticamente la dirección IP que aparece en el registro."
 

+ 2 - 0
web/translation/translate.fa_IR.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "مسیر فایل برای ورود به سیستم خطا. مقدار ویژه «هیچ» گزارش های خطا را غیرفعال میکند"
 "dnsLog" = "گزارش DNS"
 "dnsLogDesc" = "آیا ثبت‌های درخواست DNS را فعال کنید"
+"outBoundTraffic" = "ترافیک خروجی"
+"outBoundTrafficDesc" = "فعال کردن ترافیک خروجی"
 "maskAddress" = "پنهان کردن آدرس"
 "maskAddressDesc" = "پوشش آدرس IP، هنگامی که فعال می‌شود، به طور خودکار آدرس IP که در لاگ ظاهر می‌شود را جایگزین می‌کند."
 

+ 2 - 0
web/translation/translate.id_ID.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "Jalur file untuk log kesalahan. Nilai khusus 'tidak ada' menonaktifkan log kesalahan"
 "dnsLog" = "Log DNS"
 "dnsLogDesc" = "Apakah akan mengaktifkan log kueri DNS"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Alamat Masker"
 "maskAddressDesc" = "Masker alamat IP, ketika diaktifkan, akan secara otomatis mengganti alamat IP yang muncul di log."
 

+ 2 - 0
web/translation/translate.ja_JP.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "エラーログのファイルパス。特殊値 'none' はエラーログを無効にします"
 "dnsLog" = "DNS ログ"
 "dnsLogDesc" = "DNSクエリのログを有効にするかどうか"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "アドレスをマスク"
 "maskAddressDesc" = "IPアドレスをマスクし、有効にするとログに表示されるIPアドレスを自動的に置き換えます"
 

+ 2 - 0
web/translation/translate.pt_BR.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "O caminho do arquivo para o log de erros. O valor especial 'none' desativa os logs de erro."
 "dnsLog" = "Log DNS"
 "dnsLogDesc" = "Se ativar logs de consulta DNS"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Mascarar Endereço"
 "maskAddressDesc" = "Máscara de endereço IP, quando ativado, substitui automaticamente o endereço IP que aparece no log."
 

+ 2 - 0
web/translation/translate.ru_RU.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "Путь к файлу журнала ошибок. Специальное значение «none» отключает журналы ошибок."
 "dnsLog" = "DNS Журнал"
 "dnsLogDesc" = "Включить логи запросов DNS"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Маскировать Адрес"
 "maskAddressDesc" = "Маска IP-адреса, при активации автоматически заменяет IP-адрес, который появляется в логе."
 

+ 2 - 0
web/translation/translate.tr_TR.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "Hata günlüğü için dosya yolu. 'none' özel değeri hata günlüklerini devre dışı bırakır"
 "dnsLog" = "DNS Günlüğü"
 "dnsLogDesc" = "DNS sorgu günlüklerini etkinleştirin"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Adres Maskesi"
 "maskAddressDesc" = "IP adresi maskesi, etkinleştirildiğinde, günlükte görünen IP adresini otomatik olarak değiştirecektir."
 

+ 2 - 0
web/translation/translate.uk_UA.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "Шлях до файлу журналу помилок. Спеціальне значення 'none' вимикає журнали помилок"
 "dnsLog" = "Журнал DNS"
 "dnsLogDesc" = "Чи включити журнали запитів DNS"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Маскувати Адресу"
 "maskAddressDesc" = "Маска IP-адреси, при активації автоматично замінює IP-адресу, яка з'являється у журналі."
 

+ 2 - 0
web/translation/translate.vi_VN.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "Đường dẫn tệp cho nhật ký lỗi. Nhật ký lỗi bị vô hiệu hóa có giá trị đặc biệt 'không'"
 "dnsLog" = "Nhật ký DNS"
 "dnsLogDesc" = "Có bật nhật ký truy vấn DNS không"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "Ẩn Địa Chỉ"
 "maskAddressDesc" = "Mặt nạ địa chỉ IP, khi được bật, sẽ tự động thay thế địa chỉ IP xuất hiện trong nhật ký."
 

+ 2 - 0
web/translation/translate.zh_CN.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "错误日志的文件路径。特殊值 'none' 禁用错误日志"
 "dnsLog" = "DNS 日志"
 "dnsLogDesc" = "是否启用 DNS 查询日志"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "隐藏地址"
 "maskAddressDesc" = "IP 地址掩码,启用时会自动替换日志中出现的 IP 地址。"
 

+ 2 - 0
web/translation/translate.zh_TW.toml

@@ -373,6 +373,8 @@
 "errorLogDesc" = "錯誤日誌的檔案路徑。特殊值 'none' 禁用錯誤日誌"
 "dnsLog" = "DNS 日誌"
 "dnsLogDesc" = "是否啟用 DNS 查詢日誌"
+"outBoundTraffic" = "Outbounds Traffic"
+"outBoundTrafficDesc" = "Whether to enable outbound traffic"
 "maskAddress" = "隱藏地址"
 "maskAddressDesc" = "IP 地址掩碼,啟用時會自動替換日誌中出現的 IP 地址。"