mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
227f39c66c
@ -91,6 +91,6 @@ class ImportJsonController extends BaseController
|
||||
unlink($file_contents);
|
||||
unlink($file_location);
|
||||
|
||||
return $data
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ use App\Http\Middleware\TrustProxies;
|
||||
use App\Http\Middleware\UrlSetDb;
|
||||
use App\Http\Middleware\UserVerified;
|
||||
use App\Http\Middleware\VerifyCsrfToken;
|
||||
use App\Http\Middleware\WebCors;
|
||||
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
||||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
|
||||
@ -70,8 +71,9 @@ class Kernel extends HttpKernel
|
||||
TrimStrings::class,
|
||||
ConvertEmptyStringsToNull::class,
|
||||
TrustProxies::class,
|
||||
//\Fruitcake\Cors\HandleCors::class,
|
||||
// \Fruitcake\Cors\HandleCors::class,
|
||||
Cors::class,
|
||||
WebCors::class,
|
||||
|
||||
];
|
||||
|
||||
@ -90,7 +92,7 @@ class Kernel extends HttpKernel
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
QueryLogging::class,
|
||||
Cors::class,
|
||||
WebCors::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
@ -33,4 +33,4 @@ class Cors
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
36
app/Http/Middleware/WebCors.php
Normal file
36
app/Http/Middleware/WebCors.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class WebCors
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->getMethod() == 'OPTIONS') {
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
// ALLOW OPTIONS METHOD
|
||||
$headers = [
|
||||
'Access-Control-Allow-Methods'=> 'POST, GET, OPTIONS, PUT, DELETE',
|
||||
'Access-Control-Allow-Headers'=> 'X-API-COMPANY-KEY,X-CLIENT-VERSION,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-CSRF-TOKEN,X-LIVEWIRE',
|
||||
];
|
||||
|
||||
return Response::make('OK', 200, $headers);
|
||||
}
|
||||
|
||||
$response = $next($request);
|
||||
|
||||
$response->headers->set('Access-Control-Allow-Origin', $request->getSchemeAndHttpHost());
|
||||
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||
$response->headers->set('Access-Control-Allow-Headers', 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-CSRF-TOKEN,X-LIVEWIRE');
|
||||
$response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION');
|
||||
$response->headers->set('X-APP-VERSION', config('ninja.app_version'));
|
||||
$response->headers->set('X-MINIMUM-CLIENT-VERSION', config('ninja.minimum_client_version'));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-libxml": "*",
|
||||
"asm/php-ansible": "dev-master",
|
||||
"asm/php-ansible": "dev-main",
|
||||
"authorizenet/authorizenet": "^2.0",
|
||||
"bacon/bacon-qr-code": "^2.0",
|
||||
"beganovich/snappdf": "^1.0",
|
||||
@ -137,4 +137,4 @@
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
||||
|
800
composer.lock
generated
800
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*'],
|
||||
'paths' => ['livewire/*'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user