diff --git a/README.md b/README.md index f39a66f367e1..190d4b7be602 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@

![v5-develop phpunit](https://github.com/invoiceninja/invoiceninja/workflows/phpunit/badge.svg?branch=v5-develop) -![v5-stable phpunit](https://github.com/invoiceninja/invoiceninja/workflows/phpunit/badge.svg?branch=v5-stable) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/d16c78aad8574466bf83232b513ef4fb)](https://www.codacy.com/gh/turbo124/invoiceninja/dashboard?utm_source=github.com&utm_medium=referral&utm_content=turbo124/invoiceninja&utm_campaign=Badge_Grade) CLA assistant diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 6a7b89d56045..6d7108dc89f9 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -996,6 +996,41 @@ class BaseController extends Controller return redirect('/setup'); } + public function reactCatch() + { + if ((bool) $this->checkAppSetup() !== false && $account = Account::first()) { + if (config('ninja.require_https') && ! request()->isSecure()) { + return redirect()->secure(request()->getRequestUri()); + } + + $data = []; + + //pass report errors bool to front end + $data['report_errors'] = Ninja::isSelfHost() ? $account->report_errors : true; + + //pass referral code to front end + $data['rc'] = request()->has('rc') ? request()->input('rc') : ''; + $data['build'] = request()->has('build') ? request()->input('build') : ''; + $data['login'] = request()->has('login') ? request()->input('login') : 'false'; + $data['signup'] = request()->has('signup') ? request()->input('signup') : 'false'; + + $data['user_agent'] = request()->server('HTTP_USER_AGENT'); + + $data['path'] = $this->setBuild(); + + $this->buildCache(); + + if (Ninja::isSelfHost() && $account->set_react_as_default_ap) { + return view('react.index', $data); + } else { + abort('page not found', 404); + } + } + + return redirect('/setup'); + } + + private function setBuild() { $build = ''; diff --git a/app/Transformers/VendorContactTransformer.php b/app/Transformers/VendorContactTransformer.php index dbbdf6daedc4..5524cac59102 100644 --- a/app/Transformers/VendorContactTransformer.php +++ b/app/Transformers/VendorContactTransformer.php @@ -32,6 +32,7 @@ class VendorContactTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($vendor->id), 'first_name' => $vendor->first_name ?: '', 'last_name' => $vendor->last_name ?: '', + 'send_email' => (bool)$vendor->send_email, 'email' => $vendor->email ?: '', 'created_at' => (int) $vendor->created_at, 'updated_at' => (int) $vendor->updated_at, diff --git a/routes/web.php b/routes/web.php index fc04c0a72f0f..9e5d3bf5fb0f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -59,3 +59,5 @@ Route::get('checkout/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [C Route::get('mollie/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [Mollie3dsController::class, 'index'])->middleware('domain_db')->name('mollie.3ds_redirect'); Route::get('gocardless/ibp_redirect/{company_key}/{company_gateway_id}/{hash}', [GoCardlessController::class, 'ibpRedirect'])->middleware('domain_db')->name('gocardless.ibp_redirect'); Route::get('.well-known/apple-developer-merchantid-domain-association', [ApplePayDomainController::class, 'showAppleMerchantId']); + +Route::fallback([BaseController::class, 'reactCatch']); \ No newline at end of file