2019-05-28 17:29:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2022-11-22 15:15:52 +01:00
|
|
|
use App\Events\ScanForNewReleaseCalled;
|
2022-07-30 17:51:02 +02:00
|
|
|
use App\Facades\Settings;
|
2021-12-03 22:50:28 +01:00
|
|
|
use Illuminate\Support\Facades\App;
|
2023-02-19 22:59:20 +01:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2019-05-28 17:29:15 +02:00
|
|
|
|
|
|
|
class SinglePageController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* return the main view
|
2022-11-22 15:15:52 +01:00
|
|
|
*
|
2022-08-26 15:57:18 +02:00
|
|
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
2019-05-28 17:29:15 +02:00
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2022-10-12 11:10:51 +02:00
|
|
|
event(new ScanForNewReleaseCalled());
|
|
|
|
|
2023-09-27 10:50:21 +02:00
|
|
|
$settings = Settings::all()->toJson();
|
|
|
|
$proxyAuth = config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false;
|
|
|
|
$proxyLogoutUrl = config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false;
|
|
|
|
$subdir = config('2fauth.config.appSubdirectory') ? '/' . config('2fauth.config.appSubdirectory') : '';
|
|
|
|
$defaultPreferences = collect(config('2fauth.preferences')); /** @phpstan-ignore-line */
|
|
|
|
$isDemoApp = config('2fauth.config.isDemoApp') ? 'true' : 'false';
|
|
|
|
$isTestingApp = config('2fauth.config.isTestingApp') ? 'true' : 'false';
|
|
|
|
$lang = App::getLocale();
|
|
|
|
$locales = collect(config('2fauth.locales'))->toJson(); /** @phpstan-ignore-line */
|
2023-12-09 17:22:24 +01:00
|
|
|
$openidAuth = config('services.openid.client_secret') ? true : false;
|
|
|
|
$githubAuth = config('services.github.client_secret') ? true : false;
|
2023-03-15 11:46:37 +01:00
|
|
|
|
|
|
|
// if (Auth::user()->preferences)
|
2023-01-25 16:58:30 +01:00
|
|
|
|
2023-12-05 14:41:57 +01:00
|
|
|
return view('landing')->with([
|
2023-03-15 11:46:37 +01:00
|
|
|
'appSettings' => $settings,
|
2022-11-22 15:15:52 +01:00
|
|
|
'appConfig' => collect([
|
2023-03-15 11:46:37 +01:00
|
|
|
'proxyAuth' => $proxyAuth,
|
|
|
|
'proxyLogoutUrl' => $proxyLogoutUrl,
|
2023-12-09 17:22:24 +01:00
|
|
|
'sso' => [
|
|
|
|
'openid' => $openidAuth,
|
|
|
|
'github' => $githubAuth,
|
|
|
|
],
|
2023-12-20 16:55:58 +01:00
|
|
|
'subdirectory' => $subdir,
|
2022-05-16 22:55:50 +02:00
|
|
|
])->toJson(),
|
2023-09-27 10:50:21 +02:00
|
|
|
'defaultPreferences' => $defaultPreferences,
|
|
|
|
'subdirectory' => $subdir,
|
|
|
|
'isDemoApp' => $isDemoApp,
|
|
|
|
'isTestingApp' => $isTestingApp,
|
|
|
|
'lang' => $lang,
|
|
|
|
'locales' => $locales,
|
2021-12-01 13:47:20 +01:00
|
|
|
]);
|
2019-05-28 17:29:15 +02:00
|
|
|
}
|
|
|
|
}
|