mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
feat: 删除网站适配防篡改 (#4415)
This commit is contained in:
parent
494da3c209
commit
33a0c2ba30
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,6 +42,7 @@ frontend/src/xpack
|
|||||||
backend/xpack
|
backend/xpack
|
||||||
backend/router/entry_xpack.go
|
backend/router/entry_xpack.go
|
||||||
backend/server/init_xpack.go
|
backend/server/init_xpack.go
|
||||||
|
backend/utils/xpack/xpack_xpack.go
|
||||||
|
|
||||||
.history/
|
.history/
|
||||||
dist/
|
dist/
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/utils/xpack"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -364,6 +365,7 @@ func deleteAppInstall(install model.AppInstall, deleteBackup bool, forceDelete b
|
|||||||
}
|
}
|
||||||
_ = websiteRepo.DeleteAll(ctx)
|
_ = websiteRepo.DeleteAll(ctx)
|
||||||
_ = websiteDomainRepo.DeleteAll(ctx)
|
_ = websiteDomainRepo.DeleteAll(ctx)
|
||||||
|
xpack.RemoveTamper("")
|
||||||
case constant.AppMysql, constant.AppMariaDB:
|
case constant.AppMysql, constant.AppMariaDB:
|
||||||
_ = mysqlRepo.Delete(ctx, mysqlRepo.WithByMysqlName(install.Name))
|
_ = mysqlRepo.Delete(ctx, mysqlRepo.WithByMysqlName(install.Name))
|
||||||
case constant.AppPostgresql:
|
case constant.AppPostgresql:
|
||||||
|
@ -435,12 +435,9 @@ func (w WebsiteService) DeleteWebsite(req request.WebsiteDelete) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if checkIsLinkApp(website) && req.DeleteApp {
|
if checkIsLinkApp(website) && req.DeleteApp {
|
||||||
appInstall, err := appInstallRepo.GetFirst(commonRepo.WithByID(website.AppInstallID))
|
appInstall, _ := appInstallRepo.GetFirst(commonRepo.WithByID(website.AppInstallID))
|
||||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
if appInstall.ID > 0 {
|
||||||
return err
|
if err = deleteAppInstall(appInstall, true, req.ForceDelete, true); err != nil && !req.ForceDelete {
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(model.AppInstall{}, appInstall) {
|
|
||||||
if err := deleteAppInstall(appInstall, true, req.ForceDelete, true); err != nil && !req.ForceDelete {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package service
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/utils/xpack"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@ -400,6 +401,7 @@ func delNginxConfig(website model.Website, force bool) error {
|
|||||||
}
|
}
|
||||||
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias)
|
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias)
|
||||||
if fileOp.Stat(sitePath) {
|
if fileOp.Stat(sitePath) {
|
||||||
|
xpack.RemoveTamper(website.Alias)
|
||||||
_ = fileOp.DeleteDir(sitePath)
|
_ = fileOp.DeleteDir(sitePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
backend/utils/xpack/xpack.go
Normal file
6
backend/utils/xpack/xpack.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//go:build !xpack
|
||||||
|
|
||||||
|
package xpack
|
||||||
|
|
||||||
|
func RemoveTamper(website string) {
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user