feat: Change sync customAppConfig logic (#8509)

This commit is contained in:
ChengPlay 2025-04-29 15:57:56 +08:00 committed by GitHub
parent 01578092e2
commit 0b581b748b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 22 additions and 5 deletions

View file

@ -1,8 +1,10 @@
package repo
import (
"errors"
"github.com/1Panel-dev/1Panel/core/app/model"
"github.com/1Panel-dev/1Panel/core/global"
"gorm.io/gorm"
)
type SettingRepo struct{}
@ -61,5 +63,13 @@ func (u *SettingRepo) Update(key, value string) error {
}
func (u *SettingRepo) UpdateOrCreate(key, value string) error {
return global.DB.Model(&model.Setting{}).Where("key = ?", key).Assign(model.Setting{Key: key, Value: value}).FirstOrCreate(&model.Setting{}).Error
var setting model.Setting
result := global.DB.Where("key = ?", key).First(&setting)
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
return global.DB.Create(&model.Setting{Key: key, Value: value}).Error
}
return result.Error
}
return global.DB.Model(&setting).UpdateColumn("value", value).Error
}

View file

@ -46,6 +46,7 @@ const (
SyncSystemProxy = "SyncSystemProxy"
SyncBackupAccounts = "SyncBackupAccounts"
SyncAlertSetting = "SyncAlertSetting"
SyncCustomApp = "SyncCustomApp"
)
var WebUrlMap = map[string]struct{}{

View file

@ -1874,8 +1874,7 @@ const message = {
upgradeNotes: 'Release note',
upgradeNow: 'Upgrade now',
source: 'Download source',
versionNotSame:
'Node version mismatch with the main node. Please upgrade in Node Management before retrying.',
versionNotSame: 'Node version mismatch with the main node. Please upgrade in Node Management before retrying.',
versionCompare:
'Detected that node {0} is already at the latest upgradable version. Please check the primary node version and try again!',
@ -3326,6 +3325,7 @@ const message = {
offline: 'Offline mode',
freeCount: 'Free quota [{0}]',
offlineHelper: 'Used when the node is in an offline environment',
SyncCustomApp: 'Sync Custom App Repository',
},
customApp: {
name: 'Custom App Repository',

View file

@ -3185,6 +3185,7 @@ const message = {
offline: 'オフラインモード',
freeCount: '無料枠 [{0}]',
offlineHelper: 'ノードがオフライン環境にある場合に使用',
SyncCustomApp: 'カスタムアプリリポジトリを同期',
},
customApp: {
name: 'カスタムアプリリポジトリ',

View file

@ -1754,8 +1754,7 @@ const message = {
upgradeNotes: '릴리스 노트',
upgradeNow: '지금 업그레이드',
source: '다운로드 소스',
versionNotSame:
'노드 버전이 메인 노드와 일치하지 않습니다. 노드 관리에서 업그레이드한 다시 시도해 주세요.',
versionNotSame: '노드 버전이 메인 노드와 일치하지 않습니다. 노드 관리에서 업그레이드한 다시 시도해 주세요.',
versionCompare:
'노드 {0}() 이미 업그레이드 가능한 최신 버전입니다. 마스터 노드 버전을 확인 다시 시도하세요!',
@ -3132,6 +3131,7 @@ const message = {
offline: '오프라인 모드',
freeCount: '무료 할당량 [{0}]',
offlineHelper: '노드가 오프라인 환경일 사용',
SyncCustomApp: '사용자 정의 저장소 동기화',
},
customApp: {
name: '사용자 정의 저장소',

View file

@ -3255,6 +3255,7 @@ const message = {
offline: 'Mod luar talian',
freeCount: 'Had percuma [{0}]',
offlineHelper: 'Digunakan apabila nod berada dalam persekitaran luar talian',
SyncCustomApp: 'Segerakan Repositori Aplikasi Tersuai',
},
customApp: {
name: 'Repositori Aplikasi Khusus',

View file

@ -3260,6 +3260,7 @@ const message = {
offline: 'Modo offline',
freeCount: 'Cota gratuita [{0}]',
offlineHelper: 'Usado quando o está em ambiente offline',
SyncCustomApp: 'Sincronizar Repositório de Aplicativos Personalizados',
},
customApp: {
name: 'Repositório de Aplicativos Personalizados',

View file

@ -3249,6 +3249,7 @@ const message = {
offline: 'Автономный режим',
freeCount: 'Бесплатная квота [{0}]',
offlineHelper: 'Используется, когда узел находится в автономной среде',
SyncCustomApp: 'Синхронизировать пользовательский репозиторий приложений',
},
customApp: {
name: 'Пользовательское хранилище приложений',

View file

@ -3086,6 +3086,7 @@ const message = {
offline: '離線模式',
freeCount: '免費額度 [{0}]',
offlineHelper: '當節點處於離線環境時使用',
SyncCustomApp: '同步自訂應用倉庫',
},
customApp: {
name: '自訂應用倉庫',

View file

@ -3068,6 +3068,7 @@ const message = {
offline: '离线模式',
freeCount: '免费额度 [{0}] ',
offlineHelper: '节点为离线环境时使用',
SyncCustomApp: '同步自定义应用仓库',
},
customApp: {
name: '自定义应用仓库',