mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat: discord linking, @tags, music and sfx sliders, required device ids
- Discord: the account page links a player's Discord account through Discord's sign-in (lib/discord.js); only linked names are shown on cards (typed ones are cleared). A bot keeps the Server Booster badge on linked accounts that boost. The game tells the client where the player is, for the client's Discord rich presence (flashvars discordAppId). - @username tags in chat, chat balloons and wall posts: only real players' names (asked of the server, "xmn"), names with spaces too, drawn on a blue box; a click opens the player's card. - Settings: separate Music and SFX volume sliders for the old one. - Device ids required: a launcher that sends none (before 1.3.0) is told at the game's login "Your client is outdated. Update at https://burrow.moe/download". AJ_REQUIRE_DEVICE=0 turns it off. - Panels: clear a player's Jammer Wall posts; turning away masterpieces and player items asks first. - Item Giver: negative colour ids (the same colour written signed). - buildVersion 71; the client rebuilt with Snipzil's sitting fix.
This commit is contained in:
1 parent
1d9b70f32e
commit
33f56074a4
35 files changed
+2076
-101
No files matched your search
+31
-16
@@ -367,12 +367,10 @@
|
||||
<section>
|
||||
<h2>Discord</h2>
|
||||
<p id="badges" hidden></p>
|
||||
<form id="discord-form">
|
||||
<label for="discord-name">Username</label>
|
||||
<input id="discord-name" maxlength="33" autocomplete="off" spellcheck="false">
|
||||
<div class="row"><button class="primary" type="submit">Save</button>
|
||||
<button id="discord-remove" type="button">Remove</button></div>
|
||||
</form>
|
||||
<p id="discord-shown"></p>
|
||||
<p class="hint" id="discord-about">Shown on your card in the game. Sign in to Discord to link your account; boosting Burrow's Discord server gives you the Server Booster badge while you boost.</p>
|
||||
<div class="row"><button class="primary" id="discord-link" type="button">Link Discord</button>
|
||||
<button id="discord-remove" type="button">Unlink</button></div>
|
||||
<p class="status" id="discord-status" role="status"></p>
|
||||
</section>
|
||||
|
||||
@@ -805,11 +803,11 @@
|
||||
$("bio-text").maxLength = account.bioLimit + 20; // room for the line ends a browser counts double
|
||||
$("bio-remove").hidden = !account.bio;
|
||||
bioCount();
|
||||
// not while it is being typed in: every answer from the server draws the page again.
|
||||
if (document.activeElement !== $("discord-name")) {
|
||||
$("discord-name").value = account.discord;
|
||||
}
|
||||
$("discord-remove").hidden = !account.discord;
|
||||
// linked by signing in to Discord (lib/discord.js), not typed in
|
||||
$("discord-shown").textContent = account.discordLinked ? `Linked: ${account.discord}` : "Not linked.";
|
||||
$("discord-link").textContent = account.discordLinked ? "Link another" : "Link Discord";
|
||||
$("discord-link").hidden = !account.discordLinking;
|
||||
$("discord-remove").hidden = !account.discordLinked;
|
||||
$("badges").hidden = account.badges.length === 0;
|
||||
$("badges").textContent = `Badges: ${account.badges.join(", ")}`;
|
||||
|
||||
@@ -938,6 +936,11 @@
|
||||
if (result.ok) {
|
||||
account = result.data;
|
||||
render();
|
||||
// back from linking Discord: how it went, once
|
||||
if (discordResult && Object.hasOwn(DISCORD_RESULTS, discordResult)) {
|
||||
setStatus("discord-status", DISCORD_RESULTS[discordResult], discordResult !== "linked");
|
||||
history.replaceState(null, "", location.pathname + location.hash);
|
||||
}
|
||||
}
|
||||
else {
|
||||
showGate(result.status === 0 ? result.data.error : "");
|
||||
@@ -1340,12 +1343,24 @@
|
||||
});
|
||||
$("bio-remove").addEventListener("click", () => act({action: "bio", text: ""}, "bio-status"));
|
||||
|
||||
$("discord-form").addEventListener("submit", async event => {
|
||||
event.preventDefault();
|
||||
$("discord-name").blur();
|
||||
await act({action: "discord", name: $("discord-name").value}, "discord-status");
|
||||
// off to Discord's sign-in; it comes back to /account?discord=<how it went>
|
||||
$("discord-link").addEventListener("click", () => {
|
||||
location.href = "/account/discord/link";
|
||||
});
|
||||
$("discord-remove").addEventListener("click", () => act({action: "discord", name: ""}, "discord-status"));
|
||||
$("discord-remove").addEventListener("click", () => {
|
||||
if (confirm("Unlink your Discord account? It comes off your card, and so does the Server Booster badge.")) {
|
||||
act({action: "discord", name: ""}, "discord-status");
|
||||
}
|
||||
});
|
||||
const DISCORD_RESULTS = {
|
||||
linked: "Discord linked.",
|
||||
cancelled: "Linking was cancelled.",
|
||||
expired: "That took too long, or was started in another browser. Try again.",
|
||||
taken: "That Discord account is linked to another Burrow account.",
|
||||
discord: "Discord did not answer. Try again later.",
|
||||
off: "Linking Discord is not available right now.",
|
||||
};
|
||||
const discordResult = new URLSearchParams(location.search).get("discord");
|
||||
|
||||
$("lock").addEventListener("click", () => {
|
||||
if (!account.locked && !window.confirm("Lock the account? Nobody gets in until you unlock it here.")) {
|
||||
|
||||
+19
-4
@@ -503,8 +503,9 @@
|
||||
<h3>Badges</h3>
|
||||
<div class="buttons" id="badge-boxes"></div>
|
||||
<div class="row" style="margin-top:8px"><button type="button" data-action="badges">Set</button></div>
|
||||
<div class="row" style="margin-top:8px"><input id="discord-name" maxlength="33" placeholder="Discord username" autocomplete="off" spellcheck="false" aria-label="Discord username">
|
||||
<button type="button" data-action="discord">Set</button></div>
|
||||
<div class="row" style="margin-top:8px" title="Players link their Discord themselves, on the account page">
|
||||
<span class="hint" id="discord-name"></span>
|
||||
<button type="button" data-action="discord">Unlink Discord</button></div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<h3>Ban</h3>
|
||||
@@ -576,6 +577,7 @@
|
||||
</select>
|
||||
<button type="button" data-action="role">Set role</button>
|
||||
<button type="button" data-action="clearDen">Clear den</button>
|
||||
<button type="button" data-action="clearWallPosts" title="Every post they wrote on anyone's Jammer Wall, and the replies to those">Clear wall posts</button>
|
||||
<button type="button" data-action="delete" class="danger">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1440,7 +1442,7 @@
|
||||
label.append(box, ` ${badge.label}`);
|
||||
return label;
|
||||
}));
|
||||
$("discord-name").value = current ? current.discord : "";
|
||||
$("discord-name").textContent = current && current.discord ? `Discord: ${current.discord}` : "No Discord linked";
|
||||
$("bio-text").value = current ? current.bio : "";
|
||||
$("quest-level").value = current ? current.level : "";
|
||||
$("ban-reason").value = current ? current.banReason : "";
|
||||
@@ -1628,7 +1630,7 @@
|
||||
case "gems": return {amount: numberFrom("gems-amount")};
|
||||
case "gift": return giftBody();
|
||||
case "badges": return {badges: [...$("badge-boxes").querySelectorAll("input:checked")].map(box => box.value)};
|
||||
case "discord": return {name: $("discord-name").value};
|
||||
case "discord": return {name: ""};
|
||||
case "bio": return {text: $("bio-text").value};
|
||||
case "level": return {level: numberFrom("quest-level")};
|
||||
default: return {};
|
||||
@@ -1658,6 +1660,9 @@
|
||||
if (action === "unbanDevices" && !window.confirm(`Lift the hardware bans on ${selected}?`)) {
|
||||
return;
|
||||
}
|
||||
if (action === "clearWallPosts" && !window.confirm(`Remove every post ${selected} wrote on any Jammer Wall, and the replies to them? This cannot be undone.`)) {
|
||||
return;
|
||||
}
|
||||
if (action === "banDevices" && !window.confirm(`Hardware ban ${selected}? Everyone on their hardware is put out.`)) {
|
||||
return;
|
||||
}
|
||||
@@ -1999,10 +2004,16 @@
|
||||
el("div", `${when(painting.createdAt)}${painting.status === "approved" ? `, ${painting.likes} like${painting.likes === 1 ? "" : "s"}` : ""}`
|
||||
+ `${which === "all" ? (painting.status === "waiting" ? " · waiting" : " · approved") : ""}`, "hint"));
|
||||
const buttons = el("div", undefined, "buttons");
|
||||
// rejecting or removing asks first; approving does not
|
||||
const sure = action => action === "approve" || confirm(action === "reject"
|
||||
? `Reject this painting by ${painting.creator}?` : `Remove this painting by ${painting.creator} from show?`);
|
||||
const button = (label, action, className) => {
|
||||
const node = el("button", label, className);
|
||||
node.type = "button";
|
||||
node.addEventListener("click", async () => {
|
||||
if (!sure(action)) {
|
||||
return;
|
||||
}
|
||||
node.disabled = true;
|
||||
const result = await api("masterpiece", {id: painting.id, action});
|
||||
setStatus($("masterpiece-status"), result.data.ok || result.data.error || "That did not work.", !result.ok);
|
||||
@@ -2335,6 +2346,10 @@
|
||||
el("div", `by ${entry.maker} · ${when(entry.createdAt)}${entry.makerStrikes ? ` · ${entry.makerStrikes} of ${data.strikes} pictures turned away before` : ""}`, "hint"));
|
||||
const buttons = el("div", undefined, "buttons");
|
||||
const decide = approve => async () => {
|
||||
// turning away asks first; approving does not
|
||||
if (!approve && !confirm(`Turn away ${entry.waiting === "item" ? "the item" : "the picture of"} "${entry.name}" by ${entry.maker}?`)) {
|
||||
return;
|
||||
}
|
||||
const result = await api("review", {kind: entry.kind, id: entry.id, approve});
|
||||
setStatus($("review-status"), said(result), !result.ok);
|
||||
await refresh();
|
||||
|
||||
@@ -84,6 +84,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// where the player is, for the client's Discord rich presence
|
||||
// (AJClient.presenceRoom): a short line such as "In Jamaa Township".
|
||||
function ajPresence(text) {
|
||||
window.ipc.sendToHost("presence", String(text).slice(0, 100));
|
||||
}
|
||||
|
||||
function ajPrint(imageData) {
|
||||
window.ipc.sendToHost("printImage", imageData);
|
||||
}
|
||||
|
||||
+15
-2
@@ -477,11 +477,13 @@
|
||||
<button type="button" data-action="goto">Go to them</button></div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<h3>Username and bio</h3>
|
||||
<h3>Username, bio and wall posts</h3>
|
||||
<div class="row">
|
||||
<button type="button" data-action="rejectName" class="danger">Reject username</button>
|
||||
<button type="button" data-action="acceptName">Take back</button>
|
||||
<button type="button" data-action="clearBio">Clear bio</button></div>
|
||||
<div class="row" style="margin-top:8px" title="Every post they wrote on anyone's Jammer Wall, and the replies to those">
|
||||
<button type="button" data-action="clearWallPosts" class="danger">Clear wall posts</button></div>
|
||||
</div>
|
||||
</div>
|
||||
<h3 style="margin:16px 0 4px">Other accounts</h3>
|
||||
@@ -1117,6 +1119,7 @@
|
||||
unbanDevices: name => `Lift the hardware bans on ${name}?`,
|
||||
rejectName: name => `Reject the username ${name}? They are signed out and must pick another.`,
|
||||
unwarn: name => `Take back ${name}'s latest warning?`,
|
||||
clearWallPosts: name => `Remove every post ${name} wrote on any Jammer Wall, and the replies to them? This cannot be undone.`,
|
||||
};
|
||||
|
||||
$("detail").addEventListener("click", async event => {
|
||||
@@ -1404,7 +1407,13 @@
|
||||
box.append(picture, el("h3", painting.creator),
|
||||
el("div", `${when(painting.createdAt)}${which === "all" ? (painting.status === "waiting" ? " · waiting" : " · on show") : ""}`, "hint"));
|
||||
const buttons = el("div", undefined, "buttons");
|
||||
// rejecting or removing asks first; approving does not
|
||||
const sure = action => action === "approve" || confirm(action === "reject"
|
||||
? `Reject this painting by ${painting.creator}?` : `Remove this painting by ${painting.creator} from show?`);
|
||||
const does = (label, action, className) => button(label, async () => {
|
||||
if (!sure(action)) {
|
||||
return;
|
||||
}
|
||||
const result = await api("masterpiece", {id: painting.id, action});
|
||||
setStatus($("masterpiece-status"), said(result), !result.ok);
|
||||
refresh();
|
||||
@@ -1843,6 +1852,10 @@
|
||||
el("div", `by ${entry.maker} · ${when(entry.createdAt)}${entry.makerStrikes ? ` · ${entry.makerStrikes} of ${data.strikes} pictures turned away before` : ""}`, "hint"));
|
||||
const buttons = el("div", undefined, "buttons");
|
||||
const decide = approve => async () => {
|
||||
// turning away asks first; approving does not
|
||||
if (!approve && !confirm(`Turn away ${entry.waiting === "item" ? "the item" : "the picture of"} "${entry.name}" by ${entry.maker}?`)) {
|
||||
return;
|
||||
}
|
||||
const result = await api("review", {kind: entry.kind, id: entry.id, approve});
|
||||
setStatus($("review-status"), said(result), !result.ok);
|
||||
await refresh();
|
||||
@@ -2095,7 +2108,7 @@
|
||||
silence: "chat.silence", unsilence: "chat.silence",
|
||||
kick: "player.kick", message: "player.warn", warn: "player.warn", unwarn: "player.warn",
|
||||
rejectName: "player.names", acceptName: "player.names", clearBio: "player.names",
|
||||
banAddress: "address.ban", summon: "player.summon", goto: "player.goto",
|
||||
clearWallPosts: "player.names", banAddress: "address.ban", summon: "player.summon", goto: "player.goto",
|
||||
};
|
||||
const applyPermissions = async () => {
|
||||
const result = await api("me");
|
||||
|
||||
Reference in new issue
Block a user