Make SCUM logs live relay only

This commit is contained in:
npc0-hue
2026-09-01 14:26:00 +08:00
parent 3f348401a9
commit 7d9c1b7e9e
28 changed files with 1011 additions and 175 deletions
@@ -6,6 +6,48 @@ import (
"browser.local/platform/dto"
)
// gameClientBridgeCompanionLogEvents godoc
// @Summary Stream live Run logs to a game companion
// @Description Authorizes a component session and relays only the current supervised process log stream to the companion. The platform does not persist log bodies on this route.
// @Tags game-client-bridge
// @Accept json
// @Produce text/event-stream
// @Param body body dto.GameClientBridgeLogStreamRequest true "Component log stream request"
// @Success 200 {object} dto.LogStreamEventResponse
// @Failure 400 {object} dto.ErrorResponse
// @Failure 401 {object} dto.ErrorResponse
// @Failure 403 {object} dto.ErrorResponse
// @Failure 405 {object} dto.ErrorResponse
// @Router /api/v1/game-client-bridge/companion/logs/events [post]
func (h *coreHandlers) gameClientBridgeCompanionLogEvents(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
writeMethodNotAllowed(w, http.MethodPost)
return
}
request, err := decodeJSON[dto.GameClientBridgeLogStreamRequest](r)
if err != nil {
writeDecodeError(w, err)
return
}
instance, err := h.core.AuthorizeGameClientBridgeLogStream(request.ToDomain())
if err != nil {
writeServiceError(w, err)
return
}
subscription, err := h.core.SubscribeLogEvents(instance.ID)
if err != nil {
writeServiceError(w, err)
return
}
defer subscription.Close()
streams, liveEligible, err := h.loadLiveLogSnapshot(instance.ID)
if err != nil {
writeServiceError(w, err)
return
}
h.streamCurrentLogEvents(w, r, instance, streams, liveEligible, subscription)
}
func (h *coreHandlers) gameClientBridgeCompanionClaim(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
writeMethodNotAllowed(w, http.MethodPost)