mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
static prefix: add 'static_prefix' template var which incorporates the wsgi prefix env['SCIPT_NAME']
This commit is contained in:
parent
be3c3c8778
commit
6572705ba8
@ -287,6 +287,8 @@ class FrontEndApp(object):
|
|||||||
if not coll or not self.warcserver.root_dir:
|
if not coll or not self.warcserver.root_dir:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
environ['ORIG_SCRIPT_NAME'] = environ.get('SCRIPT_NAME')
|
||||||
|
|
||||||
if coll != '$root':
|
if coll != '$root':
|
||||||
pop_path_info(environ)
|
pop_path_info(environ)
|
||||||
if record:
|
if record:
|
||||||
|
@ -348,6 +348,7 @@ class RewriterApp(object):
|
|||||||
top_url,
|
top_url,
|
||||||
environ,
|
environ,
|
||||||
framed_replay,
|
framed_replay,
|
||||||
|
static_prefix=self.get_static_prefix(environ),
|
||||||
config=self.config))
|
config=self.config))
|
||||||
|
|
||||||
cookie_rewriter = None
|
cookie_rewriter = None
|
||||||
@ -588,6 +589,9 @@ class RewriterApp(object):
|
|||||||
#return request.script_name
|
#return request.script_name
|
||||||
return environ.get('SCRIPT_NAME') + '/'
|
return environ.get('SCRIPT_NAME') + '/'
|
||||||
|
|
||||||
|
def get_static_prefix(self, environ):
|
||||||
|
return self.get_host_prefix(environ) + environ.get('ORIG_SCRIPT_NAME', '') + '/static'
|
||||||
|
|
||||||
def get_full_prefix(self, environ):
|
def get_full_prefix(self, environ):
|
||||||
return self.get_host_prefix(environ) + self.get_rel_prefix(environ)
|
return self.get_host_prefix(environ) + self.get_rel_prefix(environ)
|
||||||
|
|
||||||
@ -641,7 +645,8 @@ class RewriterApp(object):
|
|||||||
return self.handle_query(environ, wb_url, kwargs, full_prefix)
|
return self.handle_query(environ, wb_url, kwargs, full_prefix)
|
||||||
|
|
||||||
if self.is_framed_replay(wb_url):
|
if self.is_framed_replay(wb_url):
|
||||||
extra_params = self.get_top_frame_params(wb_url, kwargs)
|
extra_params = self.get_top_frame_params(wb_url, kwargs) or {}
|
||||||
|
extra_params['static_prefix'] = self.get_static_prefix(environ)
|
||||||
return self.frame_insert_view.get_top_frame(wb_url,
|
return self.frame_insert_view.get_top_frame(wb_url,
|
||||||
full_prefix,
|
full_prefix,
|
||||||
host_prefix,
|
host_prefix,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% if not env.pywb_proxy_magic or config.proxy.use_banner | default(true) %}
|
{% if not env.pywb_proxy_magic or config.proxy.use_banner | default(true) %}
|
||||||
<!-- default banner, create through js -->
|
<!-- default banner, create through js -->
|
||||||
<script src='{{ host_prefix }}/{{ static_path }}/default_banner.js'> </script>
|
<script src='{{ static_prefix }}/default_banner.js'> </script>
|
||||||
<link rel='stylesheet' href='{{ host_prefix }}/{{ static_path }}/default_banner.css'/>
|
<link rel='stylesheet' href='{{ static_prefix }}/default_banner.css'/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -12,7 +12,7 @@ html, body
|
|||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script src='{{ host_prefix }}/{{ static_path }}/wb_frame.js'> </script>
|
<script src='{{ static_prefix }}/wb_frame.js'> </script>
|
||||||
|
|
||||||
{{ banner_html }}
|
{{ banner_html }}
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
wbinfo.is_live = {{ is_live }};
|
wbinfo.is_live = {{ is_live }};
|
||||||
wbinfo.coll = "{{ coll }}";
|
wbinfo.coll = "{{ coll }}";
|
||||||
wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}";
|
wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}";
|
||||||
wbinfo.static_prefix = "{{ host_prefix }}/{{ static_path }}/";
|
wbinfo.static_prefix = "{{ static_prefix }}/";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if not wb_url.is_banner_only %}
|
{% if not wb_url.is_banner_only %}
|
||||||
<script src='{{ host_prefix }}/{{ static_path }}/wombat.js'> </script>
|
<script src='{{ static_prefix }}/wombat.js'> </script>
|
||||||
<script>
|
<script>
|
||||||
wbinfo.wombat_ts = "{{ wombat_ts }}";
|
wbinfo.wombat_ts = "{{ wombat_ts }}";
|
||||||
wbinfo.wombat_sec = "{{ wombat_sec }}";
|
wbinfo.wombat_sec = "{{ wombat_sec }}";
|
||||||
@ -51,7 +51,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if config.enable_flash_video_rewrite %}
|
{% if config.enable_flash_video_rewrite %}
|
||||||
<script src='{{ host_prefix }}/{{ static_path }}/vidrw.js'> </script>
|
<script src='{{ static_prefix }}/vidrw.js'> </script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ banner_html }}
|
{{ banner_html }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user