From b60faa83989154954f4561eb94cef95ec33a6750 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Apr 2026 10:17:42 +0800 Subject: [PATCH] feat: add geofile scheduled update UI controls to panel --- web/html/index.html | 41 ++++++++++++++++++++++++++++ web/translation/translate.en_US.toml | 8 ++++++ web/translation/translate.zh_CN.toml | 8 ++++++ 3 files changed, 57 insertions(+) diff --git a/web/html/index.html b/web/html/index.html index 6c5195f2..21db3743 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -342,6 +342,30 @@ {{ i18n "pages.index.geofileSyncUpdate" }} {{ i18n "pages.index.geofilesUpdateAll" }} +
+

{{ i18n "pages.index.geofileScheduleTitle" }}

+ + + + + + + {{ i18n "pages.index.geofileScheduleHourly" }} + {{ i18n "pages.index.geofileScheduleEvery12h" }} + {{ i18n "pages.index.geofileScheduleDaily" }} + {{ i18n "pages.index.geofileScheduleWeekly" }} + + + + + [[ h-1 ]] + + + +
@@ -920,6 +944,9 @@ showAlert: false, showIp: false, ipLimitEnable: false, + geofileUpdateEnabled: false, + geofileUpdateFrequency: 'daily', + geofileUpdateHour: 4, }, methods: { loading(spinning, tip = '{{ i18n "loading"}}') { @@ -1041,6 +1068,17 @@ }, }); }, + async saveGeofileSchedule() { + try { + await HttpUtil.post('/panel/setting/update', { + geofileUpdateEnabled: this.geofileUpdateEnabled, + geofileUpdateFrequency: this.geofileUpdateFrequency, + geofileUpdateHour: this.geofileUpdateHour, + }); + } catch (e) { + console.error("Failed to save geofile schedule:", e); + } + }, async loadGeofileVersions() { try { const msg = await HttpUtil.get('/panel/api/server/getGeofileVersions'); @@ -1182,6 +1220,9 @@ const msg = await HttpUtil.post('/panel/setting/defaultSettings'); if (msg.success) { this.ipLimitEnable = msg.obj.ipLimitEnable; + this.geofileUpdateEnabled = msg.obj.geofileUpdateEnabled; + this.geofileUpdateFrequency = msg.obj.geofileUpdateFrequency; + this.geofileUpdateHour = msg.obj.geofileUpdateHour; } // Initial status fetch diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 953135ec..578369de 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -166,6 +166,14 @@ "geofileSyncUpdateDialog" = "Sync update Geofiles on all nodes?" "geofileSyncUpdateDialogDesc" = "This will update Geofiles on the master and all worker nodes. Xray will restart on each node to apply the new rule files." "geofileUpdatePopover" = "Geofile updated successfully" +"geofileScheduleTitle" = "Scheduled Update" +"geofileScheduleEnable" = "Enable" +"geofileScheduleFrequency" = "Frequency" +"geofileScheduleHour" = "Hour" +"geofileScheduleHourly" = "Hourly" +"geofileScheduleEvery12h" = "Every 12 Hours" +"geofileScheduleDaily" = "Daily" +"geofileScheduleWeekly" = "Weekly" "dontRefresh" = "Installation is in progress, please do not refresh this page" "logs" = "Logs" "config" = "Config" diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 0d05f718..f9927ace 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -166,6 +166,14 @@ "geofileSyncUpdateDialog" = "是否在所有节点同步更新 Geofiles?" "geofileSyncUpdateDialogDesc" = "这将更新主节点和所有子节点的 Geofiles,更新完成后各节点将重启 Xray 以应用新的规则文件。" "geofileUpdatePopover" = "地理文件更新成功" +"geofileScheduleTitle" = "定时更新" +"geofileScheduleEnable" = "启用" +"geofileScheduleFrequency" = "更新频率" +"geofileScheduleHour" = "更新小时" +"geofileScheduleHourly" = "每小时" +"geofileScheduleEvery12h" = "每12小时" +"geofileScheduleDaily" = "每天" +"geofileScheduleWeekly" = "每周" "dontRefresh" = "安装中,请勿刷新此页面" "logs" = "日志" "config" = "配置"