mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-22 01:37:50 -05:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f69b3511b | ||
|
|
8e7b193621 |
No files matched your search
+16
-1
@@ -803,7 +803,10 @@ const storableUsernameProblem = username => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// gives the account a new username, and carries it into everyone's buddy and
|
// gives the account a new username, and carries it into everyone's buddy and
|
||||||
// block lists. returns "invalid_username" or "username_taken", else null.
|
// block lists. The staff dashboard stores a few human-readable names beside
|
||||||
|
// account ids; keep those labels current too, so a rename does not split a
|
||||||
|
// player's history across two names. Returns "invalid_username" or
|
||||||
|
// "username_taken", else null.
|
||||||
// the player must not be online: the game knows them by the old name.
|
// the player must not be online: the game knows them by the old name.
|
||||||
// with `anyName` (the admin panel) the sign-up rules about length and
|
// with `anyName` (the admin panel) the sign-up rules about length and
|
||||||
// characters do not apply; see storableUsernameProblem.
|
// characters do not apply; see storableUsernameProblem.
|
||||||
@@ -825,6 +828,18 @@ const rename = (account, username, anyName = false) => {
|
|||||||
}
|
}
|
||||||
db.prepare("UPDATE accounts SET username = ?, username_key = ? WHERE id = ?").run(username, newKey, account.id);
|
db.prepare("UPDATE accounts SET username = ?, username_key = ? WHERE id = ?").run(username, newKey, account.id);
|
||||||
console.log(`[accounts] renamed "${logText(account.username)}" to "${logText(username)}" (id ${logText(account.id)})`);
|
console.log(`[accounts] renamed "${logText(account.username)}" to "${logText(username)}" (id ${logText(account.id)})`);
|
||||||
|
for (const [table, column] of [
|
||||||
|
["reports", "reporter"], ["reports", "target"], ["feedback", "username"],
|
||||||
|
["chat_log", "username"], ["chat_log", "to_name"], ["appeals", "username"],
|
||||||
|
["ban_log", "username"], ["mod_log", "by"], ["mod_log", "target"],
|
||||||
|
]) {
|
||||||
|
// A few lean unit tests load the account store without every dashboard
|
||||||
|
// module. The tables are present in the actual server, but keep rename
|
||||||
|
// usable in that smaller setup too.
|
||||||
|
if (db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table)) {
|
||||||
|
db.prepare(`UPDATE ${table} SET ${column} = ? WHERE ${column} = ? COLLATE NOCASE`).run(username, account.username);
|
||||||
|
}
|
||||||
|
}
|
||||||
byKey.delete(oldKey);
|
byKey.delete(oldKey);
|
||||||
account.username = username;
|
account.username = username;
|
||||||
byKey.set(newKey, account);
|
byKey.set(newKey, account);
|
||||||
|
|||||||
@@ -138,6 +138,11 @@ const LANG_ENG = 0;
|
|||||||
const IDLE_ANIM_LAND = 14;
|
const IDLE_ANIM_LAND = 14;
|
||||||
const IDLE_ANIM_OCEAN = 29;
|
const IDLE_ANIM_OCEAN = 29;
|
||||||
const MAX_PATH_POINTS = 12;
|
const MAX_PATH_POINTS = 12;
|
||||||
|
// Action messages are client-side animation names (":dance:", ":sitNW:",
|
||||||
|
// etc.). Keep the currently playing one only while the avatar is standing
|
||||||
|
// still, so someone who enters the room can see it once their client has
|
||||||
|
// created that avatar.
|
||||||
|
const ACTION_NAME = /^:[A-Za-z][A-Za-z0-9]*:$/;
|
||||||
const TYPED_NAME = /^[A-Za-z0-9][A-Za-z0-9 '.-]{0,19}$/; // an animal's or pet's name typed by its owner
|
const TYPED_NAME = /^[A-Za-z0-9][A-Za-z0-9 '.-]{0,19}$/; // an animal's or pet's name typed by its owner
|
||||||
const MAX_BLOCKED = 1000; // from the account page; the game's own button has no limit
|
const MAX_BLOCKED = 1000; // from the account page; the game's own button has no limit
|
||||||
const TYPED_CHAT_TYPES = ["0", "9"];
|
const TYPED_CHAT_TYPES = ["0", "9"];
|
||||||
@@ -467,6 +472,12 @@ const sendAvatarCreate = (to, target) => {
|
|||||||
if (target.petPlayerMode) {
|
if (target.petPlayerMode) {
|
||||||
to.sendXt("uc", room.id, target.id, "on", "13");
|
to.sendXt("uc", room.id, target.id, "on", "13");
|
||||||
}
|
}
|
||||||
|
// `ac` only creates the avatar. Actions normally travel as live `uc`
|
||||||
|
// type-3 packets, so replay a standing player's current action after `ac`
|
||||||
|
// for a player who has just entered (or reloaded) the room.
|
||||||
|
if (target.activeAction) {
|
||||||
|
to.sendXt("uc", room.id, target.id, target.activeAction.name, "3", target.activeAction.extra);
|
||||||
|
}
|
||||||
minigames.showBubble(to, target);
|
minigames.showBubble(to, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -671,6 +682,9 @@ const handlers = {
|
|||||||
const teleport = params[params.length - 1] === "1" ? 1 : 0;
|
const teleport = params[params.length - 1] === "1" ? 1 : 0;
|
||||||
const firstUpdate = !session.pos;
|
const firstUpdate = !session.pos;
|
||||||
session.pos = {x: coords[coords.length - 2], y: coords[coords.length - 1]};
|
session.pos = {x: coords[coords.length - 2], y: coords[coords.length - 1]};
|
||||||
|
// Walking, swimming, or a teleport replaces a looping action on every
|
||||||
|
// client. Do not replay it to somebody entering later.
|
||||||
|
delete session.activeAction;
|
||||||
if (!session.greeted) {
|
if (!session.greeted) {
|
||||||
// the first room has loaded: the client can show a popup now.
|
// the first room has loaded: the client can show a popup now.
|
||||||
session.greeted = true;
|
session.greeted = true;
|
||||||
@@ -1302,6 +1316,7 @@ const leaveRoom = session => {
|
|||||||
room.sessions.delete(session);
|
room.sessions.delete(session);
|
||||||
session.room = null;
|
session.room = null;
|
||||||
session.pos = null;
|
session.pos = null;
|
||||||
|
delete session.activeAction;
|
||||||
minigames.roomLeft(session);
|
minigames.roomLeft(session);
|
||||||
for (const other of room.sessions) {
|
for (const other of room.sessions) {
|
||||||
// AvatarManager.avatarRemoveResponse
|
// AvatarManager.avatarRemoveResponse
|
||||||
@@ -1768,6 +1783,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Type 3 is the action packet. It used to be sent only to people
|
||||||
|
// already in the room, leaving late arrivals with an idle avatar
|
||||||
|
// until the player performed the action again. Save the safe action
|
||||||
|
// name and its mirror marker for the next avatar-create packet.
|
||||||
|
if (fields[1] === "3") {
|
||||||
|
if (!ACTION_NAME.test(fields[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
session.activeAction = {name: fields[0], extra: fields[2] || ""};
|
||||||
|
}
|
||||||
// Attachment messages carry an emoticon *definition* id from the
|
// Attachment messages carry an emoticon *definition* id from the
|
||||||
// sender, while the recipient's avatar view needs that definition's
|
// sender, while the recipient's avatar view needs that definition's
|
||||||
// media id. This is the normal path used by den attachments and
|
// media id. This is the normal path used by den attachments and
|
||||||
|
|||||||
+40
-8
@@ -215,9 +215,25 @@
|
|||||||
.page-title h1 { font-size: 26px; }
|
.page-title h1 { font-size: 26px; }
|
||||||
@media (max-width: 860px) {
|
@media (max-width: 860px) {
|
||||||
#panel { grid-template-columns: 1fr; }
|
#panel { grid-template-columns: 1fr; }
|
||||||
#side { position: static; height: auto; flex-direction: column; }
|
#side { position: static; height: auto; gap: 12px; padding: 12px; }
|
||||||
nav { flex-direction: row; flex-wrap: wrap; }
|
nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: thin; }
|
||||||
nav button { width: auto; }
|
nav button { flex: 0 0 auto; width: auto; }
|
||||||
|
#main { padding: 16px 12px 32px; }
|
||||||
|
section { padding: 15px; border-radius: 14px; }
|
||||||
|
.page-title { align-items: flex-start; flex-direction: column; gap: 3px; margin-bottom: 14px; }
|
||||||
|
.columns, .actions { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.toolbar input[type="search"] { flex-basis: 100%; min-width: 0; width: 100%; }
|
||||||
|
.table-wrap { max-width: 100%; }
|
||||||
|
}
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
body { font-size: 14px; overflow-x: hidden; }
|
||||||
|
.brand { padding: 0; }
|
||||||
|
.tiles, .paintings { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.tile { padding: 14px; }
|
||||||
|
.tile .value { font-size: 26px; }
|
||||||
|
dl { grid-template-columns: 1fr; gap: 2px; }
|
||||||
|
dd { margin-bottom: 9px; }
|
||||||
|
.preview { padding: 8px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
section { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
|
section { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
|
||||||
@@ -1002,6 +1018,8 @@
|
|||||||
let tab = "overview";
|
let tab = "overview";
|
||||||
let lastLogId = 0;
|
let lastLogId = 0;
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
// Older responses must never overwrite a newer account search.
|
||||||
|
let accountSearchRun = 0;
|
||||||
|
|
||||||
const api = async (path, body) => {
|
const api = async (path, body) => {
|
||||||
const response = await fetch(`/dashboard/api/admin/${path}`, body === undefined ? {} : {
|
const response = await fetch(`/dashboard/api/admin/${path}`, body === undefined ? {} : {
|
||||||
@@ -1735,6 +1753,7 @@
|
|||||||
// the server searches, once typing stops for a moment.
|
// the server searches, once typing stops for a moment.
|
||||||
let addressWait = null;
|
let addressWait = null;
|
||||||
$("account-search").addEventListener("input", () => {
|
$("account-search").addEventListener("input", () => {
|
||||||
|
accountSearchRun++;
|
||||||
clearTimeout(addressWait);
|
clearTimeout(addressWait);
|
||||||
addressWait = setTimeout($("account-search-by").value !== "name" ? searchByAddress : refresh, $("account-search-by").value !== "name" ? 400 : 250);
|
addressWait = setTimeout($("account-search-by").value !== "name" ? searchByAddress : refresh, $("account-search-by").value !== "name" ? 400 : 250);
|
||||||
});
|
});
|
||||||
@@ -1752,6 +1771,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("account-search-by").addEventListener("change", () => {
|
$("account-search-by").addEventListener("change", () => {
|
||||||
|
accountSearchRun++;
|
||||||
const byAddress = $("account-search-by").value !== "name";
|
const byAddress = $("account-search-by").value !== "name";
|
||||||
$("account-search").placeholder = {address: "203.0.113.7, or the start of one", device: "Hardware ID, or the start of one"}[$("account-search-by").value] || "Search";
|
$("account-search").placeholder = {address: "203.0.113.7, or the start of one", device: "Hardware ID, or the start of one"}[$("account-search-by").value] || "Search";
|
||||||
if (byAddress) {
|
if (byAddress) {
|
||||||
@@ -1761,7 +1781,10 @@
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("account-filter").addEventListener("change", () => refresh());
|
$("account-filter").addEventListener("change", () => {
|
||||||
|
accountSearchRun++;
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
|
|
||||||
const act = async (username, action, extra, statusElement) => {
|
const act = async (username, action, extra, statusElement) => {
|
||||||
const result = await api("account", {username, action, ...extra});
|
const result = await api("account", {username, action, ...extra});
|
||||||
@@ -2041,7 +2064,7 @@
|
|||||||
$("masterpieces").replaceChildren(...paintings.map(painting => {
|
$("masterpieces").replaceChildren(...paintings.map(painting => {
|
||||||
const box = el("div", undefined, "painting");
|
const box = el("div", undefined, "painting");
|
||||||
const picture = el("img");
|
const picture = el("img");
|
||||||
picture.src = `/admin/api/masterpiece?id=${encodeURIComponent(painting.id)}`;
|
picture.src = `/dashboard/api/admin/masterpiece?id=${encodeURIComponent(painting.id)}`;
|
||||||
picture.alt = `Painting by ${painting.creator}`;
|
picture.alt = `Painting by ${painting.creator}`;
|
||||||
picture.loading = "lazy";
|
picture.loading = "lazy";
|
||||||
picture.addEventListener("click", () => showPreview(picture.src));
|
picture.addEventListener("click", () => showPreview(picture.src));
|
||||||
@@ -2861,16 +2884,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tab === "accounts") {
|
else if (tab === "accounts") {
|
||||||
const query = $("account-search-by").value !== "name" ? "" : $("account-search").value.trim();
|
const searchBy = $("account-search-by").value;
|
||||||
result = await api(`accounts?q=${encodeURIComponent(query)}&filter=${$("account-filter").value}`);
|
const query = searchBy !== "name" ? "" : $("account-search").value.trim();
|
||||||
if (result.ok) {
|
const filter = $("account-filter").value;
|
||||||
|
const searchRun = ++accountSearchRun;
|
||||||
|
result = await api(`accounts?q=${encodeURIComponent(query)}&filter=${filter}`);
|
||||||
|
// A slower earlier search must not replace what the person just typed.
|
||||||
|
if (result.ok && searchRun === accountSearchRun && tab === "accounts"
|
||||||
|
&& searchBy === $("account-search-by").value
|
||||||
|
&& query === (searchBy !== "name" ? "" : $("account-search").value.trim())
|
||||||
|
&& filter === $("account-filter").value) {
|
||||||
accounts = result.data.accounts;
|
accounts = result.data.accounts;
|
||||||
accountTotal = result.data.total;
|
accountTotal = result.data.total;
|
||||||
badges = result.data.badges || [];
|
badges = result.data.badges || [];
|
||||||
await loadCurrent();
|
await loadCurrent();
|
||||||
|
if (searchRun === accountSearchRun && tab === "accounts") {
|
||||||
renderAccounts();
|
renderAccounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (tab === "stats") {
|
else if (tab === "stats") {
|
||||||
await window.statsView.load(api);
|
await window.statsView.load(api);
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-4
@@ -216,9 +216,25 @@
|
|||||||
.page-title h1 { font-size: 26px; }
|
.page-title h1 { font-size: 26px; }
|
||||||
@media (max-width: 860px) {
|
@media (max-width: 860px) {
|
||||||
#panel { grid-template-columns: 1fr; }
|
#panel { grid-template-columns: 1fr; }
|
||||||
#side { position: static; height: auto; flex-direction: column; }
|
#side { position: static; height: auto; gap: 12px; padding: 12px; }
|
||||||
nav { flex-direction: row; flex-wrap: wrap; }
|
nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: thin; }
|
||||||
nav button { width: auto; }
|
nav button { flex: 0 0 auto; width: auto; }
|
||||||
|
#main { padding: 16px 12px 32px; }
|
||||||
|
section { padding: 15px; border-radius: 14px; }
|
||||||
|
.page-title { align-items: flex-start; flex-direction: column; gap: 3px; margin-bottom: 14px; }
|
||||||
|
.columns, .actions { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.toolbar input[type="search"] { flex-basis: 100%; min-width: 0; width: 100%; }
|
||||||
|
.table-wrap { max-width: 100%; }
|
||||||
|
}
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
body { font-size: 14px; overflow-x: hidden; }
|
||||||
|
.brand { padding: 0; }
|
||||||
|
.tiles, .paintings { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.tile { padding: 14px; }
|
||||||
|
.tile .value { font-size: 26px; }
|
||||||
|
dl { grid-template-columns: 1fr; gap: 2px; }
|
||||||
|
dd { margin-bottom: 9px; }
|
||||||
|
.preview { padding: 8px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
section { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
|
section { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
|
||||||
@@ -1020,6 +1036,8 @@
|
|||||||
let tab = "home";
|
let tab = "home";
|
||||||
let selected = null; // the username of the player whose box is open
|
let selected = null; // the username of the player whose box is open
|
||||||
let players = [];
|
let players = [];
|
||||||
|
// Older responses must never overwrite a newer player search.
|
||||||
|
let playerSearchRun = 0;
|
||||||
let chatQuery = null; // what the Chat page shows: {username, room, text}
|
let chatQuery = null; // what the Chat page shows: {username, room, text}
|
||||||
let chatLines = [];
|
let chatLines = [];
|
||||||
let timer = null;
|
let timer = null;
|
||||||
@@ -1560,6 +1578,7 @@
|
|||||||
$("player-only").addEventListener("click", event => {
|
$("player-only").addEventListener("click", event => {
|
||||||
const chip = event.target.closest("button[data-only]");
|
const chip = event.target.closest("button[data-only]");
|
||||||
if (chip) {
|
if (chip) {
|
||||||
|
playerSearchRun++;
|
||||||
setListOnly(chip.dataset.only);
|
setListOnly(chip.dataset.only);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@@ -1567,6 +1586,7 @@
|
|||||||
|
|
||||||
// from another page: that player's box, whether or not the search shows them.
|
// from another page: that player's box, whether or not the search shows them.
|
||||||
const openPlayer = username => {
|
const openPlayer = username => {
|
||||||
|
playerSearchRun++;
|
||||||
$("player-search").value = username;
|
$("player-search").value = username;
|
||||||
$("player-search-by").value = "name";
|
$("player-search-by").value = "name";
|
||||||
$("player-search").placeholder = "Search";
|
$("player-search").placeholder = "Search";
|
||||||
@@ -1582,6 +1602,7 @@
|
|||||||
|
|
||||||
// every account that used a hardware ID: the player list, searched by it.
|
// every account that used a hardware ID: the player list, searched by it.
|
||||||
const searchDevice = id => {
|
const searchDevice = id => {
|
||||||
|
playerSearchRun++;
|
||||||
$("player-search-by").value = "device";
|
$("player-search-by").value = "device";
|
||||||
$("player-search").placeholder = "Hardware ID, or the start of one";
|
$("player-search").placeholder = "Hardware ID, or the start of one";
|
||||||
$("player-search").value = id;
|
$("player-search").value = id;
|
||||||
@@ -1664,6 +1685,7 @@
|
|||||||
// by address, asked once typing stops: each search is written down.
|
// by address, asked once typing stops: each search is written down.
|
||||||
let searchWait = null;
|
let searchWait = null;
|
||||||
$("player-search").addEventListener("input", () => {
|
$("player-search").addEventListener("input", () => {
|
||||||
|
playerSearchRun++;
|
||||||
clearTimeout(searchWait);
|
clearTimeout(searchWait);
|
||||||
searchWait = setTimeout(refresh, $("player-search-by").value === "name" ? 250 : 700);
|
searchWait = setTimeout(refresh, $("player-search-by").value === "name" ? 250 : 700);
|
||||||
});
|
});
|
||||||
@@ -1687,6 +1709,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("player-search-by").addEventListener("change", () => {
|
$("player-search-by").addEventListener("change", () => {
|
||||||
|
playerSearchRun++;
|
||||||
$("player-search").placeholder = {address: "203.0.113.7, or the start of one", device: "Hardware ID, or the start of one"}[$("player-search-by").value] || "Search";
|
$("player-search").placeholder = {address: "203.0.113.7, or the start of one", device: "Hardware ID, or the start of one"}[$("player-search-by").value] || "Search";
|
||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
@@ -1966,7 +1989,7 @@
|
|||||||
let recentList = [];
|
let recentList = [];
|
||||||
let paintingsShown = "";
|
let paintingsShown = "";
|
||||||
let recentShown = "";
|
let recentShown = "";
|
||||||
const paintingSrc = painting => `/mod/api/masterpiece?id=${encodeURIComponent(painting.id)}`;
|
const paintingSrc = painting => `/dashboard/api/staff/masterpiece?id=${encodeURIComponent(painting.id)}`;
|
||||||
const paintingWords = painting => (painting.status === "waiting" ? `Waiting · painted ${ago(painting.createdAt)}`
|
const paintingWords = painting => (painting.status === "waiting" ? `Waiting · painted ${ago(painting.createdAt)}`
|
||||||
: `Approved${painting.approvedAt ? ` ${ago(painting.approvedAt)}` : ""}${painting.approvedBy ? ` by ${painting.approvedBy === myName ? "you" : painting.approvedBy}` : ""}`
|
: `Approved${painting.approvedAt ? ` ${ago(painting.approvedAt)}` : ""}${painting.approvedBy ? ` by ${painting.approvedBy === myName ? "you" : painting.approvedBy}` : ""}`
|
||||||
+ `${painting.likes ? ` · ${painting.likes} ${painting.likes === 1 ? "like" : "likes"}` : ""}`);
|
+ `${painting.likes ? ` · ${painting.likes} ${painting.likes === 1 ? "like" : "likes"}` : ""}`);
|
||||||
@@ -2766,9 +2789,13 @@
|
|||||||
const searchBy = $("player-search-by").value;
|
const searchBy = $("player-search-by").value;
|
||||||
const byAddress = searchBy !== "name";
|
const byAddress = searchBy !== "name";
|
||||||
const query = $("player-search").value.trim();
|
const query = $("player-search").value.trim();
|
||||||
|
const searchRun = ++playerSearchRun;
|
||||||
$("address-hint").hidden = searchBy !== "address";
|
$("address-hint").hidden = searchBy !== "address";
|
||||||
$("player-only").hidden = byAddress;
|
$("player-only").hidden = byAddress;
|
||||||
if (byAddress && query === "") {
|
if (byAddress && query === "") {
|
||||||
|
if (searchRun !== playerSearchRun || tab !== "players") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
players = [];
|
players = [];
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
$("players-more").hidden = true;
|
$("players-more").hidden = true;
|
||||||
@@ -2777,6 +2804,12 @@
|
|||||||
else {
|
else {
|
||||||
const only = listOnly();
|
const only = listOnly();
|
||||||
const result = await api(`players?q=${encodeURIComponent(query)}${byAddress ? `&by=${searchBy}` : only ? `&only=${only}` : ""}`);
|
const result = await api(`players?q=${encodeURIComponent(query)}${byAddress ? `&by=${searchBy}` : only ? `&only=${only}` : ""}`);
|
||||||
|
if (searchRun !== playerSearchRun || tab !== "players"
|
||||||
|
|| searchBy !== $("player-search-by").value
|
||||||
|
|| query !== $("player-search").value.trim()
|
||||||
|
|| (!byAddress && only !== listOnly())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
players = result.ok ? result.data.players : [];
|
players = result.ok ? result.data.players : [];
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
const total = result.ok && result.data.total ? result.data.total : players.length;
|
const total = result.ok && result.data.total ? result.data.total : players.length;
|
||||||
|
|||||||
@@ -85,6 +85,21 @@ const run = async () => {
|
|||||||
await a.untilXt("ac");
|
await a.untilXt("ac");
|
||||||
await a.nextXt("il");
|
await a.nextXt("il");
|
||||||
|
|
||||||
|
// Actions are normally live type-3 chat packets. A player who enters after
|
||||||
|
// one has started must receive the current action after the avatar itself,
|
||||||
|
// including its mirror marker, rather than seeing an idle animal.
|
||||||
|
say(a, roomId, ":dance:%3%m1");
|
||||||
|
assert.deepStrictEqual((await b.untilXt("uc")).slice(2), [String(annLogin.params.userId), ":dance:", "3", "m1"]);
|
||||||
|
const {client: c} = await arrive("Cat", "KettlePass01");
|
||||||
|
assert.deepStrictEqual((await c.untilXt("uc")).slice(2), [String(annLogin.params.userId), ":dance:", "3", "m1"]);
|
||||||
|
await a.untilXt("ac"); // Cat appearing in the room
|
||||||
|
await a.nextXt("il");
|
||||||
|
await b.untilXt("ac");
|
||||||
|
await b.nextXt("il");
|
||||||
|
c.socket.destroy();
|
||||||
|
await a.untilXt("ar");
|
||||||
|
await b.untilXt("ar");
|
||||||
|
|
||||||
// the shop's name and stalls come from its room file (lib/roominfo.js),
|
// the shop's name and stalls come from its room file (lib/roominfo.js),
|
||||||
// read the first time anyone goes in; until then the name is made from its
|
// read the first time anyone goes in; until then the name is made from its
|
||||||
// path. a scout goes in first and comes back until the file has been read,
|
// path. a scout goes in first and comes back until the file has been read,
|
||||||
@@ -514,6 +529,7 @@ const run = async () => {
|
|||||||
a.xt("fr", own[4], "Ben", 2);
|
a.xt("fr", own[4], "Ben", 2);
|
||||||
assert.deepStrictEqual((await a.nextXt("fr")).slice(2), ["1"]);
|
assert.deepStrictEqual((await a.nextXt("fr")).slice(2), ["1"]);
|
||||||
const waiting = (await panel("reports", undefined, admin)).data;
|
const waiting = (await panel("reports", undefined, admin)).data;
|
||||||
|
const reportId = waiting.reports[0].id;
|
||||||
assert.strictEqual(waiting.open, 1);
|
assert.strictEqual(waiting.open, 1);
|
||||||
assert.strictEqual(waiting.reports.length, 1);
|
assert.strictEqual(waiting.reports.length, 1);
|
||||||
assert.deepStrictEqual([waiting.reports[0].reporter, waiting.reports[0].target, waiting.reports[0].reason, waiting.reports[0].detail, waiting.reports[0].room],
|
assert.deepStrictEqual([waiting.reports[0].reporter, waiting.reports[0].target, waiting.reports[0].reason, waiting.reports[0].detail, waiting.reports[0].room],
|
||||||
@@ -690,6 +706,12 @@ const run = async () => {
|
|||||||
await panel("debug", {action: "everythingOnSale", on: false}, admin);
|
await panel("debug", {action: "everythingOnSale", on: false}, admin);
|
||||||
assert.ok(await dated(1030) > 0);
|
assert.ok(await dated(1030) > 0);
|
||||||
|
|
||||||
|
// Renames must carry the names shown on existing moderation records.
|
||||||
|
// The admin action disconnects Ben before making this change.
|
||||||
|
assert.strictEqual((await panel("account", {username: "Ben", action: "rename", newName: "Benny"}, admin)).status, 200);
|
||||||
|
const renamedReport = (await panel("reports?handled=1", undefined, admin)).data.reports.find(report => report.id === reportId);
|
||||||
|
assert.strictEqual(renamedReport.target, "Benny");
|
||||||
|
|
||||||
a.socket.destroy();
|
a.socket.destroy();
|
||||||
b.socket.destroy();
|
b.socket.destroy();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user