Skip to content

Commit

Permalink
Fix some HTML escaping in best-of rooms (#9934)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaWoblefet authored Dec 8, 2023
1 parent 3929532 commit 97a5440
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/room-battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ export class BestOfGame extends RoomGames.RoomGame {
).update();
this.updateDisplay();
this.room.add(`|html|<h2>Game ${this.games.length}</h2>`);
this.room.add(`|html|<a href="/${battle.roomid}">${battle.title}</a>`);
this.room.add(Utils.html`|html|<a href="/${battle.roomid}">${battle.title}</a>`);
this.room.update();
}
updateDisplay() {
Expand Down Expand Up @@ -1554,7 +1554,7 @@ export class BestOfGame extends RoomGames.RoomGame {
this.games[this.games.length - 1].winner = isTie ? '' : winnerid;

this.room.add(
`|html|${winnerid ? `${this.name(winnerid)} won game ${this.games.length}!` : `Game ${this.games.length} was a tie`}`
Utils.html`|html|${winnerid ? `${this.name(winnerid)} won game ${this.games.length}!` : `Game ${this.games.length} was a tie`}`
).update();
for (const k in this.wins) {
if (this.wins[k as 'p1' | 'p2'] >= this.winThreshold) {
Expand All @@ -1571,9 +1571,8 @@ export class BestOfGame extends RoomGames.RoomGame {
for (const userid in room.battle.playerTable) {
const player = room.battle.playerTable[userid];
player.id = userid as ID; // re-link users so that we can use timer properly
const name = Utils.escapeHTML(this.name(userid));
const button = `|c|&|/uhtml prompt-${userid},<button class="button notifying" name="send" value="${cmd}">I'm ready!</button>`;
const prompt = `|c|&|/log Are you ready for game ${this.games.length + 1}, ${name}?`;
const prompt = `|c|&|/log Are you ready for game ${this.games.length + 1}, ${this.name(userid)}?`;
player.sendRoom(prompt);
player.sendRoom(button);
// send it to the main room as well, in case they x out of the old one
Expand Down

0 comments on commit 97a5440

Please sign in to comment.