Browse Source

[xray] option error log

MHSanaei 1 year ago
parent
commit
fe00cfb09b

+ 51 - 29
web/html/xui/xray.html

@@ -114,15 +114,12 @@
                                     <a-list-item>
                                         <a-row style="padding: 20px">
                                             <a-col :lg="24" :xl="12">
-                                                <a-list-item-meta 
-                                                    title='{{ i18n "pages.xray.FreedomStrategy" }}'
-                                                    description='{{ i18n "pages.xray.FreedomStrategyDesc" }}'/>
+                                                <a-list-item-meta title='{{ i18n "pages.xray.FreedomStrategy" }}'
+                                                    description='{{ i18n "pages.xray.FreedomStrategyDesc" }}' />
                                             </a-col>
                                             <a-col :lg="24" :xl="12">
                                                 <template>
-                                                    <a-select
-                                                        v-model="freedomStrategy"
-                                                        :dropdown-class-name="themeSwitcher.currentTheme"
+                                                    <a-select v-model="freedomStrategy" :dropdown-class-name="themeSwitcher.currentTheme"
                                                         style="width: 100%">
                                                         <a-select-option v-for="s in OutboundDomainStrategies" :value="s">[[ s ]]</a-select-option>
                                                     </a-select>
@@ -132,33 +129,37 @@
                                     </a-list-item>
                                     <a-row style="padding: 20px">
                                         <a-col :lg="24" :xl="12">
-                                            <a-list-item-meta 
-                                                title='{{ i18n "pages.xray.RoutingStrategy" }}'
-                                                description='{{ i18n "pages.xray.RoutingStrategyDesc" }}'/>
+                                            <a-list-item-meta title='{{ i18n "pages.xray.RoutingStrategy" }}'
+                                                description='{{ i18n "pages.xray.RoutingStrategyDesc" }}' />
                                         </a-col>
                                         <a-col :lg="24" :xl="12">
                                             <template>
-                                                <a-select
-                                                    v-model="routingStrategy"
-                                                    :dropdown-class-name="themeSwitcher.currentTheme"
+                                                <a-select v-model="routingStrategy" :dropdown-class-name="themeSwitcher.currentTheme"
                                                     style="width: 100%">
                                                     <a-select-option v-for="s in routingDomainStrategies" :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.logConfigs" }}'>
+                                    <a-row :xs="24" :sm="24" :lg="12">
+                                        <a-alert type="warning" style="text-align: center;">
+                                            <template slot="message">
+                                                <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
+                                                {{ i18n "pages.xray.logConfigsDesc" }}
+                                            </template>
+                                        </a-alert>
+                                    </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-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 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>
@@ -166,22 +167,31 @@
                                     </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-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 v-model="accessLog" :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-row style="padding: 20px">
+                                        <a-col :lg="24" :xl="12">
+                                            <a-list-item-meta title='{{ i18n "pages.xray.errorLog" }}'
+                                                description='{{ i18n "pages.xray.errorLogDesc" }}' />
+                                        </a-col>
+                                        <a-col :lg="24" :xl="12">
+                                            <template>
+                                                <a-select v-model="errorLog" :dropdown-class-name="themeSwitcher.currentTheme" style="width: 100%">
+                                                    <a-select-option v-for="s in error" :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"}}'>
                                     <a-row :xs="24" :sm="24" :lg="12">
@@ -633,6 +643,7 @@
             routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
             logLevel: ["none" , "debug" , "info" , "warning", "error"],
             access: ["none" , "./access.log" ],
+            error: ["none" , "./error.log" ],
             settingsData: {
                 protocols: {
                     bittorrent: ["bittorrent"],
@@ -1344,9 +1355,9 @@
                     this.templateSettings = newTemplateSettings;
                 }
             },
