summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--whatsapp-nativefier-inject.js68
3 files changed, 47 insertions, 29 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ea95a3261ba0..ec13803eec6e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = whatsapp-nativefier
pkgdesc = WhatsApp desktop built with nativefier (electron)
- pkgver = 2.2142.11
+ pkgver = 2.2142.12
pkgrel = 1
url = https://web.whatsapp.com
arch = armv7l
@@ -19,6 +19,6 @@ pkgbase = whatsapp-nativefier
source = whatsapp-nativefier-inject.js
sha256sums = 3899581abcfed9b40b7208bbbca8bdbfe3ae9655980dbf55f04dec9cb3309f27
sha256sums = bad0489ae519bc78afab3d226966691feede8bcedf58025af1b171215ae51423
- sha256sums = c8486653c651e66d0da78c08dbf46dd5fa25f68daa500a369e09e557a14cc295
+ sha256sums = 25d0587e3c3c9d5262778ece1e24696e51ae7617d3a458bda3d638e1683c9164
pkgname = whatsapp-nativefier
diff --git a/PKGBUILD b/PKGBUILD
index dabe9679523b..8c273f3ae189 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Fredy GarcĂ­a <frealgagu at gmail dot com>
pkgname=whatsapp-nativefier
-pkgver=2.2142.11
+pkgver=2.2142.12
pkgrel=1
pkgdesc="WhatsApp desktop built with nativefier (electron)"
arch=("armv7l" "i686" "x86_64")
@@ -18,7 +18,7 @@ source=(
sha256sums=(
"3899581abcfed9b40b7208bbbca8bdbfe3ae9655980dbf55f04dec9cb3309f27"
"bad0489ae519bc78afab3d226966691feede8bcedf58025af1b171215ae51423"
- "c8486653c651e66d0da78c08dbf46dd5fa25f68daa500a369e09e557a14cc295"
+ "25d0587e3c3c9d5262778ece1e24696e51ae7617d3a458bda3d638e1683c9164"
)
build() {
diff --git a/whatsapp-nativefier-inject.js b/whatsapp-nativefier-inject.js
index d5ba62be5a07..54727e9cf0db 100644
--- a/whatsapp-nativefier-inject.js
+++ b/whatsapp-nativefier-inject.js
@@ -1,28 +1,46 @@
-console.info("Checking for service worker in navigator...");
-if ("serviceWorker" in navigator) {
- console.info("Service worker found in navigator.");
+const TIME_BETWEEN_INVOCATIONS = 5000; // Time between invocations (ms)
+const NUMBER_OF_INVOCATIONS = 5; // Number of invocations
- console.info("Checking cache names from service worker...");
- caches.keys().then(function (cacheNames) {
- console.info("CacheNames:", cacheNames);
- cacheNames.forEach(function (cacheName) {
- console.info("Deleting cache", cacheName, "...");
- caches.delete(cacheName).then(function (result) {
- console.info("Cache", cacheName, "deleted:", result);
- });
- });
- });
+console.info("Checking time between invocations:", TIME_BETWEEN_INVOCATIONS, ", Number of invocations:", NUMBER_OF_INVOCATIONS);
- console.info("Checking service worker registrations...");
- navigator.serviceWorker.getRegistrations().then(function(registrations) {
- console.info("Registrations:", registrations);
- registrations.forEach(function (registration) {
- console.info("Unregistering registration", registration, "...");
- registration.unregister().then(function(result) {
- console.info("Registration", registration, "unregistered:", result);
- });
- });
- });
-} else {
- console.info("Service worker not found in navigator.");
+let invocationNumber = 0;
+for(var number = 0; number < NUMBER_OF_INVOCATIONS; number++) {
+ setTimeout(function() {
+ console.info("*****", ++invocationNumber, "******")
+ console.info("Checking for service worker in navigator...");
+ if ("serviceWorker" in navigator) {
+ console.info("Service worker found in navigator. Checking for unsupported browser message...");
+ if (document.querySelector("a[href='https://support.google.com/chrome/answer/95414']")) {
+ console.info("Checking cache names from service worker...");
+ caches.keys().then(function (cacheNames) {
+ console.info("CacheNames:", cacheNames);
+ cacheNames.forEach(function (cacheName) {
+ console.info("Deleting cache", cacheName, "...");
+ caches.delete(cacheName).then(function (result) {
+ console.info("Cache", cacheName, "deleted:", result);
+ });
+ });
+ });
+
+ console.info("Checking service worker registrations...");
+ navigator.serviceWorker.getRegistrations().then(function(registrations) {
+ console.info("Registrations:", registrations);
+ registrations.forEach(function (registration) {
+ console.info("Unregistering registration", registration, "...");
+ registration.unregister().then(function(result) {
+ console.info("Registration", registration, "unregistered:", result);
+ });
+ });
+ });
+
+ setTimeout(function() {
+ document.location.reload();
+ });
+ } else {
+ console.info("Unsupported browser message not found.");
+ }
+ } else {
+ console.info("Service worker not found in navigator.");
+ }
+ }, number * TIME_BETWEEN_INVOCATIONS);
}