forked from rDrama/rDrama
addendum to 149095d91e
parent
77ddfa6a7b
commit
1882653da6
|
@ -871,7 +871,7 @@ def pin_post(post_id, v):
|
||||||
else: return {"message": "Post unpinned!"}
|
else: return {"message": "Post unpinned!"}
|
||||||
return abort(404, "Post not found!")
|
return abort(404, "Post not found!")
|
||||||
|
|
||||||
@app.put("/post/<int:post_id>/new")
|
@app.post("/post/<int:post_id>/new")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@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)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
|
@ -893,7 +893,7 @@ def set_new_sort(post_id, v):
|
||||||
return {"message": "Changed the the default sorting of comments on this post to 'new'"}
|
return {"message": "Changed the the default sorting of comments on this post to 'new'"}
|
||||||
|
|
||||||
|
|
||||||
@app.delete("/post/<int:post_id>/new")
|
@app.post("/post/<int:post_id>/hot")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@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)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -40,7 +40,7 @@ def settings(v):
|
||||||
def settings_personal(v):
|
def settings_personal(v):
|
||||||
return render_template("settings/personal.html", v=v, error=get_error())
|
return render_template("settings/personal.html", v=v, error=get_error())
|
||||||
|
|
||||||
@app.delete('/settings/background')
|
@app.post('/settings/remove_background')
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@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)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -543,7 +543,7 @@ def upload_sub_banner(v, sub):
|
||||||
|
|
||||||
return redirect(f'/h/{sub}/settings')
|
return redirect(f'/h/{sub}/settings')
|
||||||
|
|
||||||
@app.delete("/h/<sub>/settings/banners/<int:index>")
|
@app.post("/h/<sub>/settings/banners/delete/<int:index>")
|
||||||
@limiter.limit("1/second;30/day", deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit("1/second;30/day", deduct_when=lambda response: response.status_code < 400)
|
||||||
@limiter.limit("1/second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit("1/second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@is_not_permabanned
|
@is_not_permabanned
|
||||||
|
@ -574,7 +574,7 @@ def delete_sub_banner(v, sub, index):
|
||||||
|
|
||||||
return {"message": f"Deleted banner {index} from /h/{sub} successfully"}
|
return {"message": f"Deleted banner {index} from /h/{sub} successfully"}
|
||||||
|
|
||||||
@app.delete("/h/<sub>/settings/banners/")
|
@app.post("/h/<sub>/settings/banners/delete_all")
|
||||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400)
|
||||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@is_not_permabanned
|
@is_not_permabanned
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
<a class="dropdown-item list-inline-item text-info" href="{{p.oauth_app.permalink}}/posts"><i class="fas fa-code"></i>API App</a>
|
<a class="dropdown-item list-inline-item text-info" href="{{p.oauth_app.permalink}}/posts"><i class="fas fa-code"></i>API App</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.can_edit(p) %}
|
{% if v.can_edit(p) %}
|
||||||
<button type="button" class="dropdown-item {% if p.new %} d-none{% endif %} list-inline-item text-info" id="{{p.id}}-sort-new" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-sort-new', '{{p.id}}-unsort-new', 'd-none', 'null', 'PUT')"><i class="fas fa-sparkles text-center mr-2"></i>Set Default Sort New</button>
|
<button type="button" class="dropdown-item {% if p.new %} d-none{% endif %} list-inline-item text-info" id="{{p.id}}-sort-new" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-sort-new', '{{p.id}}-unsort-new', 'd-none', 'null')"><i class="fas fa-sparkles text-center mr-2"></i>Set Default Sort New</button>
|
||||||
<button type="button" class="dropdown-item {% if not p.new %} d-none{% endif %} list-inline-item text-info" id="{{p.id}}-unsort-new" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-unsort-new', '{{p.id}}-sort-new', 'd-none', 'null', 'DELETE')"><i class="fas fa-fire text-center mr-2"></i>Set Default Sort Hot</button>
|
<button type="button" class="dropdown-item {% if not p.new %} d-none{% endif %} list-inline-item text-info" id="{{p.id}}-unsort-new" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/hot', '{{p.id}}-unsort-new', '{{p.id}}-sort-new', 'd-none', 'null')"><i class="fas fa-fire text-center mr-2"></i>Set Default Sort Hot</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] %}
|
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] %}
|
||||||
<button type="button" id="distinguish-{{p.id}}" class="dropdown-item {% if p.distinguish_level %}d-none{% endif %} list-inline-item text-info" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}','d-none')"><i class="fas fa-crown"></i>Distinguish</button>
|
<button type="button" id="distinguish-{{p.id}}" class="dropdown-item {% if p.distinguish_level %}d-none{% endif %} list-inline-item text-info" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}','d-none')"><i class="fas fa-crown"></i>Distinguish</button>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.can_edit(p) %}
|
{% if v.can_edit(p) %}
|
||||||
<button id="{{p.id}}-sort-new-mobile" type="button" class="{% if p.new %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-sort-new-mobile', '{{p.id}}-unsort-new-mobile', 'd-none', 'null', 'PUT')" data-bs-dismiss="modal"><i class="fas fa-sparkles text-center text-primary mr-2"></i>Set Default Sort New</button>
|
<button id="{{p.id}}-sort-new-mobile" type="button" class="{% if p.new %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-sort-new-mobile', '{{p.id}}-unsort-new-mobile', 'd-none', 'null')" data-bs-dismiss="modal"><i class="fas fa-sparkles text-center text-primary mr-2"></i>Set Default Sort New</button>
|
||||||
<button id="{{p.id}}-unsort-new-mobile" type="button" class="{% if not p.new %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" id="{{p.id}}-unsort-new-mobile" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/new', '{{p.id}}-unsort-new-mobile', '{{p.id}}-sort-new-mobile', 'd-none', 'null', 'DELETE')" data-bs-dismiss="modal"><i class="fas fa-fire text-center text-primary mr-2"></i>Set Default Sort Hot</button>
|
<button id="{{p.id}}-unsort-new-mobile" type="button" class="{% if not p.new %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" id="{{p.id}}-unsort-new-mobile" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this, '/post/{{p.id}}/hot', '{{p.id}}-unsort-new-mobile', '{{p.id}}-sort-new-mobile', 'd-none', 'null')" data-bs-dismiss="modal"><i class="fas fa-fire text-center text-primary mr-2"></i>Set Default Sort Hot</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] %}
|
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] %}
|
||||||
<button type="button" id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-2"></i>Distinguish</button>
|
<button type="button" id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-2"></i>Distinguish</button>
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
</form>
|
</form>
|
||||||
{% if v.background %}
|
{% if v.background %}
|
||||||
<div class="d-flex mb-3">
|
<div class="d-flex mb-3">
|
||||||
<button type="button" class="btn btn-danger" data-nonce="{{g.nonce}}" data-onclick="postToastReload(this,'/settings/background', 'DELETE')">
|
<button type="button" class="btn btn-danger" data-nonce="{{g.nonce}}" data-onclick="postToastReload(this,'/settings/remove_background')">
|
||||||
<i class="fas fa-image-slash mr-1"></i>
|
<i class="fas fa-image-slash mr-1"></i>
|
||||||
Remove current background
|
Remove current background
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{% for banner in sub.banner_urls %}
|
{% for banner in sub.banner_urls %}
|
||||||
<section id="sub-banner-update-{{loop.index - 1}}" class="d-inline-block sub-settings-subsection">
|
<section id="sub-banner-update-{{loop.index - 1}}" class="d-inline-block sub-settings-subsection">
|
||||||
<img class="mr-3" loading="lazy" alt="/h/{{sub.name}} banner" src="{{banner}}" style="max-height:300px;max-width:100%">
|
<img class="mr-3" loading="lazy" alt="/h/{{sub.name}} banner" src="{{banner}}" style="max-height:300px;max-width:100%">
|
||||||
<button class="btn btn-danger sub-banner-delete-button mt-2" id="sub-banner-delete-{{loop.index}}" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{sub.name}}/settings/banners/{{loop.index - 1}}', 'DELETE');">Delete</button>
|
<button class="btn btn-danger sub-banner-delete-button mt-2" id="sub-banner-delete-{{loop.index}}" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{sub.name}}/settings/banners/delete/{{loop.index - 1}}');">Delete</button>
|
||||||
</section>
|
</section>
|
||||||
{% else %}
|
{% else %}
|
||||||
<section id="sub-banner-no-banners" class="d-inline-block sub-settings-subsection">
|
<section id="sub-banner-no-banners" class="d-inline-block sub-settings-subsection">
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
<label class="btn btn-secondary text-capitalize mr-2 mb-0 mt-3">
|
<label class="btn btn-secondary text-capitalize mr-2 mb-0 mt-3">
|
||||||
Upload New Banner<input autocomplete="off" type="file" accept="image/*" hidden name="banner" data-nonce="{{g.nonce}}" onchange_submit>
|
Upload New Banner<input autocomplete="off" type="file" accept="image/*" hidden name="banner" data-nonce="{{g.nonce}}" onchange_submit>
|
||||||
</label>
|
</label>
|
||||||
<button type="button" class="btn btn-danger sub-banner-delete-button mt-3" id="sub-banner-delete-all" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{sub.name}}/settings/banners/', 'DELETE');">Delete All Banners</button>
|
<button type="button" class="btn btn-danger sub-banner-delete-button mt-3" id="sub-banner-delete-all" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{sub.name}}/settings/banners/delete_all');">Delete All Banners</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="text-small text-muted mt-3">
|
<div class="text-small text-muted mt-3">
|
||||||
All image files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.
|
All image files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.
|
||||||
|
|
Loading…
Reference in New Issue