mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37: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.")) {
|
||||
|
||||
Reference in new issue
Block a user