forked from rDrama/rDrama
add button to claim paypig rewards for all users
parent
3ad15419c1
commit
65f9b986dd
|
@ -418,6 +418,7 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'MODS_EVERY_GROUP': 5,
|
||||
'IGNORE_DOMAIN_BAN': 5,
|
||||
'USER_RESET_PASSWORD': 5,
|
||||
'CLAIM_REWARDS_ALL_USERS': 5,
|
||||
}
|
||||
|
||||
FEATURES = {
|
||||
|
|
|
@ -23,6 +23,7 @@ from files.helpers.useractions import *
|
|||
from files.routes.routehelpers import check_for_alts
|
||||
from files.routes.wrappers import *
|
||||
from files.routes.routehelpers import get_alt_graph, get_alt_graph_ids
|
||||
from files.routes.users import claim_rewards_all_users
|
||||
|
||||
from .front import frontlist, comment_idlist
|
||||
|
||||
|
@ -428,6 +429,16 @@ def clear_cloudflare_cache(v):
|
|||
g.db.add(ma)
|
||||
return {"message": "Cloudflare cache cleared!"}
|
||||
|
||||
@app.post("/admin/claim_rewards_all_users")
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@admin_level_required(PERMS['CLAIM_REWARDS_ALL_USERS'])
|
||||
def admin_claim_rewards_all_users(v):
|
||||
claim_rewards_all_users()
|
||||
return {"message": "User rewards claimed!"}
|
||||
|
||||
def admin_badges_grantable_list(v):
|
||||
query = g.db.query(BadgeDef)
|
||||
|
||||
|
|
|
@ -140,4 +140,8 @@
|
|||
<button type="button" class="btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/clear_cloudflare_cache');" style="margin-bottom: 2em;">CLEAR CLOUDFLARE CACHE</button>
|
||||
{% endif %}
|
||||
|
||||
{% if v.admin_level >= PERMS['CLAIM_REWARDS_ALL_USERS'] %}
|
||||
<button type="button" class="btn btn-primary d-block" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/admin/claim_rewards_all_users');" style="margin-bottom: 2em;">CLAIM PAYPIG REWARDS FOR ALL USERS</button>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue