@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)
| 37 | // @Success 200 {string} string "ok" |
| 38 | // @Router /sys/version/check [get] |
| 39 | func 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 |
nothing calls this directly
no test coverage detected