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

View File

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

View File

@ -61,42 +61,6 @@
@endif @endif
</dd> </dd>
</div> </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> </dl>
</div> </div>
</div> </div>

View File

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