Get T5 products from the hub's catalogs
CI / build (push) Successful in 25s

The proxy keeps the person's library in a cache folder (hub-products in its data folder), one pack per
product, served like any other pack: the hub says which revision to load and which catalogs host it, each file
comes from a catalog and is checked against the hub's sha256 (files are kept by hash, so a new revision only
downloads what changed), and adult files are fetched with the hub's access token. Products someone wears in a
room that aren't here yet are fetched too, and put on them when they arrive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-29 18:56:26 -07:00
1 parent 93fa2f5d90
commit c281fb572c
6 files changed
+579 -3

No files matched your search

+8 -1
View File
@@ -30,6 +30,7 @@ type room struct {
applied map[string]map[int64][]int64 // chat -> user -> local IDs the client was given for them
userIDs map[int64]string // user -> the gateway's user_id for them, as last seen
missing map[string]bool // products others wear that aren't in the packs (logged once)
last map[string][]hub.Avatar // chat -> what the hub last said about the others in it
}
func (r *room) init() {
@@ -39,6 +40,7 @@ func (r *room) init() {
r.applied = map[string]map[int64][]int64{}
r.userIDs = map[int64]string{}
r.missing = map[string]bool{}
r.last = map[string][]hub.Avatar{}
}
}
@@ -184,13 +186,16 @@ func (p *Products) Others(chat string, avatars []hub.Avatar) {
locals = append(locals, s.local)
continue
}
if p.Want != nil {
p.Want(it.ID) // given to the client when it arrives (Ready)
}
p.roomMu.Lock()
p.room.init()
first := !p.room.missing[it.ID]
p.room.missing[it.ID] = true
p.roomMu.Unlock()
if first {
p.logf("products: someone in the room wears %q (%s), which isn't in your packs", it.Name, it.ID)
p.logf("products: someone in the room wears %q (%s), which isn't here yet", it.Name, it.ID)
}
}
slices.Sort(locals)
@@ -201,9 +206,11 @@ func (p *Products) Others(chat string, avatars []hub.Avatar) {
p.room.init()
if avatars == nil {
delete(p.room.applied, chat)
delete(p.room.last, chat)
p.roomMu.Unlock()
return
}
p.room.last[chat] = avatars
had := p.room.applied[chat]
var lines []line
for user, old := range had {