1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00
- support passing 'ui' params from config to top frame/banner rendering
- remoteindexsource: fix live proxy from existing index
- add vue_banner.css for vueui, don't use default_banner.css
This commit is contained in:
Ilya Kreymer 2021-09-20 19:10:19 -07:00
parent 71f305b997
commit 9eac529bee
6 changed files with 31 additions and 5 deletions

View File

@ -363,6 +363,9 @@ class FrontEndApp(object):
else: else:
coll_config['metadata'] = self.metadata_cache.load(coll) or {} coll_config['metadata'] = self.metadata_cache.load(coll) or {}
if 'ui' in self.warcserver.config:
coll_config['ui'] = self.warcserver.config['ui']
return coll_config return coll_config
def serve_coll_page(self, environ, coll='$root'): def serve_coll_page(self, environ, coll='$root'):

View File

@ -520,6 +520,7 @@ class RewriterApp(object):
coll=kwargs.get('coll', ''), coll=kwargs.get('coll', ''),
replay_mod=self.replay_mod, replay_mod=self.replay_mod,
metadata=kwargs.get('metadata', {}), metadata=kwargs.get('metadata', {}),
ui=kwargs.get('ui', {}),
config=self.config)) config=self.config))
cookie_rewriter = None cookie_rewriter = None
@ -897,7 +898,9 @@ class RewriterApp(object):
pass pass
def get_top_frame_params(self, wb_url, kwargs): def get_top_frame_params(self, wb_url, kwargs):
return {'metadata': kwargs.get('metadata', {})} return {'metadata': kwargs.get('metadata', {}),
'ui': kwargs.get('ui', {})
}
def handle_custom_response(self, environ, wb_url, full_prefix, host_prefix, kwargs): def handle_custom_response(self, environ, wb_url, full_prefix, host_prefix, kwargs):
if self.is_framed_replay(wb_url): if self.is_framed_replay(wb_url):

View File

@ -0,0 +1,11 @@
body {
display: flex;
flex-direction: column;
}
#wb_iframe_div, #replay_iframe {
width: 100%;
height: 100%;
}

View File

@ -229,7 +229,13 @@ ContentFrame.prototype.initBannerUpdateCheck = function(newUrl, newTs) {
* operating in live mode * operating in live mode
*/ */
ContentFrame.prototype.load_url = function(newUrl, newTs) { ContentFrame.prototype.load_url = function(newUrl, newTs) {
this.iframe.src = this.make_url(newUrl, newTs, true); var newUrl = this.make_url(newUrl, newTs, true);
if (this.iframe.src === newUrl) {
return;
}
this.iframe.src = newUrl;
if (this.wbBanner) { if (this.wbBanner) {
this.initBannerUpdateCheck(newUrl, newTs); this.initBannerUpdateCheck(newUrl, newTs);
} }

View File

@ -18,17 +18,20 @@ window.banner_info = {
locale_prefixes: {{ get_locale_prefixes() | tojson }}, locale_prefixes: {{ get_locale_prefixes() | tojson }},
prefix: "{{ wb_prefix }}", prefix: "{{ wb_prefix }}",
staticPrefix: "{{ static_prefix }}" staticPrefix: "{{ static_prefix }}"
logo: "{{ ui['logo'] }}"
}; };
</script> </script>
<link rel='stylesheet' href='{{ static_prefix }}/default_banner.css'/>
{% if is_framed or old_banner %} {% if is_framed or old_banner %}
<!-- default banner, create through js --> <!-- default banner, create through js -->
<link rel='stylesheet' href='{{ static_prefix }}/default_banner.css'/>
<script src='{{ static_prefix }}/default_banner.js'> </script> <script src='{{ static_prefix }}/default_banner.js'> </script>
{% else %} {% else %}
<link rel='stylesheet' href='{{ static_prefix }}/vue_banner.css'/>
<script src="{{ static_prefix }}/vue/vueui.js"></script> <script src="{{ static_prefix }}/vue/vueui.js"></script>
<script> <script>
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}"); VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}");

View File

@ -283,8 +283,8 @@ class LiveWebLoader(BaseLoader):
self.socks_proxy = None self.socks_proxy = None
def load_resource(self, cdx, params): def load_resource(self, cdx, params):
if cdx.get('filename') and cdx.get('offset') is not None: #if cdx.get('filename') and cdx.get('offset') is not None:
return None # return None
load_url = cdx.get('load_url') load_url = cdx.get('load_url')
if not load_url: if not load_url: