diff --git a/doc/templ/root.html b/doc/templ/root.html
index 0333d1a..e94c4c5 100644
--- a/doc/templ/root.html
+++ b/doc/templ/root.html
@@ -11,9 +11,9 @@
-
-
-
+
+
+
diff --git a/src/raidoc/builder.py b/src/raidoc/builder.py
index 50a55b3..1846a60 100644
--- a/src/raidoc/builder.py
+++ b/src/raidoc/builder.py
@@ -79,7 +79,6 @@ def page(self, path):
def render(self, dest: Path):
for subfolder in (
- 'fontawesome',
'img',
'js',
'asciinema'
diff --git a/src/raidoc/getdeps.py b/src/raidoc/getdeps.py
index d929f77..aaa5477 100644
--- a/src/raidoc/getdeps.py
+++ b/src/raidoc/getdeps.py
@@ -6,6 +6,19 @@
from zipfile import ZipFile
from sys import stderr
+class CustomURLOpener(urllib.request.FancyURLopener):
+ """
+ FancyURLopener with browser-like user agent.
+
+ fontawesome.com maintainers for some reason but a user
+ agent filter on their releases endpoint,
+ so we have to perform this incantation to download
+ things from there.
+ """
+ version = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
+
+opener = CustomURLOpener()
+
def eprint(*args, **kwargs):
print(*args, file=stderr, **kwargs)
@@ -20,7 +33,7 @@ def getdeps(source: Path, target: Path):
url = path.read_text()
eprint(f'Downloading {download_dest} from {url}...')
- urllib.request.urlretrieve(url, download_dest)
+ opener.retrieve(url, download_dest)
hash_file = path.with_suffix('.sha256')
@@ -40,3 +53,14 @@ def getdeps(source: Path, target: Path):
eprint("Hash mismatch.")
exit(1)
+ for path in (target).rglob('*.zip'):
+ extract_path = path.with_suffix('')
+
+ if extract_path.exists():
+ eprint(f'{path} already extracted')
+ else:
+ eprint(f'Extracting {path}')
+ # FIXME prevent zipslip!!
+ with ZipFile(path) as zip:
+ zip.extractall(extract_path)
+