mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat(appstore): Handle Requests After Application Installation (#7206)
This commit is contained in:
parent
83ce744fb2
commit
3e96e83c3c
@ -91,10 +91,6 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
var appDTOs []*response.AppDto
|
var appDTOs []*response.AppDto
|
||||||
for _, ap := range apps {
|
for _, ap := range apps {
|
||||||
// ap.ReadMe = ""
|
|
||||||
// ap.Website = ""
|
|
||||||
// ap.Document = ""
|
|
||||||
// ap.Github = ""
|
|
||||||
appDTO := &response.AppDto{
|
appDTO := &response.AppDto{
|
||||||
ID: ap.ID,
|
ID: ap.ID,
|
||||||
Name: ap.Name,
|
Name: ap.Name,
|
||||||
@ -816,6 +812,14 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
|||||||
}
|
}
|
||||||
settingService := NewISettingService()
|
settingService := NewISettingService()
|
||||||
_ = settingService.Update("AppStoreSyncStatus", constant.Syncing)
|
_ = settingService.Update("AppStoreSyncStatus", constant.Syncing)
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
_ = settingService.Update("AppStoreSyncStatus", constant.SyncFailed)
|
||||||
|
global.LOG.Errorf("App Store synchronization failed %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
setting, err := settingService.GetSettingInfo()
|
setting, err := settingService.GetSettingInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -584,7 +584,7 @@ func upgradeInstall(req request.AppInstallUpgrade) error {
|
|||||||
_ = appDetailRepo.Update(context.Background(), detail)
|
_ = appDetailRepo.Update(context.Background(), detail)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
_, _, _ = httpUtil.HandleGet(detail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s)
|
RequestDownloadCallBack(detail.DownloadCallBackUrl)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,7 +822,7 @@ func copyData(app model.App, appDetail model.AppDetail, appInstall *model.AppIns
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
_, _, _ = httpUtil.HandleGet(appDetail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s)
|
RequestDownloadCallBack(appDetail.DownloadCallBackUrl)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
appKey := app.Key
|
appKey := app.Key
|
||||||
@ -1580,3 +1580,10 @@ func isHostModel(dockerCompose string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RequestDownloadCallBack(downloadCallBackUrl string) {
|
||||||
|
if downloadCallBackUrl == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, _, _ = httpUtil.HandleGet(downloadCallBackUrl, http.MethodGet, constant.TimeOut5s)
|
||||||
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
@ -20,7 +19,6 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/backend/global"
|
"github.com/1Panel-dev/1Panel/backend/global"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/docker"
|
"github.com/1Panel-dev/1Panel/backend/utils/docker"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
"github.com/1Panel-dev/1Panel/backend/utils/files"
|
||||||
httpUtil "github.com/1Panel-dev/1Panel/backend/utils/http"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/subosito/gotenv"
|
"github.com/subosito/gotenv"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@ -56,10 +54,7 @@ func handleNodeAndJava(create request.RuntimeCreate, runtime *model.Runtime, fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if _, _, err := httpUtil.HandleGet(nodeDetail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s); err != nil {
|
RequestDownloadCallBack(nodeDetail.DownloadCallBackUrl)
|
||||||
global.LOG.Errorf("http request failed(handleNode), err: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
go startRuntime(runtime)
|
go startRuntime(runtime)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ const (
|
|||||||
SyncSuccess = "SyncSuccess"
|
SyncSuccess = "SyncSuccess"
|
||||||
Paused = "Paused"
|
Paused = "Paused"
|
||||||
UpErr = "UpErr"
|
UpErr = "UpErr"
|
||||||
|
SyncFailed = "SyncFailed"
|
||||||
|
|
||||||
ContainerPrefix = "1Panel-"
|
ContainerPrefix = "1Panel-"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user