From b76e21266d3a8bb457ad40263da2404089a2b7d6 Mon Sep 17 00:00:00 2001 From: samosvalishe Date: Fri, 19 Jun 2026 15:54:41 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=D0=B5=D0=B4=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20VK=20API=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20calls.*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/provider/vk/internal/vkauth/token.go | 2 +- internal/provider/vk/internal/vkauth/token_call.go | 2 +- internal/provider/vk/internal/vkauth/types.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/provider/vk/internal/vkauth/token.go b/internal/provider/vk/internal/vkauth/token.go index 57e0bcd..a8f34c7 100644 --- a/internal/provider/vk/internal/vkauth/token.go +++ b/internal/provider/vk/internal/vkauth/token.go @@ -40,7 +40,7 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c // Шаг 1a: прогрев getCallPreview (не критично). previewData := fmt.Sprintf("vk_join_link=https://vk.ru/call/join/%s&fields=photo_200&access_token=%s", link, token1) if _, prevErr := c.doRequest(ctx, httpClient, profile, previewData, - "https://api.vk.ru/method/calls.getCallPreview?v=5.282&client_id="+creds.ClientID); prevErr != nil { + "https://api.vk.ru/method/calls.getCallPreview?v="+APIVersion+"&client_id="+creds.ClientID); prevErr != nil { c.log.Warnf("[STREAM %d] [VK Auth] getCallPreview failed: %v", streamID, prevErr) } diff --git a/internal/provider/vk/internal/vkauth/token_call.go b/internal/provider/vk/internal/vkauth/token_call.go index 3f645c4..cd62117 100644 --- a/internal/provider/vk/internal/vkauth/token_call.go +++ b/internal/provider/vk/internal/vkauth/token_call.go @@ -23,7 +23,7 @@ func (c *Client) fetchCallToken( link, escapedName, token1 string, creds VKCredentials, ) (string, error) { - urlAddr := fmt.Sprintf("https://api.vk.ru/method/calls.getAnonymousToken?v=5.274&client_id=%s", creds.ClientID) + urlAddr := fmt.Sprintf("https://api.vk.ru/method/calls.getAnonymousToken?v=%s&client_id=%s", APIVersion, creds.ClientID) data := fmt.Sprintf("vk_join_link=https://vk.ru/call/join/%s&name=%s&access_token=%s", link, escapedName, token1) diff --git a/internal/provider/vk/internal/vkauth/types.go b/internal/provider/vk/internal/vkauth/types.go index 50b2ccd..5059bc8 100644 --- a/internal/provider/vk/internal/vkauth/types.go +++ b/internal/provider/vk/internal/vkauth/types.go @@ -37,6 +37,10 @@ var DefaultCredentials = []VKCredentials{ {ClientID: "3140623", ClientSecret: "VeWdmVclDCtn6ihuP1nt"}, // VK_IPHONE_APP } +// APIVersion - версия VK API во всех calls.* запросах. Держать единой и близкой +// к версии живого web-клиента звонка (рассинхрон = fingerprint-аномалия). +const APIVersion = "5.282" + const ( CredentialLifetime = 10 * time.Minute CacheSafetyMargin = 60 * time.Second