T5 badge on room cards and the Manage tab; room_info.php for hosted rooms
CI / build (push) Successful in 44s
CI / build (push) Successful in 44s
room_info.php (the room card's participants, asked for every room) is answered for hosted rooms from the hub (it was refused as naming a hosted room, which the client showed as an error), with max_users; it and getRoomCardInfo get t5de_t5 for hosted and decorated rooms, as do the person's own rooms in room_management_info.php. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d379d848c1
commit
fc59367ba6
2 files changed
+195
No files matched your search
@@ -52,6 +52,8 @@ func (h *fakeHub) Call(ctx context.Context, method, path string, body, out any)
|
||||
"scene": {"contents": [[1, 47477426, "37207-46"], [2, "coatcoat22", "37-11"], [3, "notherenn2", "37-12"]], "hash": "h1"}}`), out)
|
||||
case method == "GET" && strings.HasPrefix(path, "/api/v1/decorations?instances="):
|
||||
return json.Unmarshal([]byte(`{"rooms": [{"instance": "1-644", "contents": [[1, "coatcoat22", "x"]]}, {"instance": "2-17", "contents": []}]}`), out)
|
||||
case method == "GET" && path == "/api/v1/hosted-rooms/3/participants":
|
||||
return json.Unmarshal([]byte(`{"participants": [{"imvu_id": 88, "seat": 1, "name": "Erin<"}]}`), out)
|
||||
case method == "GET" && path == "/api/v1/hosted-rooms":
|
||||
return json.Unmarshal([]byte(`{"rooms": [{"n": 3, "name": "Lounge", "ownerImvuId": 88, "ownerName": "Erin", "maxUsers": 10, "occupancy": 2}]}`), out)
|
||||
case method == "PUT" && path == "/api/v1/hosted-rooms/3/scene":
|
||||
@@ -265,3 +267,45 @@ func TestRoomList(t *testing.T) {
|
||||
t.Fatalf("page 2: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBadgesAndRoomInfo(t *testing.T) {
|
||||
r, _, _ := setup()
|
||||
do := func(raw string, body []byte, modified []byte) []byte {
|
||||
t.Helper()
|
||||
u, _ := url.Parse(raw)
|
||||
req, _ := http.NewRequest("POST", u.String(), bytes.NewReader(body))
|
||||
x := &proxy.Exchange{URL: u, Request: req, Body: body}
|
||||
r.Intercept(x)
|
||||
if x.Response != nil {
|
||||
b, _ := io.ReadAll(x.Response.Body)
|
||||
return b
|
||||
}
|
||||
if x.ModifyResponse == nil {
|
||||
t.Fatalf("%s: left alone", raw)
|
||||
}
|
||||
out, _ := x.ModifyResponse(&http.Response{StatusCode: 200}, modified)
|
||||
return out
|
||||
}
|
||||
// A decorated IMVU room's card gets t5de_t5.
|
||||
card := (&xmlrpc.Call{Method: "test.getRoomCardInfo", Params: []xmlrpc.Value{xmlrpc.Struct{{Name: "room_instance_id", Value: "1-644"}}}}).Marshal()
|
||||
answer := (&xmlrpc.Response{Params: []xmlrpc.Value{xmlrpc.Struct{{Name: "name", Value: "A"}}}}).Marshal()
|
||||
if out := do("https://client-dynamic.imvu.com/api/xmlrpc/client.php", card, answer); !strings.Contains(string(out), "t5de_t5") {
|
||||
t.Fatalf("card %s", out)
|
||||
}
|
||||
// The Manage tab's own decorated rooms get it too.
|
||||
managed := []byte(`{"result": {"limit": 1, "rooms": [{"room_instance_id": "1-644"}, {"room_instance_id": "2-17"}]}}`)
|
||||
out := do("https://client-dynamic.imvu.com/api/room_management_info.php", nil, managed)
|
||||
if !strings.Contains(string(out), `{"room_instance_id":"1-644","t5de_t5":1}`) || strings.Count(string(out), "t5de_t5") != 1 {
|
||||
t.Fatalf("managed %s", out)
|
||||
}
|
||||
// A decorated IMVU room's room_info.php gets t5de_t5.
|
||||
if out := do("https://client-dynamic.imvu.com/api/rooms/room_info.php?room_id=1-644", nil, []byte(`{"participants": []}`)); !strings.Contains(string(out), `"t5de_t5":1`) {
|
||||
t.Fatalf("room info %s", out)
|
||||
}
|
||||
// room_info.php for a hosted room: its people, from the hub.
|
||||
out = do("https://client-dynamic.imvu.com/api/rooms/room_info.php?room_id=88-2100000003", nil, nil)
|
||||
if !strings.Contains(string(out), `"avatar_name":"Erin"`) || !strings.Contains(string(out), `"customers_id":"88"`) ||
|
||||
!strings.Contains(string(out), `"max_users":10`) || !strings.Contains(string(out), `"t5de_t5":1`) {
|
||||
t.Fatalf("room info %s", out)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user