diff --git a/main.py b/main.py index ac3fa1e..7ca91f8 100644 --- a/main.py +++ b/main.py @@ -434,6 +434,19 @@ async def favicon(): error_reason = "We don't have a favicon yet. If you would like to contribute one, please send it to ~metalune/public-inbox@lists.sr.ht" ), 404 +# --- OpenSearch --- +@app.route("/opensearch.xml") +async def opensearch(): + try: + with open('opensearch.xml', 'r') as f: + return f.read().replace('$BASEURL', request.headers["Host"]) + except Exception as e: + return await render_template( + "error.html", + error_number = "500", + error_reason = e + ), 500 + if __name__ == "__main__": if len(sys.argv) == 3: interface = sys.argv[1] diff --git a/opensearch.xml b/opensearch.xml new file mode 100644 index 0000000..85cc890 --- /dev/null +++ b/opensearch.xml @@ -0,0 +1,12 @@ + + + SimpleerTube + Search Peertube with a lightweight, minimalist interface. Noscript-friendly, multi-instance Peertube client. + UTF-8 + https://$BASEURL/static/peertube.png + + + + https://$BASEURL/ + diff --git a/static/peertube.png b/static/peertube.png new file mode 100644 index 0000000..a42fce3 Binary files /dev/null and b/static/peertube.png differ diff --git a/templates/base.html b/templates/base.html index f9a413a..dffb328 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,6 +4,7 @@ + {% block head %} {% block full_title %}{% block title %}{% endblock %} - SimpleerTube{% endblock %} {% endblock %} diff --git a/templates/index.html b/templates/index.html index 8d2a216..8a64d92 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,6 +3,7 @@ SimpleerTube - Search +