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

Firefox not recording

Open hrqmonteiro opened this issue 2 years ago • 5 comments

image

Am i missing something? I turned off and on again and still doesn't record anything?

hrqmonteiro avatar Jun 15 '23 16:06 hrqmonteiro

Firefox isn't logged at all? Strange.

The Firefox extension is not strictly necessary, just an extra if you want to track browser activity in more detail (include URLs, incognito & audible status).

Edit: I see now that this is probably due to running Gnome Wayland. You can read about related issues here:

  • https://github.com/ActivityWatch/activitywatch/issues/92
  • https://github.com/ActivityWatch/aw-watcher-window/issues/18

ErikBjare avatar Jun 16 '23 09:06 ErikBjare

It may be related to the timing of AW server turning on. If Firefox is launched on OS session start up but AW is enabled later then plugin wasn't able to connect on start and keeps running in "no server" mode.

AlexanderMakarov avatar Jul 08 '23 06:07 AlexanderMakarov

Yep, it would be great to add "retries" let's say every 30 seconds for the logic in https://github.com/ActivityWatch/aw-watcher-web/blob/1e8db7d999a05616ab5b0d0b569e2bd803ed4f69/src/client.js#L37 (i.e. create client and try to create a bucket).

AlexanderMakarov avatar Jul 08 '23 06:07 AlexanderMakarov

It looks to me like it's sending heartbeats, but they do not contain any browser information. Setting up a netcat listener I see this:

$ nc -l 5600
OPTIONS /api/0/buckets/aw-watcher-web-firefox HTTP/1.1
Host: localhost:5600
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Origin: moz-extension://c2bb6d29-3efe-41fb-a7ca-c0232f6b2b76
DNT: 1
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site

and then it drops after ~30s. I set up a REST server to listen on 5600; it does get repeated heartbeats, looking like this

{"time":"2023-07-23T13:28:58.210Z","level":"DEBUG","msg":"cel debug log","component":"rest","tag":"aw-web","value":{"Body":"","Close":false,"ContentLength":0,"Header":{"Accept":["*/*"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.5"],"Access-Control-Request-Headers":["content-type"],"Access-Control-Request-Method":["POST"],"Connection":["keep-alive"],"Dnt":["1"],"Origin":["moz-extension://c2bb6d29-3efe-41fb-a7ca-c0232f6b2b76"],"Sec-Fetch-Dest":["empty"],"Sec-Fetch-Mode":["cors"],"Sec-Fetch-Site":["cross-site"],"User-Agent":["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"]},"Host":"localhost:5600","Method":"OPTIONS","Proto":"HTTP/1.1","ProtoMajor":1,"ProtoMinor":1,"RequestURI":"/api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80","URL":{"ForceQuery":false,"Fragment":"","Host":"","Opaque":"","Path":"/api/0/buckets/aw-watcher-web-firefox/heartbeat","RawFragment":"","RawPath":"","RawQuery":"pulsetime=80","Scheme":""}}}

but again, there is no web-page information that I would expect; note the empty Body field.

Running an nc listener with chromium gives

$ nc -l 5600           
POST /api/0/buckets/aw-watcher-web-chrome/heartbeat?pulsetime=80 HTTP/1.1
Host: localhost:5600
Connection: keep-alive
Content-Length: 152
sec-ch-ua: "Not:A-Brand";v="99", "Chromium";v="112"
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=UTF-8
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
sec-ch-ua-platform: "Linux"
Origin: chrome-extension://nglaklhklhcoonedhgnpgddginnjdadi
Sec-Fetch-Site: none
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

{"data":{"url":"chrome://newtab/","title":"New Tab","audible":false,"incognito":false,"tabCount":2},"duration":0,"timestamp":"2023-07-23T04:04:27.029Z"}

Running the REST server above also gives the expected results, with POST bodies showing the same data.

kortschak avatar Jul 23 '23 04:07 kortschak

I'm facing the same problem. I reinstalled Activity Watch, firefox started monitoring again, but then stopped.

Untitled-1

francissjr avatar May 09 '24 17:05 francissjr