add discord linking for rdrama
parent
73649e987c
commit
b17f4b7319
|
@ -41,6 +41,30 @@ def settings(v):
|
||||||
def settings_personal(v):
|
def settings_personal(v):
|
||||||
return render_template("settings/personal.html", v=v, msg=get_msg(), error=get_error())
|
return render_template("settings/personal.html", v=v, msg=get_msg(), error=get_error())
|
||||||
|
|
||||||
|
@app.post('/settings/discord')
|
||||||
|
@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)
|
||||||
|
@auth_required
|
||||||
|
def link_discord(v):
|
||||||
|
if v.is_banned:
|
||||||
|
return {"message": "You're already banned!"}
|
||||||
|
|
||||||
|
reason = "Rule 4"
|
||||||
|
v.ban(reason=reason, days=1)
|
||||||
|
text = f"@AutoJanny has banned you for 1 day for the following reason:\n\n> {reason}"
|
||||||
|
send_repeatable_notification(v.id, text)
|
||||||
|
ma = ModAction(
|
||||||
|
kind="ban_user",
|
||||||
|
user_id=AUTOJANNY_ID,
|
||||||
|
target_user_id=v.id,
|
||||||
|
_note=f'duration: for 1 day, reason: "{reason}"'
|
||||||
|
)
|
||||||
|
g.db.add(ma)
|
||||||
|
|
||||||
|
return {"message": "You have been banned for 1 day!"}
|
||||||
|
|
||||||
@app.post('/settings/remove_background')
|
@app.post('/settings/remove_background')
|
||||||
@limiter.limit('1/second', scope=rpath)
|
@limiter.limit('1/second', scope=rpath)
|
||||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||||
|
|
|
@ -224,6 +224,26 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{% if SITE_NAME == 'rDrama' %}
|
||||||
|
<section id="site-settings-linked-accounts-section" class="settings-section-section">
|
||||||
|
<h5>Linked Accounts</h5>
|
||||||
|
<div class="settings-section rounded">
|
||||||
|
<div id="discord-section" class="d-lg-flex border-bottom">
|
||||||
|
<div class="title w-lg-25">
|
||||||
|
<label for="discord">Discord</label>
|
||||||
|
</div>
|
||||||
|
<div class="body w-lg-100">
|
||||||
|
<form id="discord" action="/settings/discord" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
|
||||||
|
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
|
||||||
|
<input autocomplete="off" class="btn btn-primary" type="submit" value="Link Discord">
|
||||||
|
</form>
|
||||||
|
<small class="d-block mt-2">Link your Discord account to join the {{SITE_NAME}} Discord server.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<section id="site-settings-sort-time-filter-section" class="settings-section-section">
|
<section id="site-settings-sort-time-filter-section" class="settings-section-section">
|
||||||
<h5>RSS Feed</h5>
|
<h5>RSS Feed</h5>
|
||||||
<p class="text-small text-muted">Subscribe to the {{SITE_NAME}} RSS feed.</p>
|
<p class="text-small text-muted">Subscribe to the {{SITE_NAME}} RSS feed.</p>
|
||||||
|
|
Loading…
Reference in New Issue