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
|
* Kujiu
|
||||||
* PtitGNU
|
* 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):
|
def on_config_inited(app, config):
|
||||||
""" Change config on the fly """
|
""" Change config on the fly """
|
||||||
|
@ -46,6 +52,11 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
||||||
DEFAULT_PDF_OPTIONS,
|
DEFAULT_PDF_OPTIONS,
|
||||||
'pyppeteer'
|
'pyppeteer'
|
||||||
)
|
)
|
||||||
|
app.add_config_value(
|
||||||
|
'pyppeteer_args',
|
||||||
|
DEFAULT_PYPPETEER_ARGS,
|
||||||
|
'pyppeteer'
|
||||||
|
)
|
||||||
app.add_config_value(
|
app.add_config_value(
|
||||||
'pyppeteer_basename',
|
'pyppeteer_basename',
|
||||||
lambda self: make_filename(self.project),
|
lambda self: make_filename(self.project),
|
||||||
|
|
|
@ -23,7 +23,7 @@ class PyppeteerPDFBuilder(SingleFileHTMLBuilder):
|
||||||
search = False
|
search = False
|
||||||
|
|
||||||
def _get_translations_js(self) -> str:
|
def _get_translations_js(self) -> str:
|
||||||
return
|
return ""
|
||||||
|
|
||||||
def copy_translation_js(self) -> None:
|
def copy_translation_js(self) -> None:
|
||||||
return
|
return
|
||||||
|
@ -101,10 +101,7 @@ class PyppeteerPDFBuilder(SingleFileHTMLBuilder):
|
||||||
"""
|
"""
|
||||||
# Disable security to allow SVG use.
|
# Disable security to allow SVG use.
|
||||||
browser = await pyppeteer.launch({
|
browser = await pyppeteer.launch({
|
||||||
'args': [
|
'args': self.config.pyppeteer_args,
|
||||||
'--allow-file-access-from-file',
|
|
||||||
'--disable-web-security',
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
try:
|
try:
|
||||||
page = await browser.newPage()
|
page = await browser.newPage()
|
||||||
|
|
Loading…
Reference in a new issue