stop the infamous terrorist known as carpathian ibn al-florist from breaking the site everytime he wants a fat lottery payout
parent
30e65b101c
commit
6a40b3ec8d
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -13,44 +13,6 @@
|
|||
>
|
||||
</div>
|
||||
<div class="lottery-page--stats">
|
||||
{% if v.admin_level >= PERMS['LOTTERY_ADMIN'] %}
|
||||
<div
|
||||
class="lottery-page--stat"
|
||||
style="position: relative; padding-top: 1rem; overflow: hidden"
|
||||
>
|
||||
<i
|
||||
class="fas fa-broom"
|
||||
style="
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
right: -4px;
|
||||
font-size: 50px;
|
||||
color: var(--gray-600);
|
||||
"
|
||||
>
|
||||
</i>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-danger"
|
||||
id="endLotterySession"
|
||||
style="display: none"
|
||||
data-nonce="{{g.nonce}}"
|
||||
data-onclick="endLotterySession()"
|
||||
>
|
||||
End Current Session
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-success"
|
||||
id="startLotterySession"
|
||||
style="display: none"
|
||||
data-nonce="{{g.nonce}}"
|
||||
data-onclick="startLotterySession()"
|
||||
>
|
||||
Start New Session
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="lottery-page--stat">
|
||||
<div class="lottery-page--stat-keys">
|
||||
<div>Prize</div>
|
||||
|
|
Loading…
Reference in New Issue