Use UA description instead of "api" in default API platform

OpenVK will try to guess OS and name of library which was used to make token generation request to more accurately represent.. stuff.
This commit is contained in:
celestora 2023-06-17 14:25:21 +03:00 committed by GitHub
parent d9b595d250
commit 53fa14d89e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ use openvk\VKAPI\Exceptions\APIErrorException;
use openvk\Web\Models\Entities\{User, APIToken};
use openvk\Web\Models\Repositories\{Users, APITokens};
use lfkeitel\phptotp\{Base32, Totp};
use WhichBrowser;
final class VKAPIPresenter extends OpenVKPresenter
{
@ -283,7 +284,7 @@ final class VKAPIPresenter extends OpenVKPresenter
$token = new APIToken;
$token->setUser($user);
$token->setPlatform(is_null($platform) ? "api" : $platform);
$token->setPlatform($platform ?? (new WhichBrowser\Parser(getallheaders()))->toString());
$token->save();
$payload = json_encode([