2022-07-21 15:48:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2022-09-21 21:50:41 +02:00
|
|
|
use App\Events\ReleaseRadarActivated;
|
|
|
|
use App\Services\ReleaseRadarService;
|
|
|
|
use Illuminate\Support\Facades\App;
|
2022-07-21 15:48:23 +02:00
|
|
|
use App\Http\Controllers\Controller;
|
2022-07-30 17:51:02 +02:00
|
|
|
use App\Facades\Settings;
|
2022-07-21 15:48:23 +02:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class SystemController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get detailed information about the current installation
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\JsonResponse
|
|
|
|
*/
|
|
|
|
public function infos(Request $request)
|
|
|
|
{
|
2022-08-26 15:57:18 +02:00
|
|
|
$infos = array();
|
2022-07-21 15:48:23 +02:00
|
|
|
$infos['Date'] = date(DATE_RFC2822);
|
|
|
|
$infos['userAgent'] = $request->header('user-agent');
|
|
|
|
// App info
|
|
|
|
$infos['Version'] = config('2fauth.version');
|
|
|
|
$infos['Environment'] = config('app.env');
|
|
|
|
$infos['Debug'] = var_export(config('app.debug'), true);
|
|
|
|
$infos['Cache driver'] = config('cache.default');
|
|
|
|
$infos['Log channel'] = config('logging.default');
|
|
|
|
$infos['Log level'] = env('LOG_LEVEL');
|
|
|
|
$infos['DB driver'] = DB::getDriverName();
|
|
|
|
// PHP info
|
|
|
|
$infos['PHP version'] = PHP_VERSION;
|
|
|
|
$infos['Operating system'] = PHP_OS;
|
|
|
|
$infos['interface'] = PHP_SAPI;
|
|
|
|
// Auth info
|
2022-09-07 18:07:37 +02:00
|
|
|
if ($request->user()) {
|
|
|
|
$infos['Auth guard'] = config('auth.defaults.guard');
|
|
|
|
if ($infos['Auth guard'] === 'reverse-proxy-guard') {
|
|
|
|
$infos['Auth proxy header for user'] = config('auth.auth_proxy_headers.user');
|
|
|
|
$infos['Auth proxy header for email'] = config('auth.auth_proxy_headers.email');
|
|
|
|
}
|
|
|
|
$infos['webauthn user verification'] = config('larapass.login_verify');
|
|
|
|
$infos['Trusted proxies'] = config('2fauth.trustedProxies') ?: 'none';
|
2022-07-21 15:48:23 +02:00
|
|
|
}
|
|
|
|
// User info
|
|
|
|
if ($request->user()) {
|
2022-07-30 17:51:02 +02:00
|
|
|
$infos['options'] = Settings::all()->toArray();
|
2022-07-21 15:48:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return response()->json($infos);
|
|
|
|
}
|
2022-09-21 21:50:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get latest release
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\JsonResponse
|
|
|
|
*/
|
|
|
|
public function latestRelease(Request $request)
|
|
|
|
{
|
|
|
|
$releaseRadarService = App::make(ReleaseRadarService::class);
|
|
|
|
$release = $releaseRadarService->scanForRelease();
|
|
|
|
|
|
|
|
return response()->json($release);
|
|
|
|
}
|
2022-07-21 15:48:23 +02:00
|
|
|
}
|