fix: fix some bugs with appstore (#8567)

This commit is contained in:
CityFun 2025-05-07 18:05:40 +08:00 committed by GitHub
parent af2b53412d
commit f1cd0927d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 59 additions and 39 deletions

View file

@ -99,6 +99,7 @@ type AppProperty struct {
MemoryRequired int `json:"memoryRequired"`
GpuSupport bool `json:"gpuSupport"`
Version float64 `json:"version"`
Deprecated float64 `json:"deprecated"`
}
type AppConfigVersion struct {

View file

@ -148,7 +148,7 @@ func (a AppRepo) BatchDelete(ctx context.Context, apps []model.App) error {
}
func (a AppRepo) DeleteByIDs(ctx context.Context, ids []uint) error {
return getTx(ctx).Where("id in (?)", ids).Delete(&model.App{}).Error
return getTx(ctx).Debug().Where("id in (?)", ids).Delete(&model.App{}).Error
}
func (a AppRepo) DeleteBy(opts ...DBOption) error {

View file

@ -1185,11 +1185,16 @@ func getApps(oldApps []model.App, items []dto.AppDefine, systemVersion string, t
apps[old.Key] = old
}
for _, item := range items {
if item.AppProperty.Version > 0 && common.CompareVersion(strconv.FormatFloat(item.AppProperty.Version, 'f', -1, 64), systemVersion) {
config := item.AppProperty
if config.Version > 0 && common.CompareVersion(strconv.FormatFloat(config.Version, 'f', -1, 64), systemVersion) {
task.Log(i18n.GetWithName("AppVersionNotMatch", item.Name))
continue
}
config := item.AppProperty
if config.Deprecated > 0 && common.CompareAppVersion(systemVersion, strconv.FormatFloat(config.Deprecated, 'f', -1, 64)) {
task.Log(i18n.GetWithName("AppVersionNotMatch", item.Name))
continue
}
key := config.Key
app, ok := apps[key]
if !ok {

View file

@ -235,14 +235,14 @@ func (n NginxService) Build(req request.NginxBuildReq) error {
if err != nil {
return err
}
buildTask.AddSubTask("", func(t *task.Task) error {
cmdMgr := cmd2.NewCommandMgr(cmd.WithTask(*buildTask), cmd.WithTimeout(15*time.Minute))
buildTask.AddSubTaskWithOps("", func(t *task.Task) error {
cmdMgr := cmd2.NewCommandMgr(cmd.WithTask(*buildTask), cmd.WithTimeout(60*time.Minute))
if err = cmdMgr.RunBashCf("docker compose -f %s build", nginxInstall.GetComposePath()); err != nil {
return err
}
_, err = compose.DownAndUp(nginxInstall.GetComposePath())
return err
}, nil)
}, nil, 0, 60*time.Minute)
go func() {
_ = buildTask.Execute()

View file

@ -142,12 +142,12 @@ func NewTask(name, operate, taskScope, taskID string, resourceID uint) (*Task, e
}
func (t *Task) AddSubTask(name string, action ActionFunc, rollback RollbackFunc) {
subTask := &SubTask{RootTask: t, Name: name, Retry: 0, Timeout: 10 * time.Minute, Action: action, Rollback: rollback}
subTask := &SubTask{RootTask: t, Name: name, Retry: 0, Timeout: 30 * time.Minute, Action: action, Rollback: rollback}
t.SubTasks = append(t.SubTasks, subTask)
}
func (t *Task) AddSubTaskWithAlias(key string, action ActionFunc, rollback RollbackFunc) {
subTask := &SubTask{RootTask: t, Name: i18n.GetMsgByKey(key), StepAlias: key, Retry: 0, Timeout: 10 * time.Minute, Action: action, Rollback: rollback}
subTask := &SubTask{RootTask: t, Name: i18n.GetMsgByKey(key), StepAlias: key, Retry: 0, Timeout: 30 * time.Minute, Action: action, Rollback: rollback}
t.SubTasks = append(t.SubTasks, subTask)
}
@ -157,7 +157,7 @@ func (t *Task) AddSubTaskWithOps(name string, action ActionFunc, rollback Rollba
}
func (t *Task) AddSubTaskWithIgnoreErr(name string, action ActionFunc) {
subTask := &SubTask{RootTask: t, Name: name, Retry: 0, Timeout: 10 * time.Minute, Action: action, Rollback: nil, IgnoreErr: true}
subTask := &SubTask{RootTask: t, Name: name, Retry: 0, Timeout: 30 * time.Minute, Action: action, Rollback: nil, IgnoreErr: true}
t.SubTasks = append(t.SubTasks, subTask)
}

View file

@ -90,6 +90,7 @@ PullImageTimeout: 'Pull image timeout, please try to increase the image accelera
ErrAppIsDown: '{{ .name }} application status is abnormal, please check'
ErrCustomApps: 'There is an installed application, please uninstall it first'
ErrCustomRuntimes: 'There is an installed runtime environment, please delete it first'
ErrAppVersionDeprecated: "The {{ .name }} application is not compatible with the current 1Panel version, skipped"
#file
ErrFileCanNotRead: 'This file does not support preview'

View file

@ -90,6 +90,7 @@ PullImageTimeout: 'プル イメージのタイムアウトです。イメージ
ErrAppIsDown: '{{ .name }} アプリケーションの状態が異常です。確認してください'
ErrCustomApps: 'インストールされているアプリケーションがあります。まずアンインストールしてください'
ErrCustomRuntimes: 'ランタイム環境がインストールされています。まずそれを削除してください'
ErrAppVersionDeprecated: "{{ .name }} アプリケーションは現在の 1Panel バージョンと互換性がありません、スキップしました"
#file
ErrFileCanNotRead: 'このファイルはプレビューをサポートしていません'

View file

@ -90,6 +90,7 @@ PullImageTimeout: '이미지 가져오기 시간 초과, 이미지 가속을 높
ErrAppIsDown: '{{ .name }} 애플리케이션 상태가 비정상적입니다. 확인해 주세요'
ErrCustomApps: '설치된 애플리케이션이 있습니다. 먼저 제거해 주세요'
ErrCustomRuntimes: '설치된 런타임 환경이 있습니다. 먼저 삭제해 주세요'
ErrAppVersionDeprecated: "{{ .name }} 응용 프로그램은 현재 1Panel 버전과 호환되지 않아 건너뛰었습니다"
#파일
ErrFileCanNotRead: '이 파일은 미리보기를 지원하지 않습니다'

View file

@ -90,6 +90,7 @@ PullImageTimeout: 'Tarik tamat masa imej, sila cuba tingkatkan pecutan imej atau
ErrAppIsDown: 'Status permohonan {{ .name }} tidak normal, sila semak'
ErrCustomApps: 'Ada aplikasi yang dipasang, sila nyahpasangnya dahulu'
ErrCustomRuntimes: 'Terdapat persekitaran masa jalan yang dipasang, sila padamkannya dahulu'
ErrAppVersionDeprecated: "Aplikasi {{ .name }} tidak sesuai dengan versi 1Panel saat ini, dilewati"
#fail
ErrFileCanNotRead: 'Fail ini tidak menyokong pratonton'

View file

@ -90,6 +90,7 @@ PullImageTimeout: 'Tempo limite para puxar imagem, tente aumentar a aceleração
ErrAppIsDown: 'O status do aplicativo {{ .name }} é anormal, verifique'
ErrCustomApps: 'Há um aplicativo instalado, desinstale-o primeiro'
ErrCustomRuntimes: 'Há um ambiente de execução instalado, exclua-o primeiro'
ErrAppVersionDeprecated: "O aplicativo {{ .name }} não é compatível com a versão atual do 1Panel, ignorado"
#arquivo
ErrFileCanNotRead: 'Este arquivo não suporta visualização'

View file

@ -90,6 +90,7 @@ PullImageTimeout: 'Истекло время ожидания извлечени
ErrAppIsDown: '{{ .name }} статус приложения ненормальный, проверьте'
ErrCustomApps: 'Установлено приложение. Сначала удалите его'
ErrCustomRuntimes: 'Установлена среда выполнения. Сначала удалите ее'
ErrAppVersionDeprecated: "Приложение {{ .name }} несовместимо с текущей версией 1Panel, пропущено"
#файл
ErrFileCanNotRead: 'Этот файл не поддерживает предварительный просмотр'

View file

@ -90,6 +90,7 @@ PullImageTimeout: '拉取鏡像逾時,請嘗試增加鏡像加速或更換其他
ErrAppIsDown: '{{ .name }} 應用程式狀態異常,請檢查'
ErrCustomApps: '存在已安裝的應用程式,請先解除安裝'
ErrCustomRuntimes: '存在已安裝的運作環境,請先刪除'
ErrAppVersionDeprecated: "{{ .name }} 應用不適配當前 1Panel 版本,跳過"
#file
ErrFileCanNotRead: '此檔案不支援預覽'

View file

@ -89,6 +89,7 @@ PullImageTimeout: "拉取镜像超时,请尝试增加镜像加速或者更换其
ErrAppIsDown: "{{ .name }} 应用状态异常,请检查"
ErrCustomApps: "存在已经安装的应用,请先卸载"
ErrCustomRuntimes: "存在已经安装的运行环境,请先删除"
ErrAppVersionDeprecated: " {{ .name }} 应用不适配当前 1Panel 版本,跳过"
#file
ErrFileCanNotRead: "此文件不支持预览"

View file

@ -49,6 +49,10 @@ func RunDefaultWithStdoutBashCf(command string, arg ...interface{}) (string, err
mgr := NewCommandMgr(WithTimeout(20 * time.Second))
return mgr.RunWithStdoutBashCf(command, arg...)
}
func RunDefaultWithStdoutBashCfAndTimeOut(command string, timeout time.Duration, arg ...interface{}) (string, error) {
mgr := NewCommandMgr(WithTimeout(timeout))
return mgr.RunWithStdoutBashCf(command, arg...)
}
func (c *CommandHelper) Run(name string, arg ...string) error {
_, err := c.run(name, arg...)

View file

@ -2,10 +2,11 @@ package compose
import (
"github.com/1Panel-dev/1Panel/agent/utils/cmd"
"time"
)
func Up(filePath string) (string, error) {
stdout, err := cmd.RunDefaultWithStdoutBashCf("docker compose -f %s up -d", filePath)
stdout, err := cmd.RunDefaultWithStdoutBashCfAndTimeOut("docker compose -f %s up -d", 20*time.Minute, filePath)
return stdout, err
}

View file

@ -117,6 +117,7 @@ const timeOptions = ref([
const stopListening = () => {
if (eventSource) {
eventSource.close();
eventSource = null;
}
};
@ -130,8 +131,8 @@ const searchLogs = async () => {
MsgError(i18n.global.t('container.linesHelper'));
return;
}
stopListening();
if (!logSearch.isWatch) {
stopListening();
return;
}
logs.value = [];

View file

@ -2134,9 +2134,9 @@ const message = {
specifyIP: 'Bind Host IP',
specifyIPHelper:
'Set the host address/network interface to bind the port (if you are not sure about this, please do not fill it in)',
uninstallDeleteBackup: 'Uninstall App Deletes Backup',
uninstallDeleteImage: 'Uninstall App Deletes Image',
upgradeBackup: 'Backup Before Upgrading App',
uninstallDeleteBackup: 'Uninstall App - Delete Backup',
uninstallDeleteImage: 'Uninstall App - Delete Image',
upgradeBackup: 'Backup App Before Upgrade',
},
website: {
primaryDomain: 'Primary Domain',

View file

@ -2039,9 +2039,9 @@ const message = {
specifyIP: 'ホスト IP をバインド',
specifyIPHelper:
'ポートにバインドするホストアドレス/ネットワークインターフェースを設定しますこの機能がわからない場合は入力しないでください',
uninstallDeleteBackup: 'アプリをアンインストールしてバックアップを削除',
uninstallDeleteImage: 'アプリをアンインストールしてイメージを削除',
upgradeBackup: 'アプリのアップグレード前にバックアップ',
uninstallDeleteBackup: 'アプリをアンインストール - バックアップを削除',
uninstallDeleteImage: 'アプリをアンインストール - イメージを削除',
upgradeBackup: 'アプリのアップグレード前にアプリをバックアップ',
},
website: {
primaryDomain: 'プライマリドメイン',

View file

@ -2004,9 +2004,9 @@ const message = {
specifyIP: '호스트 IP 바인딩',
specifyIPHelper:
'포트 바인딩을 위한 호스트 주소/네트워크 인터페이스를 설정합니다 ( 기능을 모를 경우, 입력하지 마십시오)',
uninstallDeleteBackup: ' 제거 백업 삭제',
uninstallDeleteImage: ' 제거 이미지 삭제',
upgradeBackup: ' 업그레이드 백업',
uninstallDeleteBackup: ' 제거 - 백업 삭제',
uninstallDeleteImage: ' 제거 - 이미지 삭제',
upgradeBackup: ' 업그레이드 백업',
},
website: {
primaryDomain: '기본 도메인',

View file

@ -2095,7 +2095,7 @@ const message = {
'Tetapkan alamat hos/antara muka rangkaian untuk mengikat port (jika anda tidak pasti mengenai ini, jangan isi)',
uninstallDeleteBackup: 'Cop Terhapus Semasa Nyahpasang Aplikasi',
uninstallDeleteImage: 'Imej Terhapus Semasa Nyahpasang Aplikasi',
upgradeBackup: 'Sandaran Sebelum Naik Taraf Aplikasi',
upgradeBackup: 'Sandaran Aplikasi Sebelum Naik Taraf',
},
website: {
primaryDomain: 'Domain Utama',

View file

@ -2086,9 +2086,9 @@ const message = {
specifyIP: 'Vincular IP do Host',
specifyIPHelper:
'Defina o endereço do host/interface de rede para vincular a porta (se você não tiver certeza sobre isso, por favor, não preencha)',
uninstallDeleteBackup: 'Desinstalar Aplicativo Deleta Backup',
uninstallDeleteImage: 'Desinstalar Aplicativo Deleta Imagem',
upgradeBackup: 'Fazer Backup Antes de Atualizar o Aplicativo',
uninstallDeleteBackup: 'Desinstalar Aplicativo - Excluir Backup',
uninstallDeleteImage: 'Desinstalar Aplicativo - Excluir Imagem',
upgradeBackup: 'Fazer Backup do Aplicativo Antes de Atualizar',
},
website: {
primaryDomain: 'Domínio principal',

View file

@ -2086,9 +2086,9 @@ const message = {
specifyIP: 'Привязать IP хоста',
specifyIPHelper:
'Установите адрес хоста/сетевого интерфейса для привязки порта (если вы не уверены в этом, пожалуйста, не заполняйте)',
uninstallDeleteBackup: 'Деинсталляция приложения удаляет резервную копию',
uninstallDeleteImage: 'Деинсталляция приложения удаляет образ',
upgradeBackup: 'Резервное копирование перед обновлением приложения',
uninstallDeleteBackup: 'Деинсталляция приложения - Удаление резервной копии',
uninstallDeleteImage: 'Деинсталляция приложения - Удаление образа',
upgradeBackup: 'Резервное копирование приложения перед обновлением',
},
website: {
primaryDomain: 'Основной домен',

View file

@ -1974,9 +1974,9 @@ const message = {
ignoreVersion: '忽略指定版本',
specifyIP: '綁定主機 IP',
specifyIPHelper: '設置端口綁定的主機地址/網卡如果你不清楚這個的作用請不要填寫',
uninstallDeleteBackup: '卸載應用刪除備份',
uninstallDeleteImage: '卸載應用刪除鏡像',
upgradeBackup: '升級應用前備份',
uninstallDeleteBackup: '卸載應用-刪除備份',
uninstallDeleteImage: '卸載應用-刪除鏡像',
upgradeBackup: '應用升級前備份應用',
},
website: {
primaryDomain: '主域名',

View file

@ -1964,9 +1964,9 @@ const message = {
ignoreVersion: '忽略指定版本',
specifyIP: '绑定主机 IP',
specifyIPHelper: '设置端口绑定的主机地址/网卡如果你不清楚这个的作用请不要填写',
uninstallDeleteBackup: '卸载应用删除备份',
uninstallDeleteImage: '卸载应用删除镜像',
upgradeBackup: '升级应用前备份',
uninstallDeleteBackup: '卸载应用-删除备份',
uninstallDeleteImage: '卸载应用-删除镜像',
upgradeBackup: '应用升级前备份应用',
},
website: {
primaryDomain: '主域名',
@ -3091,7 +3091,7 @@ const message = {
offlineHelper: '节点为离线环境时使用',
},
customApp: {
name: '自定义应用仓库',
name: '自定义仓库',
appStoreType: '仓库来源',
appStoreUrl: '仓库地址',
local: '本地',
@ -3099,7 +3099,7 @@ const message = {
imagePrefix: '镜像前缀',
imagePrefixHelper:
'作用自定义镜像前缀修改 compose 文件中的镜像字段例如当镜像前缀设置为 1panel/custom MaxKB image 字段将变更为 1panel/custom/maxkb:v1.10.0',
closeHelper: '是否取消使用自定义应用仓库',
closeHelper: '是否取消使用自定义仓库',
appStoreUrlHelper: '仅支持 .tar.gz 格式',
postNode: '同步至子节点',
postNodeHelper: '把自定义商店包同步至子节点的安装目录下的 tmp/customApp/apps.tar.gz ',

View file

@ -12,12 +12,12 @@
label="http://mirrors.aliyun.com/ubuntu/"
></el-option>
<el-option
value="https://mirrors.tuna.tsinghua.edu.cn/ubuntu/"
label="https://mirrors.tuna.tsinghua.edu.cn/ubuntu/"
value="http://mirrors.tuna.tsinghua.edu.cn/ubuntu/"
label="http://mirrors.tuna.tsinghua.edu.cn/ubuntu/"
></el-option>
<el-option
value="https://mirrors.ustc.edu.cn/ubuntu/"
label="https://mirrors.ustc.edu.cn/ubuntu/"
value="http://mirrors.ustc.edu.cn/ubuntu/"
label="http://mirrors.ustc.edu.cn/ubuntu/"
></el-option>
</el-select>
</el-form-item>