Skip to content

Commit 9708902

Browse files
authored
Merge pull request #50 from lastForAThousandYears/main
fix for new vk api
2 parents 606406e + 9be3286 commit 9708902

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ jobs:
6969
goarch: arm64
7070
cgo: 1
7171
api: 21
72+
- goos: android
73+
goarch: arm
74+
cgo: 1
75+
api: 21
7276
# you can add more (android/arm, windows, etc.) later
7377

7478
steps:

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
goarch: arm64
4444
cgo: 1
4545
api: 21
46+
- goos: android
47+
goarch: arm
48+
cgo: 1
49+
api: 21
4650
- goos: freebsd
4751
goarch: amd64
4852
cgo: 0
@@ -87,6 +91,8 @@ jobs:
8791
8892
if [ "$GOARCH" = "arm64" ]; then
8993
export CC="$TOOLCHAIN_BIN/aarch64-linux-android${ANDROID_API}-clang"
94+
elif [ "$GOARCH" = "arm" ]; then
95+
export CC="$TOOLCHAIN_BIN/armv7a-linux-androideabi${ANDROID_API}-clang"
9096
else
9197
echo "Unsupported ANDROID GOARCH=$GOARCH"
9298
exit 1

client/main.go

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func getVkCreds(link string) (string, string, string, error) {
7878
}
7979
}()
8080

81-
data := "client_secret=QbYic1K3lEV5kTGiqlq2&client_id=6287487&scopes=audio_anonymous%2Cvideo_anonymous%2Cphotos_anonymous%2Cprofile_anonymous&isApiOauthAnonymEnabled=false&version=1&app_id=6287487"
81+
data := "client_id=6287487&token_type=messages&client_secret=QbYic1K3lEV5kTGiqlq2&version=1&app_id=6287487"
8282
url := "https://login.vk.ru/?act=get_anonym_token"
8383

8484
resp, err := doRequest(data, url)
@@ -88,35 +88,15 @@ func getVkCreds(link string) (string, string, string, error) {
8888

8989
token1 := resp["data"].(map[string]interface{})["access_token"].(string)
9090

91-
data = fmt.Sprintf("access_token=%s", token1)
92-
url = "https://api.vk.ru/method/calls.getAnonymousAccessTokenPayload?v=5.264&client_id=6287487"
93-
94-
resp, err = doRequest(data, url)
95-
if err != nil {
96-
return "", "", "", fmt.Errorf("request error:%s", err)
97-
}
98-
99-
token2 := resp["response"].(map[string]interface{})["payload"].(string)
100-
101-
data = fmt.Sprintf("client_id=6287487&token_type=messages&payload=%s&client_secret=QbYic1K3lEV5kTGiqlq2&version=1&app_id=6287487", token2)
102-
url = "https://login.vk.ru/?act=get_anonym_token"
103-
104-
resp, err = doRequest(data, url)
105-
if err != nil {
106-
return "", "", "", fmt.Errorf("request error:%s", err)
107-
}
108-
109-
token3 := resp["data"].(map[string]interface{})["access_token"].(string)
110-
111-
data = fmt.Sprintf("vk_join_link=https://vk.com/call/join/%s&name=123&access_token=%s", link, token3)
91+
data = fmt.Sprintf("vk_join_link=https://vk.com/call/join/%s&name=123&access_token=%s", link, token1)
11292
url = "https://api.vk.ru/method/calls.getAnonymousToken?v=5.264"
11393

11494
resp, err = doRequest(data, url)
11595
if err != nil {
11696
return "", "", "", fmt.Errorf("request error:%s", err)
11797
}
11898

119-
token4 := resp["response"].(map[string]interface{})["token"].(string)
99+
token2 := resp["response"].(map[string]interface{})["token"].(string)
120100

121101
data = fmt.Sprintf("%s%s%s", "session_data=%7B%22version%22%3A2%2C%22device_id%22%3A%22", uuid.New(), "%22%2C%22client_version%22%3A1.1%2C%22client_type%22%3A%22SDK_JS%22%7D&method=auth.anonymLogin&format=JSON&application_key=CGMMEJLGDIHBABABA")
122102
url = "https://calls.okcdn.ru/fb.do"
@@ -126,9 +106,9 @@ func getVkCreds(link string) (string, string, string, error) {
126106
return "", "", "", fmt.Errorf("request error:%s", err)
127107
}
128108

129-
token5 := resp["session_key"].(string)
109+
token3 := resp["session_key"].(string)
130110

131-
data = fmt.Sprintf("joinLink=%s&isVideo=false&protocolVersion=5&anonymToken=%s&method=vchat.joinConversationByLink&format=JSON&application_key=CGMMEJLGDIHBABABA&session_key=%s", link, token4, token5)
111+
data = fmt.Sprintf("joinLink=%s&isVideo=false&protocolVersion=5&anonymToken=%s&method=vchat.joinConversationByLink&format=JSON&application_key=CGMMEJLGDIHBABABA&session_key=%s", link, token2, token3)
132112
url = "https://calls.okcdn.ru/fb.do"
133113

134114
resp, err = doRequest(data, url)

0 commit comments

Comments
 (0)