You've already forked snikket-web-portal
Include Link header and element in invite response
This allows future App versions to also work with the invite page without having to screen scrape the content. Fixes #56 (at least for the portal side of things).
This commit is contained in:
@@ -53,7 +53,7 @@ async def view_old(id_: str) -> quart.Response:
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/<id_>/")
|
@bp.route("/<id_>/")
|
||||||
async def view(id_: str) -> str:
|
async def view(id_: str) -> typing.Union[quart.Response, str]:
|
||||||
try:
|
try:
|
||||||
invite = await client.get_public_invite_by_id(id_)
|
invite = await client.get_public_invite_by_id(id_)
|
||||||
except aiohttp.ClientResponseError as exc:
|
except aiohttp.ClientResponseError as exc:
|
||||||
@@ -84,13 +84,19 @@ async def view(id_: str) -> str:
|
|||||||
)
|
)
|
||||||
apple_store_url = current_app.config["APPLE_STORE_URL"]
|
apple_store_url = current_app.config["APPLE_STORE_URL"]
|
||||||
|
|
||||||
return await render_template(
|
body = await render_template(
|
||||||
"invite_view.html",
|
"invite_view.html",
|
||||||
invite=invite,
|
invite=invite,
|
||||||
play_store_url=play_store_url,
|
play_store_url=play_store_url,
|
||||||
apple_store_url=apple_store_url,
|
apple_store_url=apple_store_url,
|
||||||
invite_id=id_,
|
invite_id=id_,
|
||||||
)
|
)
|
||||||
|
return quart.Response(
|
||||||
|
body,
|
||||||
|
headers={
|
||||||
|
"Link": "<{}> rel=\"alternate\"".format(invite.xmpp_uri),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RegisterForm(flask_wtf.FlaskForm): # type:ignore
|
class RegisterForm(flask_wtf.FlaskForm): # type:ignore
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<title>{% trans site_name=config["SITE_NAME"] %}Invite to {{ site_name }} | Snikket{% endtrans %}</title>
|
<title>{% trans site_name=config["SITE_NAME"] %}Invite to {{ site_name }} | Snikket{% endtrans %}</title>
|
||||||
<script async type="text/javascript" src="{{ url_for("static", filename="js/invite-magic.js") }}"></script>
|
<script async type="text/javascript" src="{{ url_for("static", filename="js/invite-magic.js") }}"></script>
|
||||||
<script async type="text/javascript" src="{{ url_for("static", filename="js/qrcode.min.js") }}"></script>
|
<script async type="text/javascript" src="{{ url_for("static", filename="js/qrcode.min.js") }}"></script>
|
||||||
|
<link rel="alternate" href="{{ invite.xmpp_uri }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="elevated box el-3">
|
<div class="elevated box el-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user