refactor: единая константа версии VK API для calls.*

This commit is contained in:
samosvalishe
2026-06-19 15:54:41 +03:00
parent dd55d96846
commit b76e21266d
3 changed files with 6 additions and 2 deletions
@@ -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)
}
@@ -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)
@@ -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