-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: Use unversioned frontend asset paths (#27091)"
This reverts commit 8b2ff25.
- Loading branch information
Showing
18 changed files
with
140 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
{% extends "sentry/base-react.html" %} | ||
{% load sentry_assets %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
from django.conf import settings | ||
from manifest_loader.utils import _get_manifest, _load_from_manifest | ||
|
||
|
||
def get_unversioned_asset_url(module, key): | ||
def get_manifest_obj(): | ||
""" | ||
Returns an asset URL that is unversioned. These assets should have a | ||
`Cache-Control: max-age=0, must-revalidate` so that clients must validate with the origin | ||
server before using their locally cached asset. | ||
Returns the webpack asset manifest as a dict of <file key, hashed file name> | ||
The `manifest_loader` library caches this (if `cache` settings is set) | ||
""" | ||
return _get_manifest() | ||
|
||
|
||
def get_manifest_url(module, key): | ||
""" | ||
Returns an asset URL that is produced by webpack. Uses webpack's manifest to map | ||
`key` to the asset produced by webpack. Required if using file contents based hashing for filenames. | ||
Example: | ||
{% unversioned_asset_url 'sentry' 'sentry.css' %} | ||
=> "/_static/dist/sentry/sentry.css" | ||
{% manifest_asset_url 'sentry' 'sentry.css' %} | ||
=> "/_static/dist/sentry/sentry.filehash123.css" | ||
""" | ||
manifest_obj = get_manifest_obj() | ||
manifest_value = _load_from_manifest(manifest_obj, key=key) | ||
|
||
return "{}/{}/{}".format(settings.STATIC_UNVERSIONED_URL.rstrip("/"), module, key.lstrip("/")) | ||
return "{}/{}/{}".format(settings.STATIC_MANIFEST_URL.rstrip("/"), module, manifest_value) | ||
|
||
|
||
def get_asset_url(module, path): | ||
""" | ||
Returns a versioned asset URL (located within Sentry's static files). | ||
Example: | ||
{% asset_url 'sentry' 'images/sentry.png' %} | ||
=> "/_static/74d127b78dc7daf2c51f/sentry/sentry.png" | ||
{% asset_url 'sentry' 'images/sentry.png' %} | ||
=> "/_static/74d127b78dc7daf2c51f/sentry/sentry.png" | ||
""" | ||
return "{}/{}/{}".format(settings.STATIC_URL.rstrip("/"), module, path.lstrip("/")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.