diff options
author | George Hazan <george.hazan@gmail.com> | 2024-08-05 20:22:36 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-08-05 20:22:36 +0300 |
commit | b41249cfae3de49321d23af9e098224a06113796 (patch) | |
tree | 76adda8193edc91c884c0bad8c5c0b10d9877a60 /protocols/SkypeWeb/src/skype_files.cpp | |
parent | 4f14f0cbdb82962e84716a118e6e0fb78f855c8b (diff) |
fixes #4551 (SkypeWeb: не работает отправка и прием файлов)
Diffstat (limited to 'protocols/SkypeWeb/src/skype_files.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_files.cpp | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 24875a5590..a9d6512498 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -25,30 +25,46 @@ void CSkypeProto::ReceiveFileThread(void *param) ofd->pCallback->Invoke(*ofd);
}
else {
- CMStringA szCookie;
+ CMStringA szCookie, szUrl;
szCookie.AppendFormat("skypetoken_asm=%s", m_szApiToken.get());
+ {
+ MHttpRequest nlhr(REQUEST_GET);
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT;
+ nlhr.m_szUrl = blob.getUrl();
+ nlhr.m_szUrl += "/views/original/status";
+ nlhr.AddHeader("Accept", "*/*");
+ nlhr.AddHeader("Accept-Encoding", "gzip, deflate");
+ nlhr.AddHeader("Cookie", szCookie);
+ NLHR_PTR response(Netlib_HttpTransaction(m_hNetlibUser, &nlhr));
+ if (response) {
+ JsonReply reply(response);
+ if (!reply.error()) {
+ auto &root = reply.data();
+ if (root["view_state"].as_string() == "ready")
+ szUrl = root["view_location"].as_string().c_str();
+ }
+ }
+ }
- MHttpRequest nlhr(REQUEST_GET);
- nlhr.m_szUrl = blob.getUrl();
- nlhr.AddHeader("Sec-Fetch-User", "?1");
- nlhr.AddHeader("Sec-Fetch-Site", "same-site");
- nlhr.AddHeader("Sec-Fetch-Mode", "navigate");
- nlhr.AddHeader("Sec-Fetch-Dest", "empty");
- nlhr.AddHeader("Accept", "*/*");
- nlhr.AddHeader("Accept-Encoding", "gzip");
- nlhr.AddHeader("Cookie", szCookie);
- nlhr.AddHeader("Referer", "https://web.skype.com/");
-
- NLHR_PTR reply(Netlib_DownloadFile(m_hNetlibUser, &nlhr, ofd->wszPath, DownloadCallack, ofd));
- if (reply && reply->resultCode == 200) {
- struct _stat st;
- _wstat(ofd->wszPath, &st);
-
- DBVARIANT dbv = { DBVT_DWORD };
- dbv.dVal = st.st_size;
- db_event_setJson(ofd->hDbEvent, "ft", &dbv);
-
- ofd->Finish();
+ if (!szUrl.IsEmpty()) {
+ MHttpRequest nlhr(REQUEST_GET);
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT;
+ nlhr.m_szUrl = szUrl;
+ nlhr.AddHeader("Accept", "*/*");
+ nlhr.AddHeader("Accept-Encoding", "gzip, deflate");
+ nlhr.AddHeader("Cookie", szCookie);
+
+ NLHR_PTR reply(Netlib_DownloadFile(m_hNetlibUser, &nlhr, ofd->wszPath, DownloadCallack, ofd));
+ if (reply && reply->resultCode == 200) {
+ struct _stat st;
+ _wstat(ofd->wszPath, &st);
+
+ DBVARIANT dbv = { DBVT_DWORD };
+ dbv.dVal = st.st_size;
+ db_event_setJson(ofd->hDbEvent, "ft", &dbv);
+
+ ofd->Finish();
+ }
}
}
}
|