1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Add secret to phantomjscloud link

This commit is contained in:
Hillel Coren 2017-07-10 11:07:52 +03:00
parent de0f5b8fec
commit 1d2c5f5b59

View File

@ -1147,17 +1147,18 @@ class Invoice extends EntityModel implements BalanceAffecting
$invitation = $this->invitations[0];
$link = $invitation->getLink('view', true);
$pdfString = false;
$phantomjsSecret = env('PHANTOMJS_SECRET');
try {
if (env('PHANTOMJS_BIN_PATH')) {
$pdfString = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
$pdfString = CurlUtils::phantom('GET', $link . "?phantomjs=true&phantomjs_secret={$phantomjsSecret}");
}
if (! $pdfString && ($key = env('PHANTOMJS_CLOUD_KEY'))) {
if (Utils::isNinjaDev()) {
$link = env('TEST_LINK');
}
$url = "http://api.phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$link}?phantomjs=true%22,renderType:%22html%22%7D";
$url = "http://api.phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$link}?phantomjs=true&phantomjs_secret={$phantomjsSecret}%22,renderType:%22html%22%7D";
$pdfString = CurlUtils::get($url);
}