forked from rDrama/rDrama
fix the last line of this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/4609716#context
parent
b639c3e903
commit
36e5845877
|
@ -48,7 +48,7 @@ def front_all(v, sub=None):
|
|||
if sort == 'hot': default = True
|
||||
else: default = False
|
||||
|
||||
pins = session.get(sort, default)
|
||||
pins = session.get(f'{sub}_{sort}', default)
|
||||
|
||||
if not v:
|
||||
result = cache.get(f'frontpage_{sort}_{t}_{page}_{sub}_{pins}')
|
||||
|
|
|
@ -1316,14 +1316,14 @@ def fp(v:User, fp):
|
|||
g.db.add(v)
|
||||
return '', 204
|
||||
|
||||
@app.post("/toggle_pins/<sort>")
|
||||
@app.post("/toggle_pins/<sub>/<sort>")
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
def toggle_pins(sort):
|
||||
def toggle_pins(sub, sort):
|
||||
if sort == 'hot': default = True
|
||||
else: default = False
|
||||
|
||||
pins = session.get(sort, default)
|
||||
session[sort] = not pins
|
||||
pins = session.get(f'{sub}_{sort}', default)
|
||||
session[f'{sub}_{sort}'] = not pins
|
||||
|
||||
if is_site_url(request.referrer):
|
||||
return redirect(request.referrer)
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
{% block navbar %}
|
||||
<div class="d-flex align-items-center">
|
||||
{% set pcolor = "primary" if pins else "secondary" %}
|
||||
<form action="/toggle_pins/{{sort}}" method="post">
|
||||
<form action="/toggle_pins/{{sub}}/{{sort}}" method="post">
|
||||
<button type="submit" class="btn btn-{{pcolor}} text-{{pcolor}} mx-2"><i type="submit" class="fas fas fa-thumbtack fa-rotate--45 mr-2"></i>Pins</button>
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in New Issue