2022-11-23 17:44:24 +08:00
|
|
|
package business
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/app/service"
|
2023-11-03 18:18:12 +08:00
|
|
|
"github.com/1Panel-dev/1Panel/backend/constant"
|
2022-11-23 17:44:24 +08:00
|
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Init() {
|
2023-10-09 15:46:27 +08:00
|
|
|
go syncApp()
|
|
|
|
go syncInstalledApp()
|
2023-11-02 14:35:58 +08:00
|
|
|
go syncRuntime()
|
2023-11-20 16:16:20 +08:00
|
|
|
go syncSSL()
|
2023-03-20 10:38:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func syncApp() {
|
2023-11-03 18:18:12 +08:00
|
|
|
_ = service.NewISettingService().Update("AppStoreSyncStatus", constant.SyncSuccess)
|
2023-04-08 14:02:14 +08:00
|
|
|
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
|
2023-10-09 15:46:27 +08:00
|
|
|
global.LOG.Errorf("App Store synchronization failed")
|
2023-03-20 10:38:39 +08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func syncInstalledApp() {
|
|
|
|
if err := service.NewIAppInstalledService().SyncAll(true); err != nil {
|
|
|
|
global.LOG.Errorf("sync instaled app error: %s", err.Error())
|
2022-11-23 17:44:24 +08:00
|
|
|
}
|
|
|
|
}
|
2023-11-02 14:35:58 +08:00
|
|
|
|
|
|
|
func syncRuntime() {
|
|
|
|
if err := service.NewRuntimeService().SyncForRestart(); err != nil {
|
|
|
|
global.LOG.Errorf("sync runtime status error : %s", err.Error())
|
|
|
|
}
|
|
|
|
}
|
2023-11-20 16:16:20 +08:00
|
|
|
|
|
|
|
func syncSSL() {
|
|
|
|
if err := service.NewIWebsiteSSLService().SyncForRestart(); err != nil {
|
|
|
|
global.LOG.Errorf("sync ssl status error : %s", err.Error())
|
|
|
|
}
|
|
|
|
}
|