MCPcopy Create free account
hub / github.com/Quorinex/Kiro-Go / apiUpdateProxy

Method apiUpdateProxy

proxy/handler.go:3542–3574  ·  view source on GitHub ↗

apiUpdateProxy 更新代理配置并立即生效

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

Source from the content-addressed store, hash-verified

3540 ExpiresAt: time.Now().Unix() + int64(expiresIn),
3541 Enabled: true,
3542 MachineId: config.GenerateMachineId(),
3543 }
3544
3545 if err := config.AddAccount(account); err != nil {
3546 w.WriteHeader(500)
3547 json.NewEncoder(w).Encode(map[string]string{"error": err.Error()})
3548 return
3549 }
3550
3551 h.pool.Reload()
3552 json.NewEncoder(w).Encode(map[string]interface{}{
3553 "success": true,
3554 "completed": true,
3555 "account": map[string]interface{}{
3556 "id": account.ID,
3557 "email": account.Email,
3558 },
3559 })
3560}
3561
3562func (h *Handler) apiImportSsoToken(w http.ResponseWriter, r *http.Request) {
3563 var req struct {
3564 BearerToken string `json:"bearerToken"`
3565 Region string `json:"region"`
3566 }
3567 if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
3568 w.WriteHeader(400)
3569 json.NewEncoder(w).Encode(map[string]string{"error": "Invalid JSON"})
3570 return
3571 }
3572
3573 if req.BearerToken == "" {
3574 w.WriteHeader(400)
3575 json.NewEncoder(w).Encode(map[string]string{"error": "bearerToken is required"})
3576 return
3577 }

Callers 1

handleAdminAPIMethod · 0.95

Calls 3

UpdateProxySettingsFunction · 0.92
applyProxyConfigFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected