From 582a7493b74e4824090f5989dc069fa8af42597a Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 9 Oct 2024 11:56:37 +0200 Subject: [PATCH] Log - maskAddress , dnslog --- web/html/xui/xray.html | 150 ++++++++++++++++++------- web/translation/translate.en_US.toml | 4 + web/translation/translate.fa_IR.toml | 4 + web/translation/translate.ru_RU.toml | 4 + web/translation/translate.vi_VN.toml | 4 + web/translation/translate.zh_Hans.toml | 4 + 6 files changed, 128 insertions(+), 42 deletions(-) diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 5493d979..83247d17 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -160,41 +160,69 @@ - + + description='{{ i18n "pages.xray.logLevelDesc" }}'> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - @@ -829,6 +857,13 @@ protocol: "freedom" }, routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"], + log: { + loglevel: ["none", "debug", "info", "warning", "error"], + access: ["none", "./access.log"], + error: ["none", "./error.log"], + dnsLog: false, + maskAddress: ["quarter", "half", "full"], + }, settingsData: { protocols: { bittorrent: ["bittorrent"], @@ -1462,28 +1497,59 @@ }, }, logLevel: { - get: function () { return this.logSettings?.loglevel?? 'none'; }, - set: function (newValue) { - newLogSettings = this.logSettings; - newLogSettings.loglevel = newValue; - this.logSettings = newLogSettings; + get: function () { + if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.loglevel) return "warning"; + return this.templateSettings.log.loglevel; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.log.loglevel = newValue; + this.templateSettings = newTemplateSettings; + } }, - logAccess: { - get: function () { return this.logSettings?.access?? ''; }, - set: function (newValue) { - newLogSettings = this.logSettings; - newValue == "" ? delete newLogSettings.access : newLogSettings.access = newValue; - this.logSettings = newLogSettings; + accessLog: { + get: function () { + if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.access) return ""; + return this.templateSettings.log.access; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.log.access = newValue; + this.templateSettings = newTemplateSettings; + } }, - logError: { - get: function () { return this.logSettings?.error?? ''; }, - set: function (newValue) { - newLogSettings = this.logSettings; - newValue == "" ? delete newLogSettings.error : newLogSettings.error = newValue; - this.logSettings = newLogSettings; + errorLog: { + get: function () { + if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.error) return ""; + return this.templateSettings.log.error; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.log.error = newValue; + this.templateSettings = newTemplateSettings; + } + }, + dnslog: { + get: function () { + if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.dnsLog) return false; + return this.templateSettings.log.dnsLog; + }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.log.dnsLog = newValue; + this.templateSettings = newTemplateSettings; + } + }, + maskAddressLog: { + get: function () { + if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.maskAddress) return ""; + return this.templateSettings.log.maskAddress; + }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.log.maskAddress = newValue; + this.templateSettings = newTemplateSettings; + } }, inboundSettings: { get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; }, diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 5088e5e1..8185cd2e 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -359,6 +359,10 @@ "accessLogDesc" = "The file path for the access log." "errorLog" = "Error Log" "errorLogDesc" = "The file path for the error log." +"dnsLog" = "DNS Log" +"dnsLogDesc" = "Whether to enable DNS query logs" +"maskAddress" = "Mask Address" +"maskAddressDesc" = "IP address mask, when enabled, will automatically replace the IP address that appears in the log." [pages.xray.rules] "first" = "First" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 3b48fadd..120d8926 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -357,6 +357,10 @@ "accessLogDesc" = "مسیر فایل گزارش دسترسی" "errorLog" = "گزارش خطا" "errorLogDesc" = "مسیر فایل گزارش خطا" +"dnsLog" = "گزارش DNS" +"dnsLogDesc" = "آیا ثبت‌های درخواست DNS را فعال کنید" +"maskAddress" = "پنهان کردن آدرس" +"maskAddressDesc" = "پوشش آدرس IP، هنگامی که فعال می‌شود، به طور خودکار آدرس IP که در لاگ ظاهر می‌شود را جایگزین می‌کند." [pages.xray.rules] "first" = "اولین" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index a9f0ec33..c0fda94c 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -360,6 +360,10 @@ "accessLogDesc" = "Путь к файлу журнала доступа." "errorLog" = "Журнал ошибок" "errorLogDesc" = "Путь к файлу журнала ошибок." +"dnsLog" = "DNS Журнал" +"dnsLogDesc" = "Включить логи запросов DNS" +"maskAddress" = "Маскировать Адрес" +"maskAddressDesc" = "Маска IP-адреса, при активации автоматически заменяет IP-адрес, который появляется в логе." [pages.xray.rules] "first" = "Первый" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index d04d4e33..2b4d7afa 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -360,6 +360,10 @@ "accessLogDesc" = "Đường dẫn tệp cho nhật ký truy cập." "errorLog" = "Nhật ký lỗi" "errorLogDesc" = "Đường dẫn tệp cho nhật ký lỗi." +"dnsLog" = "Nhật ký DNS" +"dnsLogDesc" = "Có bật nhật ký truy vấn DNS không" +"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ý." [pages.xray.rules] "first" = "Đầu tiên" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index 84ef3028..70d77a72 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -360,6 +360,10 @@ "accessLogDesc" = "访问日志的文件路径。" "errorLog" = "错误日志" "errorLogDesc" = "错误日志的文件路径。" +"dnsLog" = "DNS 日志" +"dnsLogDesc" = "是否启用 DNS 查询日志" +"maskAddress" = "隐藏地址" +"maskAddressDesc" = "IP 地址掩码,启用时会自动替换日志中出现的 IP 地址。" [pages.xray.rules] "first" = "第一个"