feat(houseofrc): fetch driver names and brands by transponder (1.79.0)
This commit is contained in:
1 parent
0c54e8b58a
commit
3829ca1cab
17 files changed
+319
-7
No files matched your search
@@ -734,6 +734,13 @@ test("House of RC: the key is stored server-side only, never returned, and the t
|
||||
seen.push({ url: req.url, auth: req.headers.authorization });
|
||||
const ok = req.headers.authorization === "Bearer hrc_test_secret_key_1234";
|
||||
res.writeHead(ok ? 200 : 401, { "Content-Type": "application/json" });
|
||||
if (ok && req.url.startsWith("/timing/users")) {
|
||||
// Newest owner first; an unknown number is simply missing.
|
||||
return res.end(JSON.stringify([
|
||||
{ id: 5, name: "Bo Berg", transponder: "1234567", model: { name: "B7", brand: { name: "Associated" } } },
|
||||
{ id: 9, name: "Old Owner", transponder: "1234567" },
|
||||
]));
|
||||
}
|
||||
res.end(JSON.stringify(ok ? { data: { user: { id: 68, name: "Test Club" }, rate_limit: 60 } } : { error: "unauthorized" }));
|
||||
});
|
||||
await new Promise((resolve) => mock.listen(0, "127.0.0.1", resolve));
|
||||
@@ -762,6 +769,9 @@ test("House of RC: the key is stored server-side only, never returned, and the t
|
||||
const test = await (await post("/api/houseofrc/test", {})).json();
|
||||
assert.deepEqual([test.ok, test.user.name, test.rateLimit], [true, "Test Club", 60]);
|
||||
assert.equal(seen.at(-1).url, "/v1/me");
|
||||
const lookup = await (await post("/api/houseofrc/transponders", { transponders: ["1234567", "7654321", "1234567", "bad value"] })).json();
|
||||
assert.equal(seen.at(-1).url, "/timing/users?transponders=1234567%2C7654321", "deduplicated, invalid numbers dropped");
|
||||
assert.deepEqual(lookup.members, { 1234567: { id: 5, name: "Bo Berg", model: "B7", brand: "Associated" } }, "the newest owner wins");
|
||||
|
||||
const keyFile = join(dataDir, "houseofrc.json");
|
||||
assert.equal(statSync(keyFile).mode & 0o777, 0o600, "only the server user can read the key file");
|
||||
|
||||
Reference in new issue
Block a user