mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Install wabac service worker via setup.py
This commit is contained in:
parent
62d6c7271f
commit
afb8a399b5
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
# wabac sw
|
||||
pywb/static/wabacSW.js
|
||||
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
WABAC_SW_URL=https://cdn.jsdelivr.net/npm/@webrecorder/wabac@2.21.4/dist/sw.js
|
||||
|
||||
wget "$WABAC_SW_URL" -O ./pywb/static/wabacWorker.js
|
@ -28,10 +28,10 @@ enable_memento: true
|
||||
framed_replay: true
|
||||
|
||||
# Use wabac.js-style client-side replay system for framed replay
|
||||
client_side_replay: false
|
||||
client_side_replay: true
|
||||
|
||||
# Enable classic redirect behavior
|
||||
redirect_to_exact: true
|
||||
redirect_to_exact: false
|
||||
|
||||
# Uncomment and change to set default locale
|
||||
# default_locale: en
|
||||
|
@ -830,7 +830,7 @@ class FrontEndApp(object):
|
||||
:return: WbResponse with service worker
|
||||
:rtype: WbResponse
|
||||
"""
|
||||
response = self.serve_static(env, coll='', filepath='wabacWorker.js')
|
||||
response = self.serve_static(env, coll='', filepath='wabacSW.js')
|
||||
response.status_headers['Service-Worker-Allowed'] = '/'
|
||||
return response
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
18
setup.py
18
setup.py
@ -5,11 +5,29 @@ from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
import glob
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
from pywb import __version__
|
||||
|
||||
|
||||
root_dir = pathlib.Path(__file__).parent
|
||||
|
||||
|
||||
WABAC_SW_URL = "https://cdn.jsdelivr.net/npm/@webrecorder/wabac@2.21.4/dist/sw.js"
|
||||
|
||||
|
||||
def download_wabac_sw():
|
||||
print(f"Downloading {WABAC_SW_URL}")
|
||||
with urllib.request.urlopen(WABAC_SW_URL) as response: # nosec
|
||||
with open(root_dir.joinpath("pywb", "static", "wabacSW.js"), "wb") as fh:
|
||||
fh.write(response.read())
|
||||
|
||||
|
||||
download_wabac_sw()
|
||||
|
||||
|
||||
def get_long_description():
|
||||
with open('README.rst', 'r') as fh:
|
||||
long_description = fh.read()
|
||||
|
Loading…
x
Reference in New Issue
Block a user