Can overwrite pyppeteer args
This is an anonymous contribution
This commit is contained in:
parent
e850eb4960
commit
093e629c70
3 changed files with 14 additions and 5 deletions
1
AUTHORS
1
AUTHORS
|
@ -2,3 +2,4 @@
|
|||
|
||||
* Kujiu
|
||||
* PtitGNU
|
||||
* Anonymous contributor
|
||||
|
|
|
@ -22,6 +22,12 @@ DEFAULT_PDF_OPTIONS = {
|
|||
}
|
||||
}
|
||||
|
||||
DEFAULT_PYPPETEER_ARGS = [
|
||||
'--allow-file-access-from-file',
|
||||
'--disable-web-security',
|
||||
'--no-sandbox',
|
||||
]
|
||||
|
||||
|
||||
def on_config_inited(app, config):
|
||||
""" Change config on the fly """
|
||||
|
@ -46,6 +52,11 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
|||
DEFAULT_PDF_OPTIONS,
|
||||
'pyppeteer'
|
||||
)
|
||||
app.add_config_value(
|
||||
'pyppeteer_args',
|
||||
DEFAULT_PYPPETEER_ARGS,
|
||||
'pyppeteer'
|
||||
)
|
||||
app.add_config_value(
|
||||
'pyppeteer_basename',
|
||||
lambda self: make_filename(self.project),
|
||||
|
|
|
@ -23,7 +23,7 @@ class PyppeteerPDFBuilder(SingleFileHTMLBuilder):
|
|||
search = False
|
||||
|
||||
def _get_translations_js(self) -> str:
|
||||
return
|
||||
return ""
|
||||
|
||||
def copy_translation_js(self) -> None:
|
||||
return
|
||||
|
@ -101,10 +101,7 @@ class PyppeteerPDFBuilder(SingleFileHTMLBuilder):
|
|||
"""
|
||||
# Disable security to allow SVG use.
|
||||
browser = await pyppeteer.launch({
|
||||
'args': [
|
||||
'--allow-file-access-from-file',
|
||||
'--disable-web-security',
|
||||
]
|
||||
'args': self.config.pyppeteer_args,
|
||||
})
|
||||
try:
|
||||
page = await browser.newPage()
|
||||
|
|
Loading…
Reference in a new issue