Community products are taken out of rooms their owners save and broadcast, kept on the hub per room, and added back when anyone with T5DE loads the room or gets its owner's broadcast; the hub's decor notice resends the room with the new ones. Placements are stored with the hub's product ID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d8332b21a8
commit
0be2cd8f4e
9 files changed
+685
-2
No files matched your search
@@ -24,6 +24,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
@@ -180,6 +181,20 @@ func run(logger *log.Logger, listen, ready string, parentPID int, trace bool, pa
|
||||
prods.Want = fetcher.Want
|
||||
prods.HubDir, prods.Owned = hubProducts, fetcher.Owned
|
||||
prods.Shop, prods.Fetch, prods.Library = client.Products, fetcher.Ensure, fetcher.Library
|
||||
prods.Decorations = func(ctx context.Context, instance string) ([]products.DecorItem, error) {
|
||||
var out struct {
|
||||
Contents []products.DecorItem `json:"contents"`
|
||||
}
|
||||
err := client.Call(ctx, "GET", "/api/v1/decorations/"+url.PathEscape(instance), nil, &out)
|
||||
return out.Contents, err
|
||||
}
|
||||
prods.SaveDecorations = func(ctx context.Context, instance string, items []products.DecorItem) error {
|
||||
if items == nil {
|
||||
items = []products.DecorItem{}
|
||||
}
|
||||
return client.Call(ctx, "PUT", "/api/v1/decorations/"+url.PathEscape(instance), map[string]any{"contents": items}, nil)
|
||||
}
|
||||
client.OnDecor = prods.DecorChanged
|
||||
prods.AddToLibrary = func(ctx context.Context, id string) error {
|
||||
return client.Call(ctx, "PUT", "/api/v1/library/"+id, map[string]any{}, nil)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user