Skip to content

Commit

Permalink
Only provide the quant-token header if drafts are not disabled.
Browse files Browse the repository at this point in the history
Disable drafts by default.
  • Loading branch information
stooit committed Oct 31, 2023
1 parent e793d24 commit 4744071
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/install/quant.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ quant_enabled_views: 1
quant_enabled_redirects: 1
quant_routes_export:
ssl_cert_verify: 1
disable_content_drafts: 1
xpath_selectors: "//li[contains(@class,\"pager__item--next\")]/a[contains(@href,\"page=\")]\r\n//li[contains(@class,\"pager__item--first\")]/a[starts-with(@href, \"/\")]"
12 changes: 10 additions & 2 deletions src/Seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ public static function headRoute($route, array $headers = []) {
$headers['Host'] = $hostname;

// Generate a signed token and use it in the request.
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
// This only applies when drafts are enabled, as we return neutral access otherwise.
$disable_drafts = $config->get('disable_content_drafts');
if (!$disable_drafts) {
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
}

// Support basic auth if enabled (note: will not work via drush/cli).
$auth = !empty($_SERVER['PHP_AUTH_USER']) ? [
Expand Down Expand Up @@ -491,7 +495,11 @@ public static function markupFromRoute($route, array $headers = []) {
$headers['Host'] = $hostname;

// Generate a signed token and use it in the request.
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
// This only applies when drafts are enabled, as we return neutral access otherwise.
$disable_drafts = $config->get('disable_content_drafts');
if (!$disable_drafts) {
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
}

// Support basic auth if enabled (note: will not work via drush/cli).
$auth = !empty($_SERVER['PHP_AUTH_USER']) ? [
Expand Down

0 comments on commit 4744071

Please sign in to comment.