From 9338c788fa8d42a8c2eb312aafd1f5e2d18f16e6 Mon Sep 17 00:00:00 2001 From: Jose G Date: Sat, 5 Jun 2021 12:17:44 -0600 Subject: [PATCH 1/4] Fix content and safe_content --- webwhatsapi/objects/message.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webwhatsapi/objects/message.py b/webwhatsapi/objects/message.py index e7a72927..822a2303 100755 --- a/webwhatsapi/objects/message.py +++ b/webwhatsapi/objects/message.py @@ -64,6 +64,9 @@ def __init__(self, js_obj, driver=None): elif self.type == "revoked": self.content = "" self.safe_content = "..." + else: + self.content = "" + self.safe_content = self.type+ "..." def __repr__(self): return "".format( From 0a49500b94334a41fa26f698673140dd428c521d Mon Sep 17 00:00:00 2001 From: Jose G Date: Sat, 5 Jun 2021 12:30:13 -0600 Subject: [PATCH 2/4] fix tabulation --- webwhatsapi/objects/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webwhatsapi/objects/message.py b/webwhatsapi/objects/message.py index 822a2303..bd295458 100755 --- a/webwhatsapi/objects/message.py +++ b/webwhatsapi/objects/message.py @@ -66,7 +66,7 @@ def __init__(self, js_obj, driver=None): self.safe_content = "..." else: self.content = "" - self.safe_content = self.type+ "..." + self.safe_content = self.type + "..." def __repr__(self): return "".format( From 70d4c31a6cd20f72766187547bc8a653639cfb51 Mon Sep 17 00:00:00 2001 From: Jose G Date: Wed, 9 Jun 2021 07:40:45 -0600 Subject: [PATCH 3/4] timeout download files --- webwhatsapi/js/wapi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webwhatsapi/js/wapi.js b/webwhatsapi/js/wapi.js index e8d7e49b..fb8196e2 100755 --- a/webwhatsapi/js/wapi.js +++ b/webwhatsapi/js/wapi.js @@ -996,7 +996,7 @@ window.WAPI.getProfilePicFromId = function (id, done) { window.WAPI.downloadFileWithCredentials = function (url, done) { let xhr = new XMLHttpRequest(); - + xhr.timeout = 30000; xhr.onload = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { @@ -1024,7 +1024,7 @@ window.WAPI.downloadFileWithCredentials = function (url, done) { window.WAPI.downloadFile = function (url, done) { let xhr = new XMLHttpRequest(); - + xhr.timeout = 30000; xhr.onload = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { From 4c6aaf696e1b7072c3cf2faf8c28cce383f7275c Mon Sep 17 00:00:00 2001 From: Jose G Date: Wed, 9 Jun 2021 07:55:01 -0600 Subject: [PATCH 4/4] filedownload timeout --- webwhatsapi/js/wapi.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webwhatsapi/js/wapi.js b/webwhatsapi/js/wapi.js index fb8196e2..8df41007 100755 --- a/webwhatsapi/js/wapi.js +++ b/webwhatsapi/js/wapi.js @@ -1014,6 +1014,10 @@ window.WAPI.downloadFileWithCredentials = function (url, done) { } }; + xhr.ontimeout = function (e) { + done(false); + }; + xhr.open("GET", url, true); xhr.withCredentials = true; xhr.responseType = 'blob'; @@ -1042,6 +1046,10 @@ window.WAPI.downloadFile = function (url, done) { } }; + xhr.ontimeout = function (e) { + done(false); + }; + xhr.open("GET", url, true); xhr.responseType = 'blob'; xhr.send(null);