portal: link to context-specific help where we can

This commit is contained in:
Iain Learmonth 2022-08-25 20:49:20 +01:00
parent 2801eefd43
commit 5b9946c431
6 changed files with 76 additions and 31 deletions

View file

@ -10,14 +10,20 @@ from app.portal.util import LifecycleForm
bp = Blueprint("bridge", __name__)
_SECTION_TEMPLATE_VARS = {
"section": "bridge",
"help_url": "https://bypass.censorship.guide/user/bridges.html"
}
@bp.route("/list")
def bridge_list() -> ResponseReturnValue:
bridges = Bridge.query.filter(Bridge.destroyed.is_(None)).all()
return render_template("list.html.j2",
section="bridge",
title="Tor Bridges",
item="bridge",
items=bridges)
items=bridges,
**_SECTION_TEMPLATE_VARS)
@bp.route("/block/<bridge_id>", methods=['GET', 'POST'])
@ -26,7 +32,8 @@ def bridge_blocked(bridge_id: int) -> ResponseReturnValue:
if bridge is None:
return Response(render_template("error.html.j2",
header="404 Proxy Not Found",
message="The requested bridge could not be found."))
message="The requested bridge could not be found.",
**_SECTION_TEMPLATE_VARS))
form = LifecycleForm()
if form.validate_on_submit():
bridge.deprecate(reason="manual")
@ -36,5 +43,5 @@ def bridge_blocked(bridge_id: int) -> ResponseReturnValue:
return render_template("lifecycle.html.j2",
header=f"Mark bridge {bridge.hashed_fingerprint} as blocked?",
message=bridge.hashed_fingerprint,
section="bridge",
form=form)
form=form,
**_SECTION_TEMPLATE_VARS)