From 87e06c519d4fb972e6f00855a4d3a70a6ee445da Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 24 Apr 2026 11:31:52 +0200 Subject: [PATCH] languages update --- web/service/inbound.go | 31 ++++++++++++++++++++++++---- web/translation/translate.ar_EG.toml | 4 ++-- web/translation/translate.en_US.toml | 4 ++-- web/translation/translate.es_ES.toml | 4 ++-- web/translation/translate.fa_IR.toml | 4 ++-- web/translation/translate.id_ID.toml | 4 ++-- web/translation/translate.ja_JP.toml | 4 ++-- web/translation/translate.pt_BR.toml | 4 ++-- web/translation/translate.ru_RU.toml | 4 ++-- web/translation/translate.tr_TR.toml | 4 ++-- web/translation/translate.uk_UA.toml | 4 ++-- web/translation/translate.vi_VN.toml | 4 ++-- web/translation/translate.zh_CN.toml | 4 ++-- web/translation/translate.zh_TW.toml | 4 ++-- 14 files changed, 53 insertions(+), 30 deletions(-) diff --git a/web/service/inbound.go b/web/service/inbound.go index 0860aed4..6d4e8d19 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -1783,6 +1783,7 @@ func (s *InboundService) propagateShareQuota(tx *gorm.DB, subId string, totalGB, nowMs := time.Now().Unix() * 1000 touchedEmails := make([]string, 0) + dirtyInbounds := make([]*model.Inbound, 0) for ibIdx := range inbounds { var settings map[string]any @@ -1823,7 +1824,12 @@ func (s *InboundService) propagateShareQuota(tx *gorm.DB, subId string, totalGB, return err } inbounds[ibIdx].Settings = string(newSettings) - if err := tx.Save(inbounds[ibIdx]).Error; err != nil { + dirtyInbounds = append(dirtyInbounds, inbounds[ibIdx]) + } + + // Batch-save all modified inbounds in one statement instead of one per inbound. + if len(dirtyInbounds) > 0 { + if err := tx.Save(dirtyInbounds).Error; err != nil { return err } } @@ -1884,10 +1890,27 @@ func (s *InboundService) disableInvalidClients(tx *gorm.DB) (bool, int64, error) // First pass: handle share-quota groups so members are disabled together and // excluded from the per-client pass below. + // + // Skip the expensive full-inbound scan when no share-quota clients exist at all. handledEmails := make(map[string]bool) - groups, err := s.computeShareQuotaGroups(tx) - if err != nil { - return false, 0, err + var shareQuotaCount int64 + if err := tx.Raw(` + SELECT COUNT(1) FROM inbounds, + JSON_EACH(JSON_EXTRACT(inbounds.settings, '$.clients')) AS client + WHERE JSON_EXTRACT(client.value, '$.shareQuota') = 1 + OR JSON_EXTRACT(client.value, '$.shareQuota') = 'true' + OR JSON_EXTRACT(client.value, '$.shareQuota') = TRUE + `).Scan(&shareQuotaCount).Error; err != nil { + shareQuotaCount = 0 + } + + var groups map[string]*shareQuotaGroup + var err error + if shareQuotaCount > 0 { + groups, err = s.computeShareQuotaGroups(tx) + if err != nil { + return false, 0, err + } } groupDepletedEmails := make([]string, 0) if len(groups) > 0 && p != nil { diff --git a/web/translation/translate.ar_EG.toml b/web/translation/translate.ar_EG.toml index e471d993..8bdd9586 100644 --- a/web/translation/translate.ar_EG.toml +++ b/web/translation/translate.ar_EG.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "استخدم شهادة البانل" "telegramDesc" = "ادخل ID شات Telegram. (استخدم '/id' في البوت) أو (@userinfobot)" "subscriptionDesc" = "عشان تلاقي رابط الاشتراك، ادخل على 'التفاصيل'. وكمان ممكن تستخدم نفس الاسم لعدة عملاء." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "الحصة المشتركة" +"shareQuotaDesc" = "شارك الحصة مع العملاء الذين يستخدمون نفس معرف الاشتراك." "info" = "معلومات" "same" = "نفسه" "inboundData" = "بيانات الإدخال" diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index a5c618fc..7a8cfa7c 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Set Cert from Panel" "telegramDesc" = "Please provide Telegram Chat ID. (use '/id' command in the bot) or (@userinfobot)" "subscriptionDesc" = "To find your subscription URL, navigate to the 'Details'. Additionally, you can use the same name for several clients." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Shared Quota" +"shareQuotaDesc" = "Pool quota with clients that use the same Subscription ID." "info" = "Info" "same" = "Same" "inboundData" = "Inbound's Data" diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index 549e0750..1e9fea98 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Establecer certificado desde el panel" "telegramDesc" = "Por favor, proporciona el ID de Chat de Telegram. (usa el comando '/id' en el bot) o (@userinfobot)" "subscriptionDesc" = "Puedes encontrar tu enlace de suscripción en Detalles, también puedes usar el mismo nombre para varias configuraciones." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Cuota compartida" +"shareQuotaDesc" = "Comparte la cuota con clientes que usan el mismo ID de suscripción." "info" = "Info" "same" = "misma" "inboundData" = "Datos de entrada" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index cc953f20..4a6da0e3 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "استفاده از گواهی پنل" "telegramDesc" = "لطفا شناسه گفتگوی تلگرام را وارد کنید. (از دستور '/id' در ربات استفاده کنید) یا (@userinfobot)" "subscriptionDesc" = "شما می‌توانید لینک سابسکربپشن خودرا در 'جزئیات' پیدا کنید، همچنین می‌توانید از همین نام برای چندین کاربر استفاده‌کنید" -"shareQuota" = "اشتراک حجم بین اینباندها" -"shareQuotaDesc" = "مقدار حجم و تاریخ انقضا با سایر کلاینت‌هایی که همین subId را دارند و گزینه اشتراک حجم‌شان فعال است ترکیب می‌شود." +"shareQuota" = "سهمیه مشترک" +"shareQuotaDesc" = "سهمیه را با کاربرانی که از شناسه اشتراک یکسان استفاده می‌کنند به‌صورت مشترک استفاده کنید." "info" = "اطلاعات" "same" = "همسان" "inboundData" = "داده‌های ورودی" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index ae7d327b..c6d05874 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Atur Sertifikat dari Panel" "telegramDesc" = "Harap berikan ID Obrolan Telegram. (gunakan perintah '/id' di bot) atau (@userinfobot)" "subscriptionDesc" = "Untuk menemukan URL langganan Anda, buka 'Rincian'. Selain itu, Anda dapat menggunakan nama yang sama untuk beberapa klien." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Kuota Bersama" +"shareQuotaDesc" = "Gabungkan kuota dengan klien yang menggunakan ID Langganan yang sama." "info" = "Info" "same" = "Sama" "inboundData" = "Data Masuk" diff --git a/web/translation/translate.ja_JP.toml b/web/translation/translate.ja_JP.toml index 800d73fe..d06f9994 100644 --- a/web/translation/translate.ja_JP.toml +++ b/web/translation/translate.ja_JP.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "パネル設定から証明書を設定" "telegramDesc" = "TelegramチャットIDを提供してください。(ボットで'/id'コマンドを使用)または(@userinfobot)" "subscriptionDesc" = "サブスクリプションURLを見つけるには、“詳細情報”に移動してください。また、複数のクライアントに同じ名前を使用することができます。" -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "共有クォータ" +"shareQuotaDesc" = "同じサブスクリプションIDを使用するクライアントとクォータを共有します。" "info" = "情報" "same" = "同じ" "inboundData" = "インバウンドデータ" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index 69f4b859..7f472069 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Definir Certificado pelo Painel" "telegramDesc" = "Por favor, forneça o ID do Chat do Telegram. (use o comando '/id' no bot) ou (@userinfobot)" "subscriptionDesc" = "Para encontrar seu URL de assinatura, navegue até 'Detalhes'. Além disso, você pode usar o mesmo nome para vários clientes." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Cota Compartilhada" +"shareQuotaDesc" = "Compartilhe a cota com clientes que usam o mesmo ID de assinatura." "info" = "Informações" "same" = "Igual" "inboundData" = "Dados do Inbound" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index aa22d1de..5bd857ab 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Установить сертификат панели" "telegramDesc" = "Пожалуйста, укажите Chat ID Telegram. (используйте команду '/id' в боте) или (@userinfobot)" "subscriptionDesc" = "Вы можете найти свою ссылку подписки в разделе 'Подробнее'" -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Общая квота" +"shareQuotaDesc" = "Объединяйте квоту с клиентами, использующими одинаковый ID подписки." "info" = "Информация" "same" = "Тот же" "inboundData" = "Данные подключений" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index d3d9beb5..a57df1bb 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Panelden Sertifikayı Ayarla" "telegramDesc" = "Lütfen Telegram Sohbet Kimliği sağlayın. (botta '/id' komutunu kullanın) veya (@userinfobot)" "subscriptionDesc" = "Abonelik URL'inizi bulmak için 'Detaylar'a gidin. Ayrıca, aynı adı birden fazla müşteri için kullanabilirsiniz." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Paylaşılan Kota" +"shareQuotaDesc" = "Aynı Abonelik Kimliğini kullanan istemcilerle kotayı paylaşın." "info" = "Bilgi" "same" = "Aynı" "inboundData" = "Gelenin Verileri" diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index 45a3e698..bec5c265 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Установити сертифікат з панелі" "telegramDesc" = "Будь ласка, вкажіть ID чату Telegram. (використовуйте команду '/id' у боті) або (@userinfobot)" "subscriptionDesc" = "Щоб знайти URL-адресу вашої підписки, перейдіть до «Деталі». Крім того, ви можете використовувати одне ім'я для кількох клієнтів." -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Спільна квота" +"shareQuotaDesc" = "Об'єднуйте квоту з клієнтами, які використовують однаковий ID підписки." "info" = "Інформація" "same" = "Те саме" "inboundData" = "Вхідні дані" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index df38bc62..d0c235bd 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "Đặt chứng chỉ từ bảng điều khiển" "telegramDesc" = "Vui lòng cung cấp ID Trò chuyện Telegram. (sử dụng lệnh '/id' trong bot) hoặc (@userinfobot)" "subscriptionDesc" = "Bạn có thể tìm liên kết gói đăng ký của mình trong Chi tiết, cũng như bạn có thể sử dụng cùng tên cho nhiều cấu hình khác nhau" -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "Hạn mức chia sẻ" +"shareQuotaDesc" = "Gộp hạn mức với các client sử dụng cùng một ID đăng ký." "info" = "Thông tin" "same" = "Giống nhau" "inboundData" = "Dữ liệu gửi đến" diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index b4ace655..42085400 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "从面板设置证书" "telegramDesc" = "请提供Telegram聊天ID。(在机器人中使用'/id'命令)或(@userinfobot" "subscriptionDesc" = "要找到你的订阅 URL,请导航到“详细信息”。此外,你可以为多个客户端使用相同的名称。" -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "共享配额" +"shareQuotaDesc" = "与使用相同订阅ID的客户端共享配额。" "info" = "信息" "same" = "相同" "inboundData" = "入站数据" diff --git a/web/translation/translate.zh_TW.toml b/web/translation/translate.zh_TW.toml index 69141677..94229afb 100644 --- a/web/translation/translate.zh_TW.toml +++ b/web/translation/translate.zh_TW.toml @@ -281,8 +281,8 @@ "setDefaultCert" = "從面板設定證書" "telegramDesc" = "請提供Telegram聊天ID。(在機器人中使用'/id'命令)或(@userinfobot" "subscriptionDesc" = "要找到你的訂閱 URL,請導航到“詳細資訊”。此外,你可以為多個客戶端使用相同的名稱。" -"shareQuota" = "Share quota across inbounds" -"shareQuotaDesc" = "Pool totalGB and expiry time with every other client that has the same subId and shareQuota enabled." +"shareQuota" = "共享配額" +"shareQuotaDesc" = "與使用相同訂閱 ID 的用戶端共享配額。" "info" = "資訊" "same" = "相同" "inboundData" = "入站資料"