aw-watcher-web icon indicating copy to clipboard operation
aw-watcher-web copied to clipboard

Support different local port

Open dufferzafar opened this issue 4 years ago • 6 comments

Currently, the extension only sends data to port 5600.

I have two activitywatch servers running on my system for two different users (on port 5600 and port 5700)

And I want this watcher to send my data to port 5700!

It was mentioned in this comment that editing the IP address will not be supported, which is understandable!

But, can we add support for editing local port? That doesn't seem too big of a security threat to me.

dufferzafar avatar Nov 07 '21 16:11 dufferzafar

I cloned the code, replaced 5600 to 5700, this is what the diff came out to be:

Submodule aw-client-js contains modified content
diff --git a/aw-client-js/src/aw-client.ts b/aw-client-js/src/aw-client.ts
index 4b5e6ce..fa90d68 100644
--- a/aw-client-js/src/aw-client.ts
+++ b/aw-client-js/src/aw-client.ts
@@ -58,7 +58,7 @@ export class AWClient {
         this.clientname = clientname;
         this.testing = options.testing || false;
         if (typeof options.baseURL === "undefined") {
-            const port = !options.testing ? 5600 : 5666;
+            const port = !options.testing ? 5700 : 5666;
             this.baseURL = `http://localhost:${port}`;
         } else {
           this.baseURL = options.baseURL;
diff --git a/manifest.json b/manifest.json
index caebc22..aea1528 100644
--- a/manifest.json
+++ b/manifest.json
@@ -33,7 +33,7 @@
     "notifications",
     "activeTab",
     "storage",
-    "http://localhost:5600/api/*",
+    "http://localhost:5700/api/*",
     "http://localhost:5666/api/*"
  ]
 }
diff --git a/static/popup.html b/static/popup.html
index 4eb32ad..dd84041 100644
--- a/static/popup.html
+++ b/static/popup.html
@@ -19,7 +19,7 @@
   </div>
 
   <div>
-    <a id="webui-link" href="http://localhost:5600/" target="_blank">
+    <a id="webui-link" href="http://localhost:5700/" target="_blank">
       <span class="button">
         <b>Open web UI</b>
       </span>

Then built the extension via make build, but can't use it on my Firefox because the zip is unsigned.

Need to install Developer edition or Nightly just to be able to use this. Such a sorry state of affairs.

dufferzafar avatar Nov 11 '21 11:11 dufferzafar

@dufferzafar You can install unsigned extensions temporarily at about:debugging#/runtime/this-firefox, however, they'll be disabled when you restart:

image

There seems to be a way around that however: https://wiringbits.net/browser-extensions/2020/11/27/installing-unsigned-extensions-permanently-to-firefox.html

ErikBjare avatar Nov 11 '21 12:11 ErikBjare

There seems to be a way around that however: wiringbits.net/browser-extensions/2020/11/27/installing-unsigned-extensions-permanently-to-firefox.html

This page mentions Step 5 as:

Go to about:config, change xpinstall.signatures.required to true. That’s it, you have installed an unsigned extension permanently.

This will ONLY work in Firefox Developer Edition or Nightly!

https://support.mozilla.org/en-US/kb/add-on-signing-in-firefox

dufferzafar avatar Nov 11 '21 12:11 dufferzafar

Ah, annoying :/

On Thu, Nov 11, 2021, 13:08 Shadab Zafar @.***> wrote:

There seems to be a way around that however: wiringbits.net/browser-extensions/2020/11/27/installing-unsigned-extensions-permanently-to-firefox.html

This page mentions Step 5 as:

Go to about:config, change xpinstall.signatures.required to true. That’s it, you have installed an unsigned extension permanently.

This will ONLY work in Firefox Developer Edition or Nightly!

https://support.mozilla.org/en-US/kb/add-on-signing-in-firefox

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/aw-watcher-web/issues/79#issuecomment-966250122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKXDOQCVN7OML7O2JDIQLDULOW3BANCNFSM5HRAAV2A .

ErikBjare avatar Nov 11 '21 14:11 ErikBjare