handleSetupStatus 返回系统是否需要初始化(尚无管理员)。
(w http.ResponseWriter, r *http.Request)
| 34 | |
| 35 | // handleSetupStatus 返回系统是否需要初始化(尚无管理员)。 |
| 36 | func (h *setupHandler) handleSetupStatus(w http.ResponseWriter, r *http.Request) { |
| 37 | _, err := h.users.GetAdminUser() |
| 38 | needsSetup := errors.Is(err, users.ErrUserNotFound) |
| 39 | writeJSON(w, http.StatusOK, map[string]any{"needs_setup": needsSetup}) |
| 40 | } |
| 41 | |
| 42 | // handleSetup 创建第一个管理员用户(无需认证,已有管理员则拒绝)。 |
| 43 | func (h *setupHandler) handleSetup(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected