mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-25 15:37:48 +01:00
Serve wabac service worker from static prefix
This commit is contained in:
parent
d6bb03409f
commit
d2eb934b8d
@ -133,7 +133,7 @@ class FrontEndApp(object):
|
|||||||
self.url_map.add(Rule('/', endpoint=self.serve_home))
|
self.url_map.add(Rule('/', endpoint=self.serve_home))
|
||||||
|
|
||||||
if self.client_side_replay:
|
if self.client_side_replay:
|
||||||
self.url_map.add(Rule('/static/sw.js', endpoint=self.serve_wabac_service_worker))
|
self.url_map.add(Rule('/{0}/sw.js'.format(self.static_prefix), endpoint=self.serve_wabac_service_worker))
|
||||||
|
|
||||||
self._init_coll_routes(coll_prefix)
|
self._init_coll_routes(coll_prefix)
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
class WabacReplay
|
class WabacReplay
|
||||||
{
|
{
|
||||||
constructor(prefix, url, ts) {
|
constructor(prefix, url, ts, staticPrefix) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.ts = ts;
|
this.ts = ts;
|
||||||
|
this.staticPrefix = staticPrefix;
|
||||||
this.collName = new URL(prefix, "http://dummy").pathname.split('/')[1];
|
this.collName = new URL(prefix, "http://dummy").pathname.split('/')[1];
|
||||||
this.adblockUrl = undefined;
|
this.adblockUrl = undefined;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ class WabacReplay
|
|||||||
const scope = "/";
|
const scope = "/";
|
||||||
|
|
||||||
await navigator.serviceWorker.register(
|
await navigator.serviceWorker.register(
|
||||||
"/static/sw.js?" + new URLSearchParams(this.queryParams).toString(),
|
`${this.staticPrefix}/sw.js?` + new URLSearchParams(this.queryParams).toString(),
|
||||||
{ scope },
|
{ scope },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ html, body
|
|||||||
{% if client_side_replay %}
|
{% if client_side_replay %}
|
||||||
<script src='{{ static_prefix }}/loadWabac.js'></script>
|
<script src='{{ static_prefix }}/loadWabac.js'></script>
|
||||||
<script>
|
<script>
|
||||||
new WabacReplay("{{ wb_prefix }}", "{{ url }}", "{{ timestamp }}").init();
|
new WabacReplay("{{ wb_prefix }}", "{{ url }}", "{{ timestamp }}", "{{ static_prefix }}").init();
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<script src='{{ static_prefix }}/wb_frame.js'> </script>
|
<script src='{{ static_prefix }}/wb_frame.js'> </script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user