Enable sandboxing with PDFs & fix setup page issues

This commit is contained in:
Benjamin Beganović 2020-09-06 04:23:04 +02:00
parent ad6ae61996
commit 7a5027f1b4
4 changed files with 18 additions and 62 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);
@ -53,7 +49,7 @@ class SetupController extends Controller
if ($check['system_health'] === false) {
info($check);
return response('Oops, something went wrong. Check your logs.'); /** We should never reach this block, but jic. */
return response('Oops, something went wrong. Check your storage/logs/laravel.log file.');
}
$mail_driver = $request->input('mail_driver');
@ -198,9 +194,9 @@ 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(
Browsershot::url('https://www.invoiceninja.com')
->noSandbox()
->savePdf(
public_path('test.pdf')
);
@ -227,14 +223,9 @@ class SetupController extends Controller
Storage::disk('local')->put('test.pdf', $pdf);
return response(['url' => Storage::disk('local')->url('test.pdf')], 200);
}
catch(\Exception $e){
} catch (\Exception $e) {
return response([], 500);
}
}
}

View File

@ -40,8 +40,8 @@ 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);
}