From de0dc0bb86f79234159d32684003bb205240e07c Mon Sep 17 00:00:00 2001 From: Sukhbir Singh Date: Sun, 17 Dec 2017 12:05:35 -0500 Subject: [feat] Display status of bitmaskd in status bar Display the status of bitmaskd in Thunderbird's status bar by connecting to it using bitmask.js --- .../accountWizard/bitmaskMessengerOverlay.js | 23 + .../accountWizard/bitmaskMessengerOverlay.xul | 9 + chrome/content/bitmask.js | 547 +++++++++++++++++++++ 3 files changed, 579 insertions(+) create mode 100644 chrome/content/accountWizard/bitmaskMessengerOverlay.js create mode 100644 chrome/content/bitmask.js (limited to 'chrome') diff --git a/chrome/content/accountWizard/bitmaskMessengerOverlay.js b/chrome/content/accountWizard/bitmaskMessengerOverlay.js new file mode 100644 index 0000000..aa6bff8 --- /dev/null +++ b/chrome/content/accountWizard/bitmaskMessengerOverlay.js @@ -0,0 +1,23 @@ +window.addEventListener("load", function() { + overlayStartup(); +}, false); + +window.setInterval(function() { + overlayStartup(); +}, 3000); + +function overlayStartup() { + let myPanel = document.getElementById("bitmaskStatusBarPanel"); + + // We just need to check if bitmaskd is running and if we were able to + // authorize with it using the token from bitmask.js + let promise = bitmask.core.status(); + promise.then(function(data) { + myPanel.label = "bitmask is " + data["mail"]; + myPanel.style.color = "green"; + }, function(error) { + myPanel.label = "bitmask is not running"; + myPanel.style.color = "red"; + console.log(error); + }); +} diff --git a/chrome/content/accountWizard/bitmaskMessengerOverlay.xul b/chrome/content/accountWizard/bitmaskMessengerOverlay.xul index a767022..e6406d1 100644 --- a/chrome/content/accountWizard/bitmaskMessengerOverlay.xul +++ b/chrome/content/accountWizard/bitmaskMessengerOverlay.xul @@ -4,6 +4,15 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">