fix: replace last hardcoded paths with BASE_PATH-aware alternatives
- index.html: change /src/main.tsx to ./src/main.tsx (relative, respects <base> tag) - AgentRegistrationController: derive SSE endpoint URL from request context via ServletUriComponentsBuilder instead of hardcoding /api/v1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
@@ -136,9 +137,14 @@ public class AgentRegistrationController {
|
|||||||
String accessToken = jwtService.createAccessToken(request.instanceId(), application, environmentId, roles);
|
String accessToken = jwtService.createAccessToken(request.instanceId(), application, environmentId, roles);
|
||||||
String refreshToken = jwtService.createRefreshToken(request.instanceId(), application, environmentId, roles);
|
String refreshToken = jwtService.createRefreshToken(request.instanceId(), application, environmentId, roles);
|
||||||
|
|
||||||
|
String sseEndpoint = ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||||
|
.path("/api/v1/agents/{id}/events")
|
||||||
|
.buildAndExpand(agent.instanceId())
|
||||||
|
.toUriString();
|
||||||
|
|
||||||
return ResponseEntity.ok(new AgentRegistrationResponse(
|
return ResponseEntity.ok(new AgentRegistrationResponse(
|
||||||
agent.instanceId(),
|
agent.instanceId(),
|
||||||
"/api/v1/agents/" + agent.instanceId() + "/events",
|
sseEndpoint,
|
||||||
config.getHeartbeatIntervalMs(),
|
config.getHeartbeatIntervalMs(),
|
||||||
ed25519SigningService.getPublicKeyBase64(),
|
ed25519SigningService.getPublicKeyBase64(),
|
||||||
accessToken,
|
accessToken,
|
||||||
|
|||||||
@@ -8,6 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="./src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user