Commit c8d92f61 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Add ICON hash reverse redirection from URL

parent c7d0248a
......@@ -52,6 +52,8 @@ entries = process_entry.get_entries()
analyze.analyze_entries(entries.values(), skip=["pos", "knn_proj"],
global_cache=True)
icon_ref = {entry.icon_hash : entry for entry in entries.values()}
whales = ["openstreetmap"]
import markdown
......@@ -313,5 +315,13 @@ def issues_page():
def contribute_page():
return redirect("//git.skewed.de/count0/netzschleuder/-/wikis/Contributing-to-Netzschleuder")
@app.route("/icon/<icon_hash>")
def icon_redirect(icon_hash):
global icon_ref
try:
return redirect(f"/net/{icon_ref[icon_hash].name}", code=302)
except KeyError:
abort(404)
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment