Skip to content

Commit

Permalink
Merge pull request #104 from ekzhang/develop
Browse files Browse the repository at this point in the history
Release 3.0.7
  • Loading branch information
ekzhang authored Mar 19, 2021
2 parents 9596b61 + a170145 commit af5d2c1
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions scripts/src/fixGames.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import assert from "assert";
import admin from "firebase-admin";

/** Fix games that have `endedAt === 0` due to a site migration bug in v3.0.0. */
export async function fixGames() {
const badGames = await admin
.database()
.ref("games")
.orderByChild("endedAt")
.equalTo(0)
.once("value");

for (const [gameId, game] of Object.entries(badGames.val())) {
console.log(`Fixing game ${gameId}...`);
console.log({ [gameId]: game });
assert.strictEqual(game.status, "done");
const events = await admin
.database()
.ref(`gameData/${gameId}/events`)
.once("value");
let lastTime = 0;
events.forEach((event) => {
lastTime = event.val().time;
});
console.log(`Setting endedAt = ${lastTime}...`);
await admin.database().ref(`games/${gameId}/endedAt`).set(lastTime);
console.log("Done.\n");
}

console.log("Completed all games!");
}
3 changes: 2 additions & 1 deletion scripts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import inquirer from "inquirer";

import { listAdmins, listPatrons } from "./listUsers";
import { sanitizeNames } from "./sanitizeNames";
import { fixGames } from "./fixGames";

// Add scripts as functions to this array
const scripts = [listAdmins, listPatrons, sanitizeNames];
const scripts = [listAdmins, listPatrons, sanitizeNames, fixGames];

admin.initializeApp({
credential: admin.credential.cert("./credential.json"),
Expand Down
18 changes: 9 additions & 9 deletions src/pages/DonatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ function DonatePage() {
</Typography>
<Typography variant="body1" gutterBottom>
If you enjoy using this site, please consider supporting us by
donating and becoming a patron. In addition to helping us pay for
ultra-fast servers and ongoing development, you'll gain access to some{" "}
cosmetic perks:
donating and becoming a patron. We're a small team, so your support
makes a huge difference. In addition to helping us make the site
better, you'll gain access to some cosmetic perks:
</Typography>
<Typography variant="body1" gutterBottom component="div">
<ul>
Expand All @@ -81,14 +81,14 @@ function DonatePage() {
).
</li>
<li>
Freedom to create a name without limiting to just letters,
numbers, and punctuation.
Use any characters in your name: not just letters, numbers, and
punctuation.
</li>
<li>
Exclusive setting to choose the color of your username &mdash;
pick whatever you like!
Exclusive setting to choose the color of your name &mdash; change
it at any time!
</li>
<li>More to come soon!</li>
<li>More to come soon</li>
</ul>
</Typography>
<Typography variant="body1" gutterBottom>
Expand Down Expand Up @@ -130,7 +130,7 @@ function DonatePage() {
<Typography variant="body1" style={{ fontStyle: "italic" }}>
It looks like you're playing anonymously right now. If you'd like to
become a patron, please link your Google account from the settings
menu, so you can log in at any time.
menu.
</Typography>
)}
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion src/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function patronCheckout(email) {
lineItems: [{ price: config.stripe.priceId, quantity: 1 }],
mode: "subscription",
successUrl: origin + "/donate",
cancelUrl: origin,
cancelUrl: origin + "/donate",
customerEmail: email,
});
}
Expand Down

0 comments on commit af5d2c1

Please sign in to comment.