Keep community products out of saved outfits
CI / build (push) Successful in 43s

Saving an outfit (POST /api/outfits.php) sent its community products to IMVU. They're now taken out (any ID in
the community range, known or not), the request re-signed, and the products remembered under the outfit's ID,
then added back when the client loads its saved outfits (marked AP if one is adult).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-29 19:30:59 -07:00
1 parent 400831bf3c
commit 6506c641f0
3 files changed
+159 -2

No files matched your search

+21 -2
View File
@@ -25,8 +25,9 @@ type state struct {
}
type stateData struct {
IDs map[string]int64 `json:"ids"` // product ID -> local ID
Worn map[string]wornOutfit `json:"worn"` // IMVU user ID -> what they wear
IDs map[string]int64 `json:"ids"` // product ID -> local ID
Worn map[string]wornOutfit `json:"worn"` // IMVU user ID -> what they wear
Outfits map[string][]string `json:"outfits,omitempty"` // saved outfit ID -> its community products
}
// wornOutfit is an account's outfit as last saved or sent: the IMVU products IMVU got, and the community products
@@ -109,6 +110,24 @@ func (s *state) setWorn(user string, imvu []int64, products []string) error {
return s.saveLocked()
}
// outfit is the community products saved with an outfit (by IMVU's outfit ID).
func (s *state) outfit(id string) []string {
s.mu.Lock()
defer s.mu.Unlock()
return append([]string(nil), s.data.Outfits[id]...)
}
// setOutfit remembers the community products saved with an outfit.
func (s *state) setOutfit(id string, products []string) error {
s.mu.Lock()
defer s.mu.Unlock()
if s.data.Outfits == nil {
s.data.Outfits = map[string][]string{}
}
s.data.Outfits[id] = append([]string(nil), products...)
return s.saveLocked()
}
// sameSet reports whether a and b hold the same IDs, in any order.
func sameSet(a, b []int64) bool {
if len(a) != len(b) {