mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Do not mangle names of embed scripts
This commit is contained in:
@@ -117,13 +117,13 @@ class FileSource(Source):
|
||||
|
||||
return os.path.join(STATIC_ROOT, "static", "js", self.name)
|
||||
|
||||
def url(self, absolute=False):
|
||||
def url(self, absolute=False, mangle_name=False):
|
||||
from r2.lib.template_helpers import static
|
||||
path = [g.static_path, self.name]
|
||||
if g.uncompressedJS:
|
||||
path.insert(1, "js")
|
||||
|
||||
return static(os.path.join(*path), absolute)
|
||||
return static(os.path.join(*path), absolute, mangle_name)
|
||||
|
||||
def use(self, **kwargs):
|
||||
return script_tag.format(src=self.url(**kwargs))
|
||||
@@ -173,12 +173,12 @@ class Module(Source):
|
||||
out.write(source)
|
||||
print >> sys.stderr, " done."
|
||||
|
||||
def url(self, absolute=False):
|
||||
def url(self, absolute=False, mangle_name=True):
|
||||
from r2.lib.template_helpers import static
|
||||
if g.uncompressedJS:
|
||||
return [source.url(absolute=absolute) for source in self.sources]
|
||||
return [source.url(absolute=absolute, mangle_name=mangle_name) for source in self.sources]
|
||||
else:
|
||||
return static(self.name, absolute=absolute)
|
||||
return static(self.name, absolute=absolute, mangle_name=mangle_name)
|
||||
|
||||
def use(self, **kwargs):
|
||||
if g.uncompressedJS:
|
||||
|
||||
@@ -49,7 +49,7 @@ static_text_extensions = {
|
||||
'.css': 'css',
|
||||
'.less': 'css'
|
||||
}
|
||||
def static(path, absolute=False):
|
||||
def static(path, absolute=False, mangle_name=True):
|
||||
"""
|
||||
Simple static file maintainer which automatically paths and
|
||||
versions files being served out of static.
|
||||
@@ -64,7 +64,7 @@ def static(path, absolute=False):
|
||||
should_cache_bust = False
|
||||
|
||||
path_components = []
|
||||
actual_filename = None
|
||||
actual_filename = None if mangle_name else filename
|
||||
|
||||
if g.static_domain:
|
||||
domain = g.static_domain
|
||||
@@ -184,7 +184,7 @@ def js_config(extra_config=None):
|
||||
"adtracker_url": g.adtracker_url,
|
||||
"clicktracker_url": g.clicktracker_url,
|
||||
"uitracker_url": g.uitracker_url,
|
||||
"comment_embed_scripts": js.src("comment-embed", absolute=True),
|
||||
"comment_embed_scripts": js.src("comment-embed", absolute=True, mangle_name=False),
|
||||
"static_root": static(''),
|
||||
"over_18": bool(c.over18),
|
||||
"new_window": bool(c.user.pref_newwindow),
|
||||
|
||||
Reference in New Issue
Block a user