From 6a40b3ec8d2d28655574e0f80b183128fe91610a Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 3 Apr 2023 19:57:56 +0200 Subject: [PATCH] stop the infamous terrorist known as carpathian ibn al-florist from breaking the site everytime he wants a fat lottery payout --- files/assets/js/lottery.js | 30 ---------------------------- files/routes/lottery.py | 11 ----------- files/templates/lottery.html | 38 ------------------------------------ 3 files changed, 79 deletions(-) diff --git a/files/assets/js/lottery.js b/files/assets/js/lottery.js index 65dbf4e46..fa4d6cfb8 100644 --- a/files/assets/js/lottery.js +++ b/files/assets/js/lottery.js @@ -48,24 +48,6 @@ function ensureIntent() { return window.confirm("Are you sure you want to end the current lottery?"); } -function startLotterySession() { - checkLotteryStats(); - - if (ensureIntent()) { - return handleLotteryRequest("start", "POST", () => - location.reload() - ); - } -} - -function endLotterySession() { - checkLotteryStats(); - - if (ensureIntent()) { - return handleLotteryRequest("end", "POST", () => location.reload()); - } -} - // Composed function handleLotteryRequest(uri, method, callback = () => {}) { const form = new FormData(); @@ -162,18 +144,6 @@ function handleLotteryResponse(xhr, method, callback) { ticketsHeldTotalField.textContent = user.ticketsHeld.total; winningsField.textContent = user.winnings; - - const [endButton, startButton] = [ - "endLotterySession", - "startLotterySession", - ].map((id) => document.getElementById(id)); - if (response.stats.lottery) { - endButton.style.display = "block"; - startButton.style.display = "none"; - } else { - endButton.style.display = "none"; - startButton.style.display = "block"; - } } } diff --git a/files/routes/lottery.py b/files/routes/lottery.py index 9d1010ff7..12641e491 100644 --- a/files/routes/lottery.py +++ b/files/routes/lottery.py @@ -6,17 +6,6 @@ from files.routes.wrappers import * from files.__main__ import app, limiter -@app.post("/lottery/end") -@limiter.limit('1/second', scope=rpath) -@limiter.limit('1/second', scope=rpath, key_func=get_ID) -@limiter.limit(DEFAULT_RATELIMIT) -@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID) -@admin_level_required(PERMS['LOTTERY_ADMIN']) -def lottery_end(v): - success, message = end_lottery_session() - return {"message": message} if success else {"error": message} - - @app.post("/lottery/start") @limiter.limit('1/second', scope=rpath) @limiter.limit('1/second', scope=rpath, key_func=get_ID) diff --git a/files/templates/lottery.html b/files/templates/lottery.html index 90313018c..a588cda90 100644 --- a/files/templates/lottery.html +++ b/files/templates/lottery.html @@ -13,44 +13,6 @@ >
- {% if v.admin_level >= PERMS['LOTTERY_ADMIN'] %} -
- - - - -
- {% endif %}
Prize