mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
feat: add geofile scheduled update UI controls to panel
This commit is contained in:
parent
b4d7192023
commit
b60faa8398
3 changed files with 57 additions and 0 deletions
|
|
@ -342,6 +342,30 @@
|
|||
<a-button @click="syncUpdateGeofile" style="margin-right: 8px;">{{ i18n "pages.index.geofileSyncUpdate" }}</a-button>
|
||||
<a-button @click="updateGeofile('')">{{ i18n "pages.index.geofilesUpdateAll" }}</a-button>
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
<h4 class="mb-5">{{ i18n "pages.index.geofileScheduleTitle" }}</h4>
|
||||
<a-form layout="inline">
|
||||
<a-form-item :label='{{ i18n "pages.index.geofileScheduleEnable" }}'>
|
||||
<a-switch v-model="geofileUpdateEnabled" @change="saveGeofileSchedule" />
|
||||
</a-form-item>
|
||||
<a-form-item :label='{{ i18n "pages.index.geofileScheduleFrequency" }}'>
|
||||
<a-select v-model="geofileUpdateFrequency" style="width: 160px" @change="saveGeofileSchedule"
|
||||
:dropdown-class-name="themeSwitcher.currentTheme">
|
||||
<a-select-option value="hourly">{{ i18n "pages.index.geofileScheduleHourly" }}</a-select-option>
|
||||
<a-select-option value="every12h">{{ i18n "pages.index.geofileScheduleEvery12h" }}</a-select-option>
|
||||
<a-select-option value="daily">{{ i18n "pages.index.geofileScheduleDaily" }}</a-select-option>
|
||||
<a-select-option value="weekly">{{ i18n "pages.index.geofileScheduleWeekly" }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="geofileUpdateFrequency === 'daily' || geofileUpdateFrequency === 'weekly'"
|
||||
:label='{{ i18n "pages.index.geofileScheduleHour" }}'>
|
||||
<a-select v-model="geofileUpdateHour" style="width: 80px" @change="saveGeofileSchedule"
|
||||
:dropdown-class-name="themeSwitcher.currentTheme">
|
||||
<a-select-option v-for="h in 24" :key="h-1" :value="h-1">[[ h-1 ]]</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-modal>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -166,6 +166,14 @@
|
|||
"geofileSyncUpdateDialog" = "是否在所有节点同步更新 Geofiles?"
|
||||
"geofileSyncUpdateDialogDesc" = "这将更新主节点和所有子节点的 Geofiles,更新完成后各节点将重启 Xray 以应用新的规则文件。"
|
||||
"geofileUpdatePopover" = "地理文件更新成功"
|
||||
"geofileScheduleTitle" = "定时更新"
|
||||
"geofileScheduleEnable" = "启用"
|
||||
"geofileScheduleFrequency" = "更新频率"
|
||||
"geofileScheduleHour" = "更新小时"
|
||||
"geofileScheduleHourly" = "每小时"
|
||||
"geofileScheduleEvery12h" = "每12小时"
|
||||
"geofileScheduleDaily" = "每天"
|
||||
"geofileScheduleWeekly" = "每周"
|
||||
"dontRefresh" = "安装中,请勿刷新此页面"
|
||||
"logs" = "日志"
|
||||
"config" = "配置"
|
||||
|
|
|
|||
Loading…
Reference in a new issue