Merge pull request #4038 from beganovich/v2-fix-setup-issues

Disable sandboxing with PDFs & fix setup page issues
This commit is contained in:
David Bomba 2020-09-07 09:31:28 +10:00 committed by GitHub
commit 4991c159f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 49 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@ -30,11 +31,6 @@ use Spatie\Browsershot\Browsershot;
*/
class SetupController extends Controller
{
/**
* Main setup view.
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
*/
public function index()
{
$check = SystemHealth::check(false);
@ -64,9 +60,8 @@ class SetupController extends Controller
$url = $request->input('url');
if (substr($url, -1) != '/') {
$url = $url.'/';
}
if (substr($url, -1) != '/')
$url = $url . '/';
$_ENV['APP_KEY'] = config('app.key');
$_ENV['APP_URL'] = $url;
@ -107,7 +102,7 @@ class SetupController extends Controller
}
/* Write the .env file */
$filePath = base_path().'/.env';
$filePath = base_path() . '/.env';
$fp = fopen($filePath, 'w');
fwrite($fp, $config);
fclose($fp);
@ -196,10 +191,11 @@ class SetupController extends Controller
return $this->testPhantom();
}
Browsershot::url('https://www.invoiceninja.com')->savePdf(
// Browsershot::html('If you see this text, generating PDF works! Thanks for using Invoice Ninja!')->savePdf(
public_path('test.pdf')
);
Browsershot::url('https://www.invoiceninja.com')
->noSandbox()
->savePdf(
public_path('test.pdf')
);
return response(['url' => asset('test.pdf')], 200);
} catch (\Exception $e) {

View File

@ -40,6 +40,7 @@ trait PdfMaker
->showBackground()
->deviceScaleFactor(1)
->waitUntilNetworkIdle(true)
->noSandbox()
->pdf();
}
}

View File

@ -61,42 +61,6 @@
@endif
</dd>
</div>
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center">
<dt class="text-sm leading-5 font-medium text-gray-500">
{{ ctrans('texts.npm_status') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@if($check['npm_status'])
<span class="alert alert-success block flex justify-between items-center">
<span>{{ $check['npm_status'] }} => {{ strtoupper(ctrans('texts.ok')) }}</span>
<span></span>
</span>
@else
<span class="alert alert-failure block flex justify-between items-center">
<span>{{ ctrans('texts.npm_status_not_found') }}</span>
<span></span>
</span>
@endif
</dd>
</div>
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center">
<dt class="text-sm leading-5 font-medium text-gray-500">
{{ ctrans('texts.node_status') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@if($check['node_status'])
<span class="alert alert-success block flex justify-between items-center">
<span>{{ $check['node_status'] }} => {{ strtoupper(ctrans('texts.ok')) }}</span>
<span></span>
</span>
@else
<span class="alert alert-failure block flex justify-between items-center">
<span>{{ ctrans('texts.node_status_not_found') }}</span>
<span></span>
</span>
@endif
</dd>
</div>
</dl>
</div>
</div>

View File

@ -25,6 +25,7 @@ class PdfGenerationTest extends TestCase
//->footerHtml($footer)
->waitUntilNetworkIdle()
//->margins(10,10,10,10)
->noSandbox()
->savePdf($pdf);
}