mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
25 lines
705 B
PHP
25 lines
705 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Facades\License;
|
|
use App\Services\AuthenticationService;
|
|
use App\Services\ProxyAuthService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
public function __invoke(Request $request, ProxyAuthService $proxyAuthService, AuthenticationService $auth)
|
|
{
|
|
$data = ['token' => null];
|
|
|
|
if (License::isPlus() && config('koel.proxy_auth.enabled')) {
|
|
$data['token'] = optional(
|
|
$proxyAuthService->tryGetProxyAuthenticatedUserFromRequest($request),
|
|
static fn ($user) => $auth->logUserIn($user)->toArray()
|
|
);
|
|
}
|
|
|
|
return view('index', $data);
|
|
}
|
|
}
|