Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add default config values for HeadlessChromium, and a very high… #38

Merged
merged 2 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

- name: Test and package the extension
id: package
uses: oncletom/yeswiki-build-repo@feature/action
uses: docker://ghcr.io/oncletom/yeswiki-build-repo

- name: Assess md5 and archive name
run: |
Expand Down
25 changes: 17 additions & 8 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
parameters:
htmltopdf_path: '/usr/bin/chromium' # MacOs: /Applications/Chromium.app/Contents/MacOS/Chromium
htmltopdf_path: '/usr/bin/chromium' # MacOs: /Applications/Chromium.app/Contents/MacOS/Chromium
htmltopdf_service_url: '' # Should be a complete url like https://example.org/yeswiki/?PagePrincipale/pdf
# Advanced
# duration before considering the pageload completed (60000ms = 1 minute)
page_load_timeout: 60000
# for edit config action
publication_editable_config_params:
- 'htmltopdf_service_url'

# Advanced Configuration
# Has to comply with HeadlessChromium::createBrowser() options
# see https://github.com/chrome-php/headless-chromium-php#options
# See https://github.com/chrome-php/headless-chromium-php#options
htmltopdf_options:
windowSize: [1440, 780]
noSandbox: true
headless: true
userAgent: 'YesWiki/4.0'
# maximum time to wait for the browser to start, before navigating to a page
startupTimeout: 30
# maximum time in ms to wait for synchronous messages to send to the browser
sendSyncDefaultTimeout: 10000
customFlags:
- '--crash-dumps-dir=/tmp'
# uncomment to view browser logs in PHP/Apache logs
# debugLogger: 'php://stdout'

# Advanced Configuration
# if you want to propose this website as a service for other domains
htmltopdf_service_authorized_domains:
# - 'example.org'
# - 'another-one.com'

# ADVANCED SETUP
# Advanced Configuration
# Configure this when the HTTP server does not have access to the YesWiki via its public URL.
#
# Eg, if Docker/base_url is https://example.com/? and Apache runs as http://localhost:8000,
# … then `htmltopdf_base_url` value should be `http://localhost:8000/?`.
# Use cases: reverse-proxy, within a YesWiki Docker container.
htmltopdf_base_url: ~
#htmltopdf_base_url: http://localhost:8000/?
#
# for edit config action
publication_editable_config_params:
- 'htmltopdf_service_url'
2 changes: 1 addition & 1 deletion handlers/page/pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
$page = $browser->createPage();
$page->navigate($sourceUrl)->waitForNavigation(HeadlessChromium\Page::NETWORK_IDLE);

$value = $page->evaluate('__is_yw_publication_ready()')->getReturnValue(20000);
$value = $page->evaluate('__is_yw_publication_ready()')->getReturnValue($this->config['page_load_timeout']);

// now generate PDF
$page->pdf(array(
Expand Down