fix: fix some bugs with appstore (#8574)

This commit is contained in:
CityFun 2025-05-08 18:02:25 +08:00 committed by GitHub
parent 69d24a8b90
commit 55ee480ba1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 94 additions and 24 deletions

View file

@ -125,6 +125,7 @@ type Locale struct {
Ru string `json:"ru"`
ZhHant string `json:"zh-hant" yaml:"zh-hant"`
Zh string `json:"zh"`
Ko string `json:"ko"`
}
type AppForm 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).Debug().Where("id in (?)", ids).Delete(&model.App{}).Error
return getTx(ctx).Where("id in (?)", ids).Delete(&model.App{}).Error
}
func (a AppRepo) DeleteBy(opts ...DBOption) error {

View file

@ -102,7 +102,7 @@ func (s *SettingRepo) UpdateOrCreate(key, value string) error {
result := global.DB.Where("key = ?", key).First(&setting)
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
return global.DB.Debug().Create(&model.Setting{Key: key, Value: value}).Error
return global.DB.Create(&model.Setting{Key: key, Value: value}).Error
}
return result.Error
}

View file

@ -355,7 +355,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
}
}
}
if app.Key == "openresty" && app.Resource == "remote" && common.CompareVersion(appDetail.Version, "1.27") {
if app.Key == "openresty" && (app.Resource == "remote" || app.Resource == "custom") && common.CompareVersion(appDetail.Version, "1.27") {
if dir, ok := req.Params["WEBSITE_DIR"]; ok {
siteDir := dir.(string)
if siteDir == "" || !strings.HasPrefix(siteDir, "/") {

View file

@ -405,13 +405,8 @@ func addProxy(server *model.McpServer) {
global.LOG.Errorf("[mcp] add proxy failed, err: %v", err)
return
}
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
if err != nil {
global.LOG.Errorf("[mcp] add proxy failed, err: %v", err)
return
}
fileOp := files.NewFileOp()
includeDir := path.Join(nginxInstall.GetPath(), "www", "sites", website.Alias, "proxy")
includeDir := GetSitePath(website, SiteProxyDir)
if !fileOp.Stat(includeDir) {
if err = fileOp.CreateDir(includeDir, 0644); err != nil {
return
@ -446,16 +441,12 @@ func addMCPProxy(websiteID uint) error {
if len(servers) == 0 {
return nil
}
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
if err != nil {
return err
}
website, err := websiteRepo.GetFirst(repo.WithByID(websiteID))
if err != nil {
return err
}
fileOp := files.NewFileOp()
includeDir := path.Join(nginxInstall.GetPath(), "www", "sites", website.Alias, "proxy")
includeDir := GetSitePath(website, SiteProxyDir)
if !fileOp.Stat(includeDir) {
if err = fileOp.CreateDir(includeDir, 0644); err != nil {
return err

View file

@ -585,7 +585,8 @@ func unInstallPHPExtension(runtime *model.Runtime, delExtensions []string) error
for _, del := range delExtensions {
if ext.Name == del {
delMap[ext.Check] = struct{}{}
_ = fileOP.DeleteFile(path.Join(dir, "extensions", ext.File))
detail, _ := appDetailRepo.GetFirst(repo.WithByID(runtime.AppDetailID))
_ = fileOP.DeleteFile(path.Join(dir, "extensions", getExtensionDir(detail.Version), ext.File))
_ = fileOP.DeleteFile(path.Join(dir, "conf", "conf.d", "docker-php-ext-"+ext.Check+".ini"))
_ = removePHPIniExt(path.Join(dir, "conf", "php.ini"), ext.File)
break
@ -743,3 +744,40 @@ func checkRuntimePortExist(port int, scanPort bool, runtimeID uint) error {
}
return nil
}
func getExtensionDir(version string) string {
if strings.HasPrefix(version, "8.4") {
return "no-debug-non-zts-20240924"
}
if strings.HasPrefix(version, "8.3") {
return "no-debug-non-zts-20230831"
}
if strings.HasPrefix(version, "8.2") {
return "no-debug-non-zts-20220829"
}
if strings.HasPrefix(version, "8.1") {
return "no-debug-non-zts-20210902"
}
if strings.HasPrefix(version, "8.0") {
return "no-debug-non-zts-20200930"
}
if strings.HasPrefix(version, "7.4") {
return "no-debug-non-zts-20190902"
}
if strings.HasPrefix(version, "7.3") {
return "no-debug-non-zts-20180731"
}
if strings.HasPrefix(version, "7.2") {
return "no-debug-non-zts-20170718"
}
if strings.HasPrefix(version, "7.1") {
return "no-debug-non-zts-20160303"
}
if strings.HasPrefix(version, "7.0") {
return "no-debug-non-zts-20151012"
}
if strings.HasPrefix(version, "5.6") {
return "no-debug-non-zts-20131226"
}
return ""
}

View file

@ -52,7 +52,7 @@
"name": "imagick",
"check": "imagick",
"file": "imagick.so",
"versions": ["56", "70", "71", "72", "73", "74", "80", "81", "82"],
"versions": ["56", "70", "71", "72", "73", "74", "80", "81", "82","83","84"],
"installed": false
},
{
@ -327,11 +327,40 @@
"file": "sourceguardian.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
},{
"name": "mysqli",
},
{
"name": "mysqli",
"check": "mysqli",
"file": "mysqli.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
},
{
"name": "pdo_mysql",
"check": "pdo_mysql",
"file": "pdo_mysql.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
},
{
"name": "igbinary",
"check": "igbinary",
"file": "igbinary.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
},
{
"name": "zip",
"check": "zip",
"file": "zip.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
},
{
"name": "shmop",
"check": "shmop",
"file": "shmop.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],
"installed": false
}
]

View file

@ -78,7 +78,7 @@ PullImageStart: "开始拉取镜像 {{ .name }}"
PullImageSuccess: "镜像拉取成功"
AppStoreSyncSuccess: "应用商店同步成功"
SyncAppDetail: "同步应用配置"
AppVersionNotMatch: "{{ .name }} 应用需要更高的 1Panel 版本,跳过同步"
AppVersionNotMatch: "{{ .name }} 应用不适配当前 1Panel 版本,跳过"
MoveSiteDir: "当前升级需要迁移 OpenResty 网站目录"
MoveSiteToDir: "迁移网站目录到 {{ .name }}"
ErrMoveSiteDir: "迁移网站目录失败"

View file

@ -212,7 +212,7 @@ var InitPHPExtensions = &gormigrate.Migration{
if err := tx.Create(&model.PHPExtensions{Name: "Default", Extensions: "bcmath,ftp,gd,gettext,intl,mysqli,pcntl,pdo_mysql,shmop,soap,sockets,sysvsem,xmlrpc,zip"}).Error; err != nil {
return err
}
if err := tx.Create(&model.PHPExtensions{Name: "WordPress", Extensions: "exif,igbinary,imagick,intl,zip,apcu,memcached,opcache,redis,bc,image,shmop,mysqli,pdo_mysql,gd"}).Error; err != nil {
if err := tx.Create(&model.PHPExtensions{Name: "WordPress", Extensions: "exif,igbinary,imagick,intl,zip,apcu,memcached,opcache,redis,shmop,mysqli,pdo_mysql,gd"}).Error; err != nil {
return err
}
if err := tx.Create(&model.PHPExtensions{Name: "Flarum", Extensions: "curl,gd,pdo_mysql,mysqli,bz2,exif,yaf,imap"}).Error; err != nil {

View file

@ -78,6 +78,7 @@ var WebUrlMap = map[string]struct{}{
"/cronjobs": {},
"/cronjobs/cronjob": {},
"/cronjobs/library": {},
"/cronjobs/operate": {},
"/databases": {},
"/databases/mysql": {},

View file

@ -3077,6 +3077,7 @@ const message = {
gatewayTimeout: 'Gateway Timeout (504)',
belongToIpGroup: 'Belongs to IP Group',
notBelongToIpGroup: 'Does not belong to IP Group',
unknownWebsiteKey: 'Unknown Domain',
},
monitor: {
name: 'Website Monitoring',

View file

@ -2938,6 +2938,7 @@ const message = {
gatewayTimeout: 'ゲートウェイタイムアウト (504)',
belongToIpGroup: 'IP グループに属しています',
notBelongToIpGroup: 'IP グループに属していません',
unknownWebsiteKey: '未知のドメイン',
},
monitor: {
name: 'ウェブサイトモニタリング',

View file

@ -2890,6 +2890,7 @@ const message = {
gatewayTimeout: '게이트웨이 시간 초과 (504)',
belongToIpGroup: 'IP 그룹에 속함',
notBelongToIpGroup: 'IP 그룹에 속하지 않음',
unknownWebsiteKey: ' 없는 도메인',
},
monitor: {
name: '웹사이트 모니터링',

View file

@ -3003,6 +3003,7 @@ const message = {
gatewayTimeout: 'Timeout Gateway (504)',
belongToIpGroup: 'Tergolong dalam Kumpulan IP',
notBelongToIpGroup: 'Tidak tergolong dalam Kumpulan IP',
unknownWebsiteKey: 'Domain Tidak Diketahui',
},
monitor: {
name: 'Pemantauan Laman Web',

View file

@ -3006,6 +3006,7 @@ const message = {
gatewayTimeout: 'Tempo Limite da Porta de Entrada (504)',
belongToIpGroup: 'Pertence ao Grupo de IP',
notBelongToIpGroup: 'Não pertence ao Grupo de IP',
unknownWebsiteKey: 'Domínio Desconhecido',
},
monitor: {
name: 'Monitoramento de Websites',

View file

@ -2999,6 +2999,7 @@ const message = {
gatewayTimeout: 'Тайм-аут шлюза (504)',
belongToIpGroup: 'Принадлежит к группе IP',
notBelongToIpGroup: 'Не принадлежит к группе IP',
unknownWebsiteKey: 'Неизвестный домен',
},
monitor: {
name: 'Мониторинг веб-сайта',

View file

@ -2851,6 +2851,7 @@ const message = {
gatewayTimeout: '網關超時 (504)',
belongToIpGroup: '屬於 IP ',
notBelongToIpGroup: '不屬於 IP ',
unknownWebsiteKey: '未知域名',
},
monitor: {
name: '網站監控',

View file

@ -2839,6 +2839,7 @@ const message = {
gatewayTimeout: '网关超时 (504)',
belongToIpGroup: '属于 IP ',
notBelongToIpGroup: '不属于 IP ',
unknownWebsiteKey: '未知域名',
},
monitor: {
name: '网站监控',

View file

@ -92,10 +92,9 @@
>
<div class="app">
<el-card>
<div class="app-wrapper">
<div class="app-wrapper" @click="openDetail(app.key)">
<div class="app-image">
<el-avatar
@click="openDetail(app.key)"
shape="square"
:size="60"
:src="'data:image/png;base64,' + app.icon"
@ -406,9 +405,9 @@ onMounted(async () => {
.app-wrapper {
display: flex;
height: 100%;
cursor: pointer;
}
.app-image {
cursor: pointer;
flex: 0 0 100px;
display: flex;
justify-content: center;

View file

@ -43,6 +43,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles/var.scss" as *;`,
silenceDeprecations: ['legacy-js-api'],
api: 'modern',
},
},
@ -53,7 +54,9 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
host: '0.0.0.0',
proxy: {
'/api/v2': {
target: 'http://localhost:9999/',
target: 'http://192.168.1.2:9999',
// target: 'http://172.16.10.123:9999',
// target: 'http://192.168.31.219:9999/',
changeOrigin: true,
ws: true,
},