Просмотр исходного кода

new - select option for loglevel & access log

MHSanaei 1 год назад
Родитель
Сommit
618a566283

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

@@ -147,6 +147,40 @@
                                             </template>
                                         </a-col>
                                     </a-row>
+                                    <a-row style="padding: 20px">
+                                        <a-col :lg="24" :xl="12">
+                                            <a-list-item-meta 
+                                                title='{{ i18n "pages.xray.logLevel" }}'
+                                                description='{{ i18n "pages.xray.logLevelDesc" }}'/>
+                                        </a-col>
+                                        <a-col :lg="24" :xl="12">
+                                            <template>
+                                                <a-select
+                                                    v-model="setLogLevel"
+                                                    :dropdown-class-name="themeSwitcher.currentTheme"
+                                                    style="width: 100%">
+                                                    <a-select-option v-for="s in logLevel" :value="s">[[ s ]]</a-select-option>
+                                                </a-select>
+                                            </template>
+                                        </a-col>
+                                    </a-row>
+                                    <a-row style="padding: 20px">
+                                        <a-col :lg="24" :xl="12">
+                                            <a-list-item-meta 
+                                                title='{{ i18n "pages.xray.accessLog" }}'
+                                                description='{{ i18n "pages.xray.accessLogDesc" }}'/>
+                                        </a-col>
+                                        <a-col :lg="24" :xl="12">
+                                            <template>
+                                                <a-select
+                                                    v-model="setAccessLog"
+                                                    :dropdown-class-name="themeSwitcher.currentTheme"
+                                                    style="width: 100%">
+                                                    <a-select-option v-for="s in access" :value="s">[[ s ]]</a-select-option>
+                                                </a-select>
+                                            </template>
+                                        </a-col>
+                                    </a-row>
                                 </a-list-item>
                                 </a-collapse-panel>
                                 <a-collapse-panel header='{{ i18n "pages.xray.blockConfigs"}}'>
@@ -534,6 +568,8 @@
                 protocol: "freedom"
             },
             routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
+            logLevel: ["none" , "debug" , "info" , "warning", "error"],
+            access: ["none" , "./access.log" ],
             settingsData: {
                 protocols: {
                     bittorrent: ["bittorrent"],
@@ -1109,6 +1145,28 @@
                     this.templateSettings = newTemplateSettings;
                 }
             },
+            setLogLevel: {
+                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;
+                }
+            },
+            setAccessLog: {
+                get: function () {
+                    if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.access) return "none";
+                    return this.templateSettings.log.access;
+                },
+                set: function (newValue) {
+                    newTemplateSettings = this.templateSettings;
+                    newTemplateSettings.log.access = newValue;
+                    this.templateSettings = newTemplateSettings;
+                }
+            },
             blockedIPs: {
                 get: function () {
                     return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" });

+ 7 - 1
web/job/check_client_ip_job.go

@@ -94,8 +94,14 @@ func (j *CheckClientIpJob) checkFail2BanInstalled() {
 
 func (j *CheckClientIpJob) processLogFile() {
 	accessLogPath := xray.GetAccessLogPath()
+
+	if accessLogPath == "none" {
+		logger.Warning("Access log is set to 'none' check your Xray Configs")
+		return
+	}
+
 	if accessLogPath == "" {
-		logger.Warning("access.log doesn't exist in your config.json")
+		logger.Warning("Access log doesn't exist in your Xray Configs")
 		return
 	}
 

+ 3 - 2
web/service/config.json

@@ -1,7 +1,8 @@
 {
   "log": {
-    "loglevel": "warning",
-    "error": "./error.log"
+    "access": "none",
+    "dnsLog": false,
+    "loglevel": "warning"
   },
   "api": {
     "tag": "api",

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

@@ -309,8 +309,8 @@
 "restart" = "Restart Xray"
 "basicTemplate" = "Basics"
 "advancedTemplate" = "Advanced"
-"generalConfigs" = "General Strategy"
-"generalConfigsDesc" = "These options will determine general strategy adjustments."
+"generalConfigs" = "General"
+"generalConfigsDesc" = "These options will determine general adjustments."
 "blockConfigs" = "Protection Shield"
 "blockConfigsDesc" = "These options will block traffic based on specific requested protocols and websites."
 "blockCountryConfigs" = "Block Country"
@@ -392,6 +392,10 @@
 "Routings" = "Routing Rules"
 "RoutingsDesc" = "The priority of each rule is important!"
 "completeTemplate" = "All"
+"logLevel" = "Log Level"
+"logLevelDesc" = "The log level for error logs, indicating the information that needs to be recorded."
+"accessLog" = "Access Log"
+"accessLogDesc" = "The file path for the access log. The special value 'none' disabled access logs"
 
 [pages.xray.rules]
 "first" = "First"

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

@@ -392,6 +392,10 @@
 "Routings" = "Reglas de enrutamiento"
 "RoutingsDesc" = "¡La prioridad de cada regla es importante!"
 "completeTemplate" = "Todos"
+"logLevel" = "Nivel de registro"
+"logLevelDesc" = "El nivel de registro para registros de errores, que indica la información que debe registrarse."
+"accessLog" = "Registro de acceso"
+"accessLogDesc" = "La ruta del archivo para el registro de acceso. El valor especial 'ninguno' deshabilita los registros de acceso"
 
 [pages.xray.rules]
 "first" = "Primero"

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

@@ -392,6 +392,10 @@
 "Routings" = "قوانین مسیریابی"
 "RoutingsDesc" = "اولویت هر قانون مهم است"
 "completeTemplate" = "کامل"
+"logLevel" = "سطح گزارش"
+"logLevelDesc" = "سطح گزارش برای گزارش های خطا، نشان دهنده اطلاعاتی است که باید ثبت شوند."
+"accessLog" = "مسیر گزارش"
+"accessLogDesc" = "مسیر فایل برای گزارش دسترسی. مقدار ویژه «هیچ» گزارش‌های دسترسی را غیرفعال میکند."
 
 [pages.xray.rules]
 "first" = "اولین"

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

@@ -392,6 +392,10 @@
 "Routings" = "Правила маршрутизации"
 "RoutingsDesc" = "Важен приоритет каждого правила!"
 "completeTemplate" = "Все"
+"logLevel" = "Уровень журнала"
+"logLevelDesc" = "Уровень журнала для журналов ошибок, указывающий информацию, которую необходимо записать."
+"accessLog" = "Журнал доступа"
+"accessLogDesc" = "Путь к файлу журнала доступа. Специальное значение «none» отключило журналы доступа."
 
 [pages.xray.rules]
 "first" = "Первый"

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

@@ -392,6 +392,10 @@
 "Routings" = "Quy tắc định tuyến"
 "RoutingsDesc" = "Mức độ ưu tiên của mỗi quy tắc đều quan trọng!"
 "completeTemplate" = "All"
+"logLevel" = "Mức đăng nhập"
+"logLevelDesc" = "Cấp độ nhật ký cho nhật ký lỗi, cho biết thông tin cần được ghi lại."
+"accessLog" = "Nhật ký truy cập"
+"accessLogDesc" = "Đường dẫn tệp cho nhật ký truy cập. Nhật ký truy cập bị vô hiệu hóa có giá trị đặc biệt 'không'"
 
 [pages.xray.rules]
 "first" = "Đầu tiên"

+ 4 - 0
web/translation/translate.zh_Hans.toml

@@ -392,6 +392,10 @@
 "Routings" = "路由规则"
 "RoutingsDesc" = "每条规则的优先级都很重要"
 "completeTemplate" = "全部"
+"logLevel" = "日志级别"
+"logLevelDesc" = "错误日志的日志级别,表示需要记录的信息。"
+"accessLog" = "访问日志"
+"accessLogDesc" = "访问日志的文件路径。 特殊值“none”禁用访问日志"
 
 [pages.xray.rules]
 "first" = "第一个"