MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / getApps

Function getApps

agent/app/service/app_utils.go:1331–1380  ·  view source on GitHub ↗
(oldApps []model.App, items []dto.AppDefine, systemVersion string, task *task.Task)

Source from the content-addressed store, hash-verified

1329}
1330
1331func getApps(oldApps []model.App, items []dto.AppDefine, systemVersion string, task *task.Task) (map[string]model.App, map[string]string) {
1332 apps := make(map[string]model.App, len(oldApps))
1333 pendingIcons := make(map[string]string, len(items))
1334 for _, old := range oldApps {
1335 old.Status = constant.AppTakeDown
1336 apps[old.Key] = old
1337 }
1338 for _, item := range items {
1339 config := item.AppProperty
1340 if config.Version > 0 && common.CompareVersion(strconv.FormatFloat(config.Version, 'f', -1, 64), systemVersion) {
1341 task.Log(i18n.GetWithName("AppVersionNotMatch", item.Name))
1342 continue
1343 }
1344 if config.Deprecated > 0 && common.CompareAppVersion(systemVersion, strconv.FormatFloat(config.Deprecated, 'f', -1, 64)) {
1345 continue
1346 }
1347
1348 key := config.Key
1349 app, ok := apps[key]
1350 if !ok {
1351 app = model.App{}
1352 }
1353 app.RequiredPanelVersion = config.Version
1354 app.Resource = constant.AppResourceRemote
1355 app.Name = item.Name
1356 app.Limit = config.Limit
1357 app.Key = key
1358 app.ShortDescZh = config.ShortDescZh
1359 app.ShortDescEn = config.ShortDescEn
1360 description, _ := json.Marshal(config.Description)
1361 app.Description = string(description)
1362 app.Website = config.Website
1363 app.Document = config.Document
1364 app.Github = config.Github
1365 app.Type = config.Type
1366 app.CrossVersionUpdate = config.CrossVersionUpdate
1367 app.Status = constant.AppNormal
1368 app.LastModified = item.LastModified
1369 app.ReadMe = item.ReadMe
1370 app.MemoryRequired = config.MemoryRequired
1371 app.Architectures = strings.Join(config.Architectures, ",")
1372 app.GpuSupport = config.GpuSupport
1373 app.BatchInstallSupport = config.BatchInstallSupport
1374 if item.Icon != "" {
1375 pendingIcons[key] = item.Icon
1376 }
1377 apps[key] = app
1378 }
1379 return apps, pendingIcons
1380}
1381
1382func handleLocalAppDetail(versionDir string, appDetail *model.AppDetail) error {
1383 fileOp := files.NewFileOp()

Callers 1

Calls 1

LogMethod · 0.45

Tested by

no test coverage detected