DEV: Introduce DISCOURSE_ASSET_URL_SALT (#24596)

This value is included when generating static asset URLs. Updating the value will allow site operators to invalidate all asset urls to recover from configuration issues which may have been cached by CDNs/browsers.
This commit is contained in:
David Taylor
2023-11-28 11:28:40 +00:00
committed by GitHub
parent 22ce638ec3
commit 5783f231f8
7 changed files with 29 additions and 5 deletions

View File

@ -167,12 +167,15 @@ RSpec.describe ThemeJavascriptsController do
component.save!
_, digest = component.baked_js_tests_with_digest
theme_javascript_hash =
component.theme_fields.find_by(upload_id: js_upload.id).javascript_cache.digest
get "/theme-javascripts/tests/#{component.id}-#{digest}.js"
expect(response.body).to include(
"require(\"discourse/lib/theme-settings-store\").registerSettings(" +
"#{component.id}, {\"num_setting\":5,\"theme_uploads\":{\"vendorlib\":" +
"\"/uploads/default/test_#{ENV["TEST_ENV_NUMBER"].presence || "0"}/original/1X/#{js_upload.sha1}.js\"},\"theme_uploads_local\":{\"vendorlib\":" +
"\"/theme-javascripts/#{js_upload.sha1}.js?__ws=test.localhost\"}}, { force: true });",
"\"/theme-javascripts/#{theme_javascript_hash}.js?__ws=test.localhost\"}}, { force: true });",
)
expect(response.body).to include("assert.ok(true);")
ensure