diff --git a/endpoints/common.py b/endpoints/common.py index 4b14f1522..fb77bb86d 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -31,23 +31,6 @@ logger = logging.getLogger(__name__) route_data = None -CACHE_BUSTERS_JSON = 'static/dist/cachebusters.json' -CACHE_BUSTERS = None - - -def get_cache_busters(): - """ Retrieves the cache busters hashes. """ - global CACHE_BUSTERS - if CACHE_BUSTERS is not None: - return CACHE_BUSTERS - - if not os.path.exists(CACHE_BUSTERS_JSON): - return {} - - with open(CACHE_BUSTERS_JSON, 'r') as f: - CACHE_BUSTERS = json.loads(f.read()) - return CACHE_BUSTERS - def parse_repository_name(include_tag=False, ns_kwarg_name='namespace_name', @@ -167,7 +150,7 @@ def render_page_template(name, route_data=None, **kwargs): library_styles = [] main_styles = [] library_scripts = [] - main_scripts = ['build/quay-frontend.js'] + main_scripts = list_files('build', 'js') use_cdn = app.config.get('USE_CDN', True) if request.args.get('use_cdn') is not None: @@ -180,12 +163,6 @@ def render_page_template(name, route_data=None, **kwargs): if features.BILLING: external_scripts.append('//checkout.stripe.com/checkout.js') - def add_cachebusters(filenames): - cachebusters = get_cache_busters() - for filename in filenames: - cache_buster = cachebusters.get(filename, random_string()) if not debugging else 'debugging' - yield (filename, cache_buster) - def get_external_login_config(): login_config = [] for login_service in oauth_login.services: @@ -217,10 +194,10 @@ def render_page_template(name, route_data=None, **kwargs): route_data=route_data, external_styles=external_styles, external_scripts=external_scripts, - main_styles=add_cachebusters(main_styles), - library_styles=add_cachebusters(library_styles), - main_scripts=add_cachebusters(main_scripts), - library_scripts=add_cachebusters(library_scripts), + main_styles=main_styles, + library_styles=library_styles, + main_scripts=main_scripts, + library_scripts=library_scripts, feature_set=features.get_features(), config_set=frontend_visible_config(app.config), oauth_set=get_oauth_config(), diff --git a/templates/base.html b/templates/base.html index 1a3c1ea37..0dfa13c80 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,12 +22,12 @@ - {% for style_path, cache_buster in main_styles %} - + {% for style_path in main_styles %} + {% endfor %} - {% for style_path, cache_buster in library_styles %} - + {% for style_path in library_styles %} + {% endfor %} {% block added_stylesheets %} @@ -57,16 +57,16 @@ {% endfor %} - {% for script_path, cache_buster in library_scripts %} - + {% for script_path in library_scripts %} + {% endfor %} {% block added_dependencies %} {% endblock %} - {% for script_path, cache_buster in main_scripts %} - + {% for script_path in main_scripts %} + {% endfor %} {% if sentry_public_dsn %} diff --git a/webpack.config.js b/webpack.config.js index e823b1e29..44039074a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,7 +5,7 @@ var config = { entry: "./static/js/main.ts", output: { path: path.resolve(__dirname, "static/build"), - filename: "quay-frontend.js" + filename: 'quay-frontend-[hash].js' }, resolve: { extensions: [".ts", ".tsx", ".js", ".scss"],