2022-11-23 09:44:24 +00:00
|
|
|
package business
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/app/service"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Init() {
|
2023-03-20 02:38:39 +00:00
|
|
|
syncApp()
|
|
|
|
syncInstalledApp()
|
|
|
|
}
|
|
|
|
|
|
|
|
func syncApp() {
|
2023-02-13 07:38:09 +00:00
|
|
|
setting, err := service.NewISettingService().GetSettingInfo()
|
|
|
|
if err != nil {
|
|
|
|
global.LOG.Errorf("sync app error: %s", err.Error())
|
2023-02-17 09:19:35 +00:00
|
|
|
return
|
2023-02-13 07:38:09 +00:00
|
|
|
}
|
2023-06-01 06:47:13 +00:00
|
|
|
if setting.AppStoreLastModified != "0" {
|
2023-03-20 02:38:39 +00:00
|
|
|
global.LOG.Info("no need to sync")
|
2023-02-13 07:38:09 +00:00
|
|
|
return
|
|
|
|
}
|
2023-02-17 09:19:35 +00:00
|
|
|
global.LOG.Info("sync app start...")
|
2023-04-08 06:02:14 +00:00
|
|
|
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
|
2023-06-08 15:20:11 +00:00
|
|
|
global.LOG.Errorf("sync app error")
|
2023-03-20 02:38:39 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
global.LOG.Info("sync app successful")
|
|
|
|
}
|
|
|
|
|
|
|
|
func syncInstalledApp() {
|
|
|
|
if err := service.NewIAppInstalledService().SyncAll(true); err != nil {
|
|
|
|
global.LOG.Errorf("sync instaled app error: %s", err.Error())
|
2022-11-23 09:44:24 +00:00
|
|
|
}
|
|
|
|
}
|