mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-08-23 03:16:52 +00:00
Added Update all geofiles button (#3318)
* added Update all geofiles button * localized update all string
This commit is contained in:
parent
58898e5758
commit
5e641ff9e8
16 changed files with 68 additions and 16 deletions
|
@ -45,6 +45,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
|
|||
g.POST("/stopXrayService", a.stopXrayService)
|
||||
g.POST("/restartXrayService", a.restartXrayService)
|
||||
g.POST("/installXray/:version", a.installXray)
|
||||
g.POST("/updateGeofile", a.updateGeofile)
|
||||
g.POST("/updateGeofile/:fileName", a.updateGeofile)
|
||||
g.POST("/logs/:count", a.getLogs)
|
||||
g.POST("/xraylogs/:count", a.getXrayLogs)
|
||||
|
|
|
@ -383,6 +383,9 @@
|
|||
<a-icon type="reload" @click="updateGeofile(file)" :style="{ marginRight: '8px' }"/>
|
||||
</a-list-item>
|
||||
</a-list>
|
||||
<div style="margin-top: 5px; display: flex; justify-content: flex-end;">
|
||||
<a-button @click="updateGeofile('')">{{ i18n "pages.index.geofilesUpdateAll" }}</a-button>
|
||||
</div>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-modal>
|
||||
|
@ -786,16 +789,22 @@ ${dateTime}
|
|||
});
|
||||
},
|
||||
updateGeofile(fileName) {
|
||||
const isSingleFile = !!fileName;
|
||||
this.$confirm({
|
||||
title: '{{ i18n "pages.index.geofileUpdateDialog" }}',
|
||||
content: '{{ i18n "pages.index.geofileUpdateDialogDesc" }}'.replace("#filename#", fileName),
|
||||
content: isSingleFile
|
||||
? '{{ i18n "pages.index.geofileUpdateDialogDesc" }}'.replace("#filename#", fileName)
|
||||
: '{{ i18n "pages.index.geofilesUpdateDialogDesc" }}',
|
||||
okText: '{{ i18n "confirm"}}',
|
||||
class: themeSwitcher.currentTheme,
|
||||
cancelText: '{{ i18n "cancel"}}',
|
||||
onOk: async () => {
|
||||
versionModal.hide();
|
||||
this.loading(true, '{{ i18n "pages.index.dontRefresh"}}');
|
||||
await HttpUtil.post(`/server/updateGeofile/${fileName}`);
|
||||
const url = isSingleFile
|
||||
? `/server/updateGeofile/${fileName}`
|
||||
: `/server/updateGeofile`;
|
||||
await HttpUtil.post(url);
|
||||
this.loading(false);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -742,6 +742,19 @@ func (s *ServerService) UpdateGeofile(fileName string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var errorMessages []string
|
||||
|
||||
if fileName == "" {
|
||||
for _, file := range files {
|
||||
destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), file.FileName)
|
||||
|
||||
if err := downloadFile(file.URL, destPath); err != nil {
|
||||
errorMessages = append(errorMessages, fmt.Sprintf("Error downloading Geofile '%s': %v", file.FileName, err))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), fileName)
|
||||
|
||||
var fileURL string
|
||||
for _, file := range files {
|
||||
if file.FileName == fileName {
|
||||
|
@ -751,18 +764,21 @@ func (s *ServerService) UpdateGeofile(fileName string) error {
|
|||
}
|
||||
|
||||
if fileURL == "" {
|
||||
return common.NewErrorf("File '%s' not found in the list of Geofiles", fileName)
|
||||
errorMessages = append(errorMessages, fmt.Sprintf("File '%s' not found in the list of Geofiles", fileName))
|
||||
}
|
||||
|
||||
destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), fileName)
|
||||
|
||||
if err := downloadFile(fileURL, destPath); err != nil {
|
||||
return common.NewErrorf("Error downloading Geofile '%s': %v", fileName, err)
|
||||
errorMessages = append(errorMessages, fmt.Sprintf("Error downloading Geofile '%s': %v", fileName, err))
|
||||
}
|
||||
}
|
||||
|
||||
err := s.RestartXrayService()
|
||||
if err != nil {
|
||||
return common.NewErrorf("Updated Geofile '%s' but Failed to start Xray: %v", fileName, err)
|
||||
errorMessages = append(errorMessages, fmt.Sprintf("Updated Geofile '%s' but Failed to start Xray: %v", fileName, err))
|
||||
}
|
||||
|
||||
if len(errorMessages) > 0 {
|
||||
return common.NewErrorf("%s", strings.Join(errorMessages, "\r\n"))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "تم تحديث Xray بنجاح"
|
||||
"geofileUpdateDialog" = "هل تريد حقًا تحديث ملف الجغرافيا؟"
|
||||
"geofileUpdateDialogDesc" = "سيؤدي هذا إلى تحديث ملف #filename#."
|
||||
"geofilesUpdateDialogDesc" = "سيؤدي هذا إلى تحديث كافة الملفات."
|
||||
"geofilesUpdateAll" = "تحديث الكل"
|
||||
"geofileUpdatePopover" = "تم تحديث ملف الجغرافيا بنجاح"
|
||||
"dontRefresh" = "التثبيت شغال، متعملش Refresh للصفحة"
|
||||
"logs" = "السجلات"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray updated successfully"
|
||||
"geofileUpdateDialog" = "Do you really want to update the geofile?"
|
||||
"geofileUpdateDialogDesc" = "This will update the #filename# file."
|
||||
"geofilesUpdateDialogDesc" = "This will update all geofiles."
|
||||
"geofilesUpdateAll" = "Update all"
|
||||
"geofileUpdatePopover" = "Geofile updated successfully"
|
||||
"dontRefresh" = "Installation is in progress, please do not refresh this page"
|
||||
"logs" = "Logs"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray se actualizó correctamente"
|
||||
"geofileUpdateDialog" = "¿Realmente deseas actualizar el geofichero?"
|
||||
"geofileUpdateDialogDesc" = "Esto actualizará el archivo #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Esto actualizará todos los archivos."
|
||||
"geofilesUpdateAll" = "Actualizar todo"
|
||||
"geofileUpdatePopover" = "Geofichero actualizado correctamente"
|
||||
"dontRefresh" = "La instalación está en progreso, por favor no actualices esta página."
|
||||
"logs" = "Registros"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray با موفقیت بهروز شد"
|
||||
"geofileUpdateDialog" = "آیا واقعاً میخواهید فایل جغرافیایی را بهروز کنید؟"
|
||||
"geofileUpdateDialogDesc" = "این عمل فایل #filename# را بهروز میکند."
|
||||
"geofilesUpdateDialogDesc" = "با این کار همه فایلها بهروزرسانی میشوند."
|
||||
"geofilesUpdateAll" = "همه را بهروزرسانی کنید"
|
||||
"geofileUpdatePopover" = "فایل جغرافیایی با موفقیت بهروز شد"
|
||||
"dontRefresh" = "در حال نصب، لطفا صفحه را رفرش نکنید"
|
||||
"logs" = "گزارشها"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray berhasil diperbarui"
|
||||
"geofileUpdateDialog" = "Apakah Anda yakin ingin memperbarui geofile?"
|
||||
"geofileUpdateDialogDesc" = "Ini akan memperbarui file #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Ini akan memperbarui semua berkas."
|
||||
"geofilesUpdateAll" = "Perbarui semua"
|
||||
"geofileUpdatePopover" = "Geofile berhasil diperbarui"
|
||||
"dontRefresh" = "Instalasi sedang berlangsung, harap jangan menyegarkan halaman ini"
|
||||
"logs" = "Log"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xrayの更新が成功しました"
|
||||
"geofileUpdateDialog" = "ジオファイルを本当に更新しますか?"
|
||||
"geofileUpdateDialogDesc" = "これにより#filename#ファイルが更新されます。"
|
||||
"geofilesUpdateDialogDesc" = "これにより、すべてのファイルが更新されます。"
|
||||
"geofilesUpdateAll" = "すべて更新"
|
||||
"geofileUpdatePopover" = "ジオファイルの更新が成功しました"
|
||||
"dontRefresh" = "インストール中、このページをリロードしないでください"
|
||||
"logs" = "ログ"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray atualizado com sucesso"
|
||||
"geofileUpdateDialog" = "Você realmente deseja atualizar o geofile?"
|
||||
"geofileUpdateDialogDesc" = "Isso atualizará o arquivo #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Isso atualizará todos os arquivos."
|
||||
"geofilesUpdateAll" = "Atualizar tudo"
|
||||
"geofileUpdatePopover" = "Geofile atualizado com sucesso"
|
||||
"dontRefresh" = "Instalação em andamento, por favor não atualize a página"
|
||||
"logs" = "Logs"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray успешно обновлён"
|
||||
"geofileUpdateDialog" = "Вы действительно хотите обновить геофайл?"
|
||||
"geofileUpdateDialogDesc" = "Это обновит файл #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Это обновит все геофайлы."
|
||||
"geofilesUpdateAll" = "Обновить все"
|
||||
"geofileUpdatePopover" = "Геофайл успешно обновлён"
|
||||
"dontRefresh" = "Установка в процессе. Не обновляйте страницу"
|
||||
"logs" = "Журнал"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray başarıyla güncellendi"
|
||||
"geofileUpdateDialog" = "Geofile'ı gerçekten güncellemek istiyor musunuz?"
|
||||
"geofileUpdateDialogDesc" = "Bu işlem #filename# dosyasını güncelleyecektir."
|
||||
"geofilesUpdateDialogDesc" = "Bu, tüm dosyaları güncelleyecektir."
|
||||
"geofilesUpdateAll" = "Tümünü güncelle"
|
||||
"geofileUpdatePopover" = "Geofile başarıyla güncellendi"
|
||||
"dontRefresh" = "Kurulum devam ediyor, lütfen bu sayfayı yenilemeyin"
|
||||
"logs" = "Günlükler"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray успішно оновлено"
|
||||
"geofileUpdateDialog" = "Ви дійсно хочете оновити геофайл?"
|
||||
"geofileUpdateDialogDesc" = "Це оновить файл #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Це оновить усі геофайли."
|
||||
"geofilesUpdateAll" = "Оновити все"
|
||||
"geofileUpdatePopover" = "Геофайл успішно оновлено"
|
||||
"dontRefresh" = "Інсталяція триває, будь ласка, не оновлюйте цю сторінку"
|
||||
"logs" = "Журнали"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray đã được cập nhật thành công"
|
||||
"geofileUpdateDialog" = "Bạn có chắc chắn muốn cập nhật geofile không?"
|
||||
"geofileUpdateDialogDesc" = "Hành động này sẽ cập nhật tệp #filename#."
|
||||
"geofilesUpdateDialogDesc" = "Thao tác này sẽ cập nhật tất cả các tập tin."
|
||||
"geofilesUpdateAll" = "Cập nhật tất cả"
|
||||
"geofileUpdatePopover" = "Geofile đã được cập nhật thành công"
|
||||
"dontRefresh" = "Đang tiến hành cài đặt, vui lòng không làm mới trang này."
|
||||
"logs" = "Nhật ký"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray 更新成功"
|
||||
"geofileUpdateDialog" = "您确定要更新地理文件吗?"
|
||||
"geofileUpdateDialogDesc" = "这将更新 #filename# 文件。"
|
||||
"geofilesUpdateDialogDesc" = "这将更新所有文件。"
|
||||
"geofilesUpdateAll" = "全部更新"
|
||||
"geofileUpdatePopover" = "地理文件更新成功"
|
||||
"dontRefresh" = "安装中,请勿刷新此页面"
|
||||
"logs" = "日志"
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
"xraySwitchVersionPopover" = "Xray 更新成功"
|
||||
"geofileUpdateDialog" = "您確定要更新地理檔案嗎?"
|
||||
"geofileUpdateDialogDesc" = "這將更新 #filename# 檔案。"
|
||||
"geofilesUpdateDialogDesc" = "這將更新所有文件。"
|
||||
"geofilesUpdateAll" = "全部更新"
|
||||
"geofileUpdatePopover" = "地理檔案更新成功"
|
||||
"dontRefresh" = "安裝中,請勿重新整理此頁面"
|
||||
"logs" = "日誌"
|
||||
|
|
Loading…
Reference in a new issue