Compare commits

..

2 commits

Author SHA1 Message Date
Vladislav Tupikin
1b6684474f
Merge c00d51a6b6 into 38d87230d3 2026-03-30 09:05:17 +00:00
Vladislav Tupikin
c00d51a6b6 feat: add custom geosite/geoip URL sources
Register DB model, panel API, index/xray UI, and i18n.
2026-03-30 12:01:33 +03:00
15 changed files with 20 additions and 21 deletions

View file

@ -143,8 +143,8 @@ func (a *CustomGeoController) delete(c *gin.Context) {
if !ok {
return
}
name, err := a.customGeoService.Delete(id)
jsonMsg(c, I18nWeb(c, "pages.index.customGeoToastDelete", "fileName=="+name), mapCustomGeoErr(c, err))
err := a.customGeoService.Delete(id)
jsonMsg(c, I18nWeb(c, "pages.index.customGeoToastDelete"), mapCustomGeoErr(c, err))
}
func (a *CustomGeoController) download(c *gin.Context) {

View file

@ -425,18 +425,17 @@ func (s *CustomGeoService) Update(id int, r *model.CustomGeoResource) error {
return nil
}
func (s *CustomGeoService) Delete(id int) (displayName string, err error) {
func (s *CustomGeoService) Delete(id int) error {
var r model.CustomGeoResource
if err := database.GetDB().First(&r, id).Error; err != nil {
if database.IsNotFound(err) {
return "", ErrCustomGeoNotFound
return ErrCustomGeoNotFound
}
return "", err
return err
}
displayName = s.fileNameFor(r.Type, r.Alias)
p := s.resolveDestPath(&r)
if err := database.GetDB().Delete(&model.CustomGeoResource{}, id).Error; err != nil {
return displayName, err
return err
}
if p != "" {
if _, err := os.Stat(p); err == nil {
@ -449,7 +448,7 @@ func (s *CustomGeoService) Delete(id int) (displayName string, err error) {
if err := s.serverService.RestartXrayService(); err != nil {
logger.Warning("custom geo delete: restart xray:", err)
}
return displayName, nil
return nil
}
func (s *CustomGeoService) GetAll() ([]model.CustomGeoResource, error) {

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "قائمة geo المخصص"
"customGeoToastAdd" = "إضافة geo مخصص"
"customGeoToastUpdate" = "تحديث geo مخصص"
"customGeoToastDelete" = "تم حذف geofile «{{ .fileName }}» المخصص"
"customGeoToastDelete" = "حذف geo مخصص"
"customGeoToastDownload" = "تم تحديث geofile «{{ .fileName }}»"
"customGeoErrInvalidType" = "يجب أن يكون النوع geosite أو geoip"
"customGeoErrAliasRequired" = "الاسم المستعار مطلوب"

View file

@ -177,7 +177,7 @@
"customGeoToastList" = "Custom geo list"
"customGeoToastAdd" = "Add custom geo"
"customGeoToastUpdate" = "Update custom geo"
"customGeoToastDelete" = "Custom geo file “{{ .fileName }}” deleted"
"customGeoToastDelete" = "Delete custom geo"
"customGeoToastDownload" = "Geofile “{{ .fileName }}” updated"
"customGeoErrInvalidType" = "Type must be geosite or geoip"
"customGeoErrAliasRequired" = "Alias is required"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Lista de geo personalizado"
"customGeoToastAdd" = "Añadir geo personalizado"
"customGeoToastUpdate" = "Actualizar geo personalizado"
"customGeoToastDelete" = "Geofile personalizado «{{ .fileName }}» eliminado"
"customGeoToastDelete" = "Eliminar geo personalizado"
"customGeoToastDownload" = "Geofile «{{ .fileName }}» actualizado"
"customGeoErrInvalidType" = "El tipo debe ser geosite o geoip"
"customGeoErrAliasRequired" = "El alias es obligatorio"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "فهرست geo سفارشی"
"customGeoToastAdd" = "افزودن geo سفارشی"
"customGeoToastUpdate" = "به‌روزرسانی geo سفارشی"
"customGeoToastDelete" = "geofile سفارشی «{{ .fileName }}» حذف شد"
"customGeoToastDelete" = "حذف geo سفارشی"
"customGeoToastDownload" = "geofile «{{ .fileName }}» به‌روزرسانی شد"
"customGeoErrInvalidType" = "نوع باید geosite یا geoip باشد"
"customGeoErrAliasRequired" = "نام مستعار لازم است"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Daftar geo kustom"
"customGeoToastAdd" = "Tambah geo kustom"
"customGeoToastUpdate" = "Perbarui geo kustom"
"customGeoToastDelete" = "Geofile kustom “{{ .fileName }}” dihapus"
"customGeoToastDelete" = "Hapus geo kustom"
"customGeoToastDownload" = "Geofile “{{ .fileName }}” diperbarui"
"customGeoErrInvalidType" = "Jenis harus geosite atau geoip"
"customGeoErrAliasRequired" = "Alias wajib diisi"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "カスタム geo 一覧"
"customGeoToastAdd" = "カスタム geo を追加"
"customGeoToastUpdate" = "カスタム geo を更新"
"customGeoToastDelete" = "カスタム geofile「{{ .fileName }}」を削除しました"
"customGeoToastDelete" = "カスタム geo を削除"
"customGeoToastDownload" = "geofile「{{ .fileName }}」を更新しました"
"customGeoErrInvalidType" = "種類は geosite または geoip である必要があります"
"customGeoErrAliasRequired" = "エイリアスが必要です"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Lista de geo personalizado"
"customGeoToastAdd" = "Adicionar geo personalizado"
"customGeoToastUpdate" = "Atualizar geo personalizado"
"customGeoToastDelete" = "Geofile personalizado “{{ .fileName }}” excluído"
"customGeoToastDelete" = "Excluir geo personalizado"
"customGeoToastDownload" = "Geofile “{{ .fileName }}” atualizado"
"customGeoErrInvalidType" = "O tipo deve ser geosite ou geoip"
"customGeoErrAliasRequired" = "Alias é obrigatório"

View file

@ -177,7 +177,7 @@
"customGeoToastList" = "Список пользовательских geo"
"customGeoToastAdd" = "Добавить пользовательский geo"
"customGeoToastUpdate" = "Изменить пользовательский geo"
"customGeoToastDelete" = "Пользовательский geo-файл «{{ .fileName }}» удалён"
"customGeoToastDelete" = "Удалить пользовательский geo"
"customGeoToastDownload" = "Geofile «{{ .fileName }}» обновлен"
"customGeoErrInvalidType" = "Тип должен быть geosite или geoip"
"customGeoErrAliasRequired" = "Укажите псевдоним"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Özel geo listesi"
"customGeoToastAdd" = "Özel geo ekle"
"customGeoToastUpdate" = "Özel geo güncelle"
"customGeoToastDelete" = "Özel geofile \"{{ .fileName }}\" silindi"
"customGeoToastDelete" = "Özel geo sil"
"customGeoToastDownload" = "\"{{ .fileName }}\" geofile güncellendi"
"customGeoErrInvalidType" = "Tür geosite veya geoip olmalıdır"
"customGeoErrAliasRequired" = "Takma ad gerekli"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Список користувацьких geo"
"customGeoToastAdd" = "Додати користувацький geo"
"customGeoToastUpdate" = "Оновити користувацький geo"
"customGeoToastDelete" = "Користувацький geofile «{{ .fileName }}» видалено"
"customGeoToastDelete" = "Видалити користувацький geo"
"customGeoToastDownload" = "Geofile «{{ .fileName }}» оновлено"
"customGeoErrInvalidType" = "Тип має бути geosite або geoip"
"customGeoErrAliasRequired" = "Потрібен псевдонім"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "Danh sách geo tùy chỉnh"
"customGeoToastAdd" = "Thêm geo tùy chỉnh"
"customGeoToastUpdate" = "Cập nhật geo tùy chỉnh"
"customGeoToastDelete" = "Đã xóa geofile tùy chỉnh “{{ .fileName }}”"
"customGeoToastDelete" = "Xóa geo tùy chỉnh"
"customGeoToastDownload" = "Đã cập nhật geofile “{{ .fileName }}”"
"customGeoErrInvalidType" = "Loại phải là geosite hoặc geoip"
"customGeoErrAliasRequired" = "Cần bí danh"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "自定义 geo 列表"
"customGeoToastAdd" = "添加自定义 geo"
"customGeoToastUpdate" = "更新自定义 geo"
"customGeoToastDelete" = "自定义 geofile「{{ .fileName }}」已删除"
"customGeoToastDelete" = "删除自定义 geo"
"customGeoToastDownload" = "geofile「{{ .fileName }}」已更新"
"customGeoErrInvalidType" = "类型必须是 geosite 或 geoip"
"customGeoErrAliasRequired" = "请填写别名"

View file

@ -191,7 +191,7 @@
"customGeoToastList" = "自訂 geo 清單"
"customGeoToastAdd" = "新增自訂 geo"
"customGeoToastUpdate" = "更新自訂 geo"
"customGeoToastDelete" = "自訂 geofile「{{ .fileName }}」已刪除"
"customGeoToastDelete" = "刪除自訂 geo"
"customGeoToastDownload" = "geofile「{{ .fileName }}」已更新"
"customGeoErrInvalidType" = "類型必須是 geosite 或 geoip"
"customGeoErrAliasRequired" = "請填寫別名"