MCPcopy
hub / github.com/IceWhaleTech/CasaOS / GetSystemCheckVersion

Function GetSystemCheckVersion

route/v1/system.go:39–56  ·  view source on GitHub ↗

@Summary check version @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/version/check [get]

(ctx echo.Context)

Source from the content-addressed store, hash-verified

37// @Success 200 {string} string "ok"
38// @Router /sys/version/check [get]
39func GetSystemCheckVersion(ctx echo.Context) error {
40 need, version := version.IsNeedUpdate(service.MyService.Casa().GetCasaosVersion())
41 if need {
42 installLog := model2.AppNotify{}
43 installLog.State = 0
44 installLog.Message = "New version " + version.Version + " is ready, ready to upgrade"
45 installLog.Type = types.NOTIFY_TYPE_NEED_CONFIRM
46 installLog.CreatedAt = strconv.FormatInt(time.Now().Unix(), 10)
47 installLog.UpdatedAt = strconv.FormatInt(time.Now().Unix(), 10)
48 installLog.Name = "CasaOS System"
49 service.MyService.Notify().AddLog(installLog)
50 }
51 data := make(map[string]interface{}, 3)
52 data["need_update"] = need
53 data["version"] = version
54 data["current_version"] = common.VERSION
55 return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: data})
56}
57
58// @Summary 系统信息
59// @Produce application/json

Callers

nothing calls this directly

Calls 6

IsNeedUpdateFunction · 0.92
GetMsgFunction · 0.92
GetCasaosVersionMethod · 0.65
CasaMethod · 0.65
AddLogMethod · 0.65
NotifyMethod · 0.65

Tested by

no test coverage detected