Fix #705: Can now use a local file with FUNKWHALE_SPA_HTML_ROOT to avoid sending an HTTP request

This commit is contained in:
Eliot Berriot 2019-02-08 17:36:10 +01:00
parent d702f8f69f
commit d99757658c
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
3 changed files with 11 additions and 0 deletions

View file

@ -56,6 +56,10 @@ def serve_spa(request):
def get_spa_html(spa_url):
if spa_url.startswith("/"):
# we try to open a local file
with open(spa_url) as f:
return f.read()
cache_key = "spa-html:{}".format(spa_url)
cached = caches["local"].get(cache_key)
if cached: