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
+38
View File
@@ -0,0 +1,38 @@
package api
import (
"net/http"
"browser.local/platform/domain"
"browser.local/platform/dto"
"browser.local/platform/repo"
)
type liveLogRelayCore interface {
RelayLiveLogBatch(domain.LogBatchIngest) (domain.LogBatchIngestResult, error)
}
// runLiveLogRelay accepts current Run output and immediately fans it out to
// subscribers. It has no durable body or delivery acknowledgement contract.
func (h *coreHandlers) runLiveLogRelay(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
writeMethodNotAllowed(w, http.MethodPost)
return
}
core, ok := h.core.(liveLogRelayCore)
if !ok {
writeServiceError(w, repo.ErrNotFound)
return
}
request, err := decodeJSON[dto.LogBatchIngestRequest](r)
if err != nil {
writeDecodeError(w, err)
return
}
result, err := core.RelayLiveLogBatch(request.ToDomain())
if err != nil {
writeServiceError(w, err)
return
}
writeJSON(w, http.StatusOK, dto.LogBatchIngestFromDomain(result))
}