mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
Disable caching of get_asset_json if debug mode (#2090)
* Disable caching of get_asset_json if debug mode
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
from flask import current_app, url_for
|
||||
|
||||
from CTFd.utils import _get_asset_json
|
||||
from CTFd.utils import get_asset_json
|
||||
from CTFd.utils.config import ctf_theme
|
||||
from CTFd.utils.helpers import markup
|
||||
|
||||
@@ -13,14 +13,14 @@ class _AssetsWrapper:
|
||||
manifest = os.path.join(
|
||||
current_app.root_path, "themes", theme, "static", "manifest.json"
|
||||
)
|
||||
return _get_asset_json(path=manifest)
|
||||
return get_asset_json(path=manifest)
|
||||
|
||||
def manifest_css(self):
|
||||
theme = ctf_theme()
|
||||
manifest = os.path.join(
|
||||
current_app.root_path, "themes", theme, "static", "manifest-css.json"
|
||||
)
|
||||
return _get_asset_json(path=manifest)
|
||||
return get_asset_json(path=manifest)
|
||||
|
||||
def js(self, asset_key):
|
||||
asset = self.manifest()[asset_key]
|
||||
|
||||
@@ -33,6 +33,13 @@ def _get_asset_json(path):
|
||||
return json.loads(f.read())
|
||||
|
||||
|
||||
def get_asset_json(path):
|
||||
# Ignore caching if we are in debug mode
|
||||
if app.debug:
|
||||
return _get_asset_json.__wrapped__(path)
|
||||
return _get_asset_json(path)
|
||||
|
||||
|
||||
@cache.memoize()
|
||||
def _get_config(key):
|
||||
config = db.session.execute(
|
||||
|
||||
Reference in New Issue
Block a user