-            setAccessLog: {
+            accessLog: {
                 get: function () {
-                    if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.access) return "none";
+                    if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.access) return "";
                     return this.templateSettings.log.access;
                 },
                 set: function (newValue) {
@@ -1355,6 +1366,17 @@
                     this.templateSettings = newTemplateSettings;
                 }
             },
+            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;
+                }
+            },
             blockedIPs: {
                 get: function () {
                     return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" });

+ 1 - 0
web/service/config.json

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

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "Advanced"
 "generalConfigs" = "General"
 "generalConfigsDesc" = "These options will determine general adjustments."
+"logConfigs" = "Log"
+"logConfigsDesc" = "Logs may affect your server's efficiency. It is recommended to enable it wisely only in case of your needs"
 "blockConfigs" = "Protection Shield"
 "blockConfigsDesc" = "These options will block traffic based on specific requested protocols and websites."
 "blockCountryConfigs" = "Block Country"
@@ -397,6 +399,8 @@
 "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"
+"errorLog" = "Error Log"
+"errorLogDesc" = "The file path for the error log. The special value 'none' disabled error logs"
 
 [pages.xray.rules]
 "first" = "First"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "Plantilla Avanzada"
 "generalConfigs" = "Configuraciones Generales"
 "generalConfigsDesc" = "Estas opciones proporcionarán ajustes generales."
+"logConfigs" = "Registro"
+"logConfigsDesc" = "Los registros pueden afectar la eficiencia de su servidor. Se recomienda habilitarlo sabiamente solo en caso de sus necesidades."
 "blockConfigs" = "Configuraciones de Bloqueo"
 "blockConfigsDesc" = "Estas opciones evitarán que los usuarios se conecten a protocolos y sitios web específicos."
 "blockCountryConfigs" = "Configuraciones de Bloqueo por País"
@@ -397,6 +399,8 @@
 "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"
+"errorLog" = "Registro de errores"
+"errorLogDesc" = "La ruta del archivo para el registro de errores. El valor especial 'ninguno' deshabilitó los registros de errores"
 
 [pages.xray.rules]
 "first" = "Primero"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "پیشرفته"
 "generalConfigs" = "استراتژی‌ کلی"
 "generalConfigsDesc" = "این گزینه‌ها استراتژی کلی ترافیک را تعیین می‌کنند"
+"logConfigs" = "گزارش"
+"logConfigsDesc" = "گزارش‌ها ممکن است بر کارایی سرور شما تأثیر بگذارد. توصیه می شود فقط در صورت نیاز آن را عاقلانه فعال کنید"
 "blockConfigs" = "سپر محافظ"
 "blockConfigsDesc" = "این گزینه‌ها ترافیک را بر اساس پروتکل‌های درخواستی خاص، و وب سایت‌ها مسدود می‌کند"
 "blockCountryConfigs" = "مسدودسازی کشور"
@@ -397,6 +399,8 @@
 "logLevelDesc" = "سطح گزارش برای گزارش های خطا، نشان دهنده اطلاعاتی است که باید ثبت شوند."
 "accessLog" = "مسیر گزارش"
 "accessLogDesc" = "مسیر فایل برای گزارش دسترسی. مقدار ویژه «هیچ» گزارش‌های دسترسی را غیرفعال میکند."
+"errorLog" = "گزارش خطا"
+"errorLogDesc" = "مسیر فایل برای ورود به سیستم خطا. مقدار ویژه «هیچ» گزارش های خطا را غیرفعال میکند"
 
 [pages.xray.rules]
 "first" = "اولین"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "Lanjutan"
 "generalConfigs" = "Strategi Umum"
 "generalConfigsDesc" = "Opsi ini akan menentukan penyesuaian strategi umum."
+"logConfigs" = "Catatan"
+"logConfigsDesc" = "Log dapat mempengaruhi efisiensi server Anda. Disarankan untuk mengaktifkannya dengan bijak hanya jika diperlukan"
 "blockConfigs" = "Pelindung"
 "blockConfigsDesc" = "Opsi ini akan memblokir lalu lintas berdasarkan protokol dan situs web yang diminta."
 "blockCountryConfigs" = "Blokir Negara"
@@ -397,6 +399,8 @@
 "logLevelDesc" = "Tingkat log untuk log kesalahan, menunjukkan informasi yang perlu dicatat."
 "accessLog" = "Log Akses"
 "accessLogDesc" = "Jalur file untuk log akses. Nilai khusus 'tidak ada' menonaktifkan log akses"
+"errorLog" = "Catatan eror"
+"errorLogDesc" = "Jalur file untuk log kesalahan. Nilai khusus 'tidak ada' menonaktifkan log kesalahan"
 
 [pages.xray.rules]
 "first" = "Pertama"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "Расширенный шаблон"
 "generalConfigs" = "Основные настройки"
 "generalConfigsDesc" = "Эти параметры описывают общие настройки"
+"logConfigs" = "Журнал"
+"logConfigsDesc" = "Журналы могут повлиять на эффективность вашего сервера. Рекомендуется включать их с умом только в случае ваших нужд!"
 "blockConfigs" = "Блокировка конфигураций"
 "blockConfigsDesc" = "Эти параметры не позволят пользователям подключаться к определенным протоколам и веб-сайтам"
 "blockCountryConfigs" = "Конфигурации блокировки страны"
@@ -397,6 +399,8 @@
 "logLevelDesc" = "Уровень журнала для журналов ошибок, указывающий информацию, которую необходимо записать."
 "accessLog" = "Журнал доступа"
 "accessLogDesc" = "Путь к файлу журнала доступа. Специальное значение «none» отключило журналы доступа."
+"errorLog" = "Журнал ошибок"
+"errorLogDesc" = "Путь к файлу журнала ошибок. Специальное значение «none» отключает журналы ошибок."
 
 [pages.xray.rules]
 "first" = "Первый"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "Mẫu Nâng cao"
 "generalConfigs" = "Cấu hình Chung"
 "generalConfigsDesc" = "Những tùy chọn này sẽ cung cấp điều chỉnh tổng quát."
+"logConfigs" = "Nhật ký"
+"logConfigsDesc" = "Nhật ký có thể ảnh hưởng đến hiệu suất máy chủ của bạn. Bạn chỉ nên kích hoạt nó một cách khôn ngoan trong trường hợp bạn cần"
 "blockConfigs" = "Cấu hình Chặn"
 "blockConfigsDesc" = "Những tùy chọn này sẽ ngăn người dùng kết nối đến các giao thức và trang web cụ thể."
 "blockCountryConfigs" = "Cấu hình Chặn Quốc gia"
@@ -397,6 +399,8 @@
 "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'"
+"errorLog" = "Nhật ký lỗi"
+"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'"
 
 [pages.xray.rules]
 "first" = "Đầu tiên"

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

@@ -311,6 +311,8 @@
 "advancedTemplate" = "高级模板部件"
 "generalConfigs" = "通用配置"
 "generalConfigsDesc" = "这些选项将提供一般调整"
+"logConfigs"="日志"
+"logConfigsDesc" = "日志可能会影响您服务器的效率。建议仅在您需要时明智地启用它"
 "blockConfigs" = "阻塞配置"
 "blockConfigsDesc" = "这些选项将阻止用户连接到特定协议和网站"
 "blockCountryConfigs" = "阻止国家配置"
@@ -397,6 +399,8 @@
 "logLevelDesc" = "错误日志的日志级别,表示需要记录的信息。"
 "accessLog" = "访问日志"
 "accessLogDesc" = "访问日志的文件路径。 特殊值“none”禁用访问日志"
+"errorLog" = "错误日志"
+"errorLogDesc" = "错误日志的文件路径。 特殊值“none”禁用错误日志"
 
 [pages.xray.rules]
 "first" = "第一个"