@@ -310,6 +310,7 @@ func (s *Server) Routes() http.Handler {
|
||||
r.Post("/api/internal/delegations", s.internalDelegation)
|
||||
r.Post("/api/internal/identity-exists", s.internalIdentityExists)
|
||||
r.Post("/api/internal/customer-link/consume", s.internalCustomerLinkConsume)
|
||||
r.Get("/api/internal/customer-service/health", s.internalCustomerServiceHealth)
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(func(n http.Handler) http.Handler { return s.require("user", n) })
|
||||
r.Get("/api/tasks", s.clientTasks)
|
||||
@@ -903,6 +904,20 @@ func (s *Server) customerLinkCode(w http.ResponseWriter, r *http.Request) {
|
||||
jsonOut(w, 201, map[string]any{"code": code, "client_id": c.ClientID, "expires_at": expires})
|
||||
}
|
||||
|
||||
func (s *Server) internalCustomerServiceHealth(w http.ResponseWriter, r *http.Request) {
|
||||
secret := strings.TrimSpace(s.internalServiceSecret)
|
||||
if !serviceTokenOK(secret, r.Header.Get("Authorization")) {
|
||||
jsonOut(w, http.StatusUnauthorized, map[string]string{"error": "unauthorized"})
|
||||
return
|
||||
}
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
jsonOut(w, http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
"service": "neuralhunt-game-control-plane",
|
||||
"customer_link_supported": true,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) internalCustomerLinkConsume(w http.ResponseWriter, r *http.Request) {
|
||||
secret := strings.TrimSpace(s.internalServiceSecret)
|
||||
if !serviceTokenOK(secret, r.Header.Get("Authorization")) {
|
||||
|
||||
Reference in New Issue
Block a user