summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html9
-rw-r--r--server.js7
2 files changed, 16 insertions, 0 deletions
diff --git a/index.html b/index.html
index 6325eb1..a99c6ca 100644
--- a/index.html
+++ b/index.html
@@ -28,6 +28,11 @@
<input type="submit" value="Crunch">
</form>
</p>
+ <p>
+ <form id="crunchglobal-form">
+ <input type="submit" value="Crunch global stats">
+ </form>
+ </p>
<ul id="updates"></ul>
@@ -106,6 +111,10 @@
subscribe(ign);
$.post("/api/player/" + ign + "/crunch");
});
+ $("#crunchglobal-form").submit((e) => {
+ e.preventDefault();
+ $.post("/api/crunch");
+ });
</script>
</body>
</html>
diff --git a/server.js b/server.js
index 235723d..eb800f5 100644
--- a/server.js
+++ b/server.js
@@ -191,6 +191,13 @@ app.post("/api/samples", async (req, res) => {
{ persistent: true, type: "samples" });
res.sendStatus(204);
});
+// crunch global stats
+app.post("/api/crunch", async (req, res) => {
+ console.log("crunching global stats");
+ await ch.sendToQueue("crunch", new Buffer(""),
+ { persistent: true, type: "global" });
+ res.sendStatus(204);
+});
// crunch data
app.post("/api/stats/:dimension_on/update", async (req, res) => {