MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / handleSetupStatus

Method handleSetupStatus

internal/serverapi/setup.go:36–40  ·  view source on GitHub ↗

handleSetupStatus 返回系统是否需要初始化(尚无管理员)。

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

34
35// handleSetupStatus 返回系统是否需要初始化(尚无管理员)。
36func (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 创建第一个管理员用户(无需认证,已有管理员则拒绝)。
43func (h *setupHandler) handleSetup(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 2

writeJSONFunction · 0.70
GetAdminUserMethod · 0.65

Tested by

no test coverage detected