Add go-to-specific-instance field

This commit is contained in:
metalune 2021-07-31 13:13:48 +02:00
parent 0100f9bff6
commit 308901306b
2 changed files with 20 additions and 1 deletions

View file

@ -266,6 +266,12 @@ async def main():
subscriptions=subscriptions,
)
@app.route("/instance", methods=["POST"])
async def jump_to_instance():
domain = (await request.form)["domain"]
return redirect("/" + domain)
@app.route("/search", methods = ["POST"])
async def simpleer_search_redirect():
query = (await request.form)["query"]
@ -373,6 +379,7 @@ async def instance_videos_recently_added(domain, page):
@app.route("/<string:domain>/search", methods=["POST"])
async def search_redirect(domain):
query = (await request.form)["query"]

View file

@ -14,7 +14,19 @@
<form action="/search" method="POST">
<input size="45" style="max-width: 100%" type="text" name="query" id="query" placeholder="SepiaSearch"/>
<button type="submit">Search</button>
</form>{% if videos|length > 0 %}
</form>
<br>
<form action="/instance" method="POST">
<label for="domain">Go to a specific instance:</label>
<br>
<input size="45" style="max-width: 100%" type="text" name="domain" id="domain" placeholder="Domain name"/>
<button type="submit">Go!</button>
</form>
{% if videos|length > 0 %}
<hr>
<h2>{{ videos|length }} latest videos from local subscriptions</h2>
<p>{% for sub in subscriptions %}{% if not loop.first %}, {% endif %}<a href="/{{ sub.host }}{% if sub.ownerAccount %}/video-channels{% else %}/accounts{% endif %}/{{ sub.name }}">{{ sub.displayName }} (@{{ sub.name }}@{{ sub.host }})</a>{% endfor %}</p>