SinglePageController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Events\ScanForNewReleaseCalled;
  4. use App\Facades\Settings;
  5. use Illuminate\Support\Facades\App;
  6. use Illuminate\Support\Facades\Auth;
  7. class SinglePageController extends Controller
  8. {
  9. /**
  10. * return the main view
  11. *
  12. * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
  13. */
  14. public function index()
  15. {
  16. event(new ScanForNewReleaseCalled());
  17. $settings = Settings::all()->toJson();
  18. $proxyAuth = config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false;
  19. $proxyLogoutUrl = config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false;
  20. $subdir = config('2fauth.config.appSubdirectory') ? '/' . config('2fauth.config.appSubdirectory') : '';
  21. $defaultPreferences = collect(config('2fauth.preferences')); /** @phpstan-ignore-line */
  22. $isDemoApp = config('2fauth.config.isDemoApp') ? 'true' : 'false';
  23. $isTestingApp = config('2fauth.config.isTestingApp') ? 'true' : 'false';
  24. $lang = App::getLocale();
  25. $locales = collect(config('2fauth.locales'))->toJson(); /** @phpstan-ignore-line */
  26. $openidAuth = config('services.openid.client_secret') ? true : false;
  27. $githubAuth = config('services.github.client_secret') ? true : false;
  28. // if (Auth::user()->preferences)
  29. return view('landing')->with([
  30. 'appSettings' => $settings,
  31. 'appConfig' => collect([
  32. 'proxyAuth' => $proxyAuth,
  33. 'proxyLogoutUrl' => $proxyLogoutUrl,
  34. 'sso' => [
  35. 'openid' => $openidAuth,
  36. 'github' => $githubAuth,
  37. ],
  38. 'subdirectory' => $subdir,
  39. ])->toJson(),
  40. 'defaultPreferences' => $defaultPreferences,
  41. 'subdirectory' => $subdir,
  42. 'isDemoApp' => $isDemoApp,
  43. 'isTestingApp' => $isTestingApp,
  44. 'lang' => $lang,
  45. 'locales' => $locales,
  46. ]);
  47. }
  48. }