mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Work around issue with Weathermaps (#10033)
This commit is contained in:
@@ -46,6 +46,25 @@ class Laravel
|
||||
$kernel->bootstrap();
|
||||
}
|
||||
|
||||
public static function bootWeb()
|
||||
{
|
||||
// this is not a substitute for the normal Laravel boot, just a way to make auth work for external php
|
||||
if (self::isBooted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
$install_dir = realpath(__DIR__ . '/../..');
|
||||
$app = require_once $install_dir . '/bootstrap/app.php';
|
||||
$kernel = $app->make(\Illuminate\Contracts\Http\Kernel::class);
|
||||
|
||||
$request = \Illuminate\Http\Request::capture();
|
||||
$request->server->set('REQUEST_URI', '/blank'); // load an empty page since it will be discarded
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
// $response->send(); // don't send response, legacy code will
|
||||
}
|
||||
|
||||
public static function isBooted()
|
||||
{
|
||||
return !empty(app()->isAlias('Illuminate\Foundation\Application')) && app()->isBooted();
|
||||
|
@@ -93,7 +93,11 @@ if (module_selected('alerts', $init_modules)) {
|
||||
}
|
||||
|
||||
// Boot Laravel
|
||||
\LibreNMS\Util\Laravel::bootCli();
|
||||
if (module_selected('auth', $init_modules)) {
|
||||
\LibreNMS\Util\Laravel::bootWeb();
|
||||
} else {
|
||||
\LibreNMS\Util\Laravel::bootCli();
|
||||
}
|
||||
|
||||
set_debug(false); // disable debug initially (hides legacy errors too)
|
||||
|
||||
|
@@ -106,6 +106,11 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
|
||||
// demo helper
|
||||
Route::permanentRedirect('demo', '/');
|
||||
|
||||
// blank page, dummy page for external code using Laravel::bootWeb()
|
||||
Route::any('/blank', function () {
|
||||
return '';
|
||||
});
|
||||
|
||||
// Legacy routes
|
||||
Route::any('/{path?}', 'LegacyController@index')
|
||||
->where('path', '^((?!_debugbar).)*');
|
||||
|
Reference in New Issue
Block a user