This is an automated email from the git hooks/post-receive script.
cohosh pushed a change to branch main in repository pluggable-transports/snowflake-webext.
from 3ab17f6 bump version to 0.5.5 new 62e9144 refactoring to use stats of webext also in badge new 5f21a6f corrected indentation
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: init-badge.js | 4 +++- init-webext.js | 15 --------------- ui.js | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 16 deletions(-)
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 62e9144f48c1dbc3fd854f0bd46c841aedff5748 Author: 5eba 5eba@untiy-mail.de AuthorDate: Sat Mar 19 08:29:54 2022 +0100
refactoring to use stats of webext also in badge --- init-badge.js | 4 +++- init-webext.js | 15 --------------- ui.js | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/init-badge.js b/init-badge.js index 171d5c0..8d4f4e6 100644 --- a/init-badge.js +++ b/init-badge.js @@ -67,7 +67,9 @@ class BadgeUI extends UI { } else { this.setIcon('on'); } - const total = 0; // FIXME: Share stats from webext + const total = this.stats.reduce((function(t, c) { + return t + c; + }), 0); this.popup.turnOn(clients, total); }
diff --git a/init-webext.js b/init-webext.js index 3b7decf..d527bb8 100644 --- a/init-webext.js +++ b/init-webext.js @@ -12,19 +12,9 @@ class WebExtUI extends UI { this.onConnect = this.onConnect.bind(this); this.onMessage = this.onMessage.bind(this); this.onDisconnect = this.onDisconnect.bind(this); - this.initStats(); chrome.runtime.onConnect.addListener(this.onConnect); }
- initStats() { - this.stats = [0]; - setInterval((() => { - this.stats.unshift(0); - this.stats.splice(24); - this.postActive(); - }), 60 * 60 * 1000); - } - checkNAT() { Util.checkNATType(config.datachannelTimeout).then((type) => { console.log("Setting NAT type: " + type); @@ -123,9 +113,6 @@ class WebExtUI extends UI {
setActive(connected) { super.setActive(connected); - if (connected) { - this.stats[0] += 1; - } this.postActive(); }
@@ -162,8 +149,6 @@ class WebExtUI extends UI {
WebExtUI.prototype.port = null;
-WebExtUI.prototype.stats = null; - WebExtUI.prototype.enabled = true;
/* diff --git a/ui.js b/ui.js index f667bef..f1d846a 100644 --- a/ui.js +++ b/ui.js @@ -4,9 +4,25 @@ All of Snowflake's DOM manipulation and inputs.
class UI {
+ constructor() { + this.initStats(); + } + + initStats() { + this.stats = [0]; + setInterval((() => { + this.stats.unshift(0); + this.stats.splice(24); + this.postActive(); + }), 60 * 60 * 1000); + } + setStatus() {}
setActive(connected) { + if (connected) { + this.stats[0] += 1; + } return this.active = connected; }
@@ -15,3 +31,4 @@ class UI { }
UI.prototype.active = false; +UI.prototype.stats = null;
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 5f21a6fdd86fbc1c435380a643db76b7ac12e5d5 Author: 5eba 5eba@untiy-mail.de AuthorDate: Sat Mar 19 08:57:24 2022 +0100
corrected indentation --- init-badge.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init-badge.js b/init-badge.js index 8d4f4e6..70699b0 100644 --- a/init-badge.js +++ b/init-badge.js @@ -68,8 +68,8 @@ class BadgeUI extends UI { this.setIcon('on'); } const total = this.stats.reduce((function(t, c) { - return t + c; - }), 0); + return t + c; + }), 0); this.popup.turnOn(clients, total); }
tor-commits@lists.torproject.org