Ping route (#3541)

* minor fixes

* minor fixes

* Fixes for self update

* fixes for template previews

* Add report_errors variable

* Ping route
This commit is contained in:
David Bomba 2020-03-25 19:36:47 +11:00 committed by GitHub
parent 24c9121b1b
commit 1d11358215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 18 deletions

View File

@ -62,8 +62,13 @@ class ArtisanUpgrade extends Command
try {
/* Restart Horizon */
Artisan::call('horizon:terminate');
Artisan::call('horizon');
//Artisan::call('horizon:terminate');
exec('cd '.base_path().' && /usr/bin/php artisan horizon:terminate');
exec('cd '.base_path().' && /usr/bin/php artisan horizon &');
//Artisan::call('horizon');
} catch (Exception $e) {
\Log::error("I wasn't able to start horizon");
}
@ -71,7 +76,7 @@ class ArtisanUpgrade extends Command
putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
$input = new ArrayInput(array('command' => 'install'));
$application = new Application();
//$application->setAutoExit(false); // prevent `$application->run` method from exitting the script
$application->setAutoExit(true); // prevent `$application->run` method from exitting the script
$application->run($input);
}

View File

@ -11,11 +11,13 @@
namespace App\Http\Controllers;
use App\Libraries\Account;
use App\Models\Company;
use App\Models\Design;
use App\Models\User;
use App\Transformers\ArraySerializer;
use App\Transformers\EntityTransformer;
use App\Utils\Ninja;
use App\Utils\Statics;
use App\Utils\Traits\AppSetup;
use Illuminate\Http\Request;
@ -301,8 +303,17 @@ class BaseController extends Controller
public function flutterRoute()
{
if (!$this->checkAppSetup());
return redirect('/setup');
return redirect('/setup');
return view('index.index');
$data = [];
if(Ninja::isSelfHost()){
$account = Account::all()->first();
$data['report_errors'] = $account->report_errors;
}
else
$data['report_errors'] = true;
return view('index.index', $data);
}
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PingController extends BaseController
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return response()->json('success', 200);
}
}

View File

@ -124,7 +124,6 @@ class TemplateController extends BaseController
$subject = request()->input('subject') ?: '';
$body = request()->input('body') ?: '';
$template = request()->input('template') ?: '';
$include_wrapper = request()->input('include_wrapper') ?: false;
if(strlen($template) >1) {
@ -151,12 +150,9 @@ class TemplateController extends BaseController
$body = $converter->convertToHtml($body);
if($include_wrapper){
/* wrapper */
$email_style = $settings_entity->getSetting('email_style');
$email_style = 'dark';
$data['title'] = '';
$data['body'] = $body;
$data['footer'] = '';
@ -164,22 +160,21 @@ class TemplateController extends BaseController
if($email_style == 'custom') {
$wrapper = $settings_entity->getSetting('email_style_custom');
$this->renderView($wrapper, $data);
$wrapper = $this->renderView($wrapper, $data);
}
else {
$wrapper = $this->getTemplate();
$body = view($this->getTemplatePath($email_style), $data)->render();
$wrapper = view($this->getTemplatePath($email_style), $data)->render();
}
}
$data = [
'subject' => $subject,
'body' => $body,
'wrapper' => $wrapper,
];
return response()->json($data, 200);

View File

@ -308,7 +308,7 @@ trait MakesInvoiceValues
$data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
//$data['$contact.signature']
// $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')];
// $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')];

View File

@ -146,8 +146,10 @@ return [
'connection' => 'redis',
'queue' => ['default'],
'balance' => 'simple',
'processes' => 8,
'tries' => 1,
'processes' => 2,
'memory'=> 512,
'timeout'=> 360,
'tries' => 3,
],
],
@ -157,7 +159,9 @@ return [
'queue' => ['default'],
'balance' => 'simple',
'processes' => 3,
'tries' => 1,
'memory'=> 512,
'timeout'=> 360,
'tries' => 3,
],
],
],

View File

@ -125,6 +125,7 @@ class CreateUsersTable extends Migration
$table->string('utm_term')->nullable();
$table->string('utm_content')->nullable();
$table->string('latest_version')->default('0.0.0');
$table->boolean('report_errors')->default(false);
$table->float('discount')->default(0);
$table->date('discount_expires')->nullable();

View File

@ -15,6 +15,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
*/
Route::get('/api/v1/ping', 'PingController@index')->name('ping');
Route::group(['middleware' => ['api_secret_check']], function () {
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');