ActivityWatch / aw-watcher-input

Track your keypresses and mouse movements with ActivityWatch
110 stars 20 forks source link

visualization doesnt work #15

Open scarrrr316 opened 2 years ago

scarrrr316 commented 2 years ago

as title, visualization doesnt work it shows Error: Network Error

image

but activitywatch is running and seems no error

2022-03-08 16:14:55 [INFO ]:  * Running on http://localhost:5600/ (Press CTRL+C to quit)  (werkzeug:113)
2022-03-08 16:16:21 [INFO ]: Received heartbeat after pulse window, inserting as new event. (bucket: aw-watcher-input_DESKTOP-SCARZ)  (aw_server.api:264)

image

am I using the wrong method? If so, how can I see the visualised data?

ErikBjare commented 2 years ago

Did you follow the instructions in the README? I notice they are a bit lacking, and could probably explain better how to configure things.

How are you opening the visualization? What does the dev tools say about the failing request?

scarrrr316 commented 2 years ago

yeah, i did follow the instructions in readme image

and I found that also need to install pug-cli ,in order to run the command in makefile, you may add this step into the readme

i opened the index.html file under aw-watcher-input\visualization\dist .Is this wrong? I cant find another way because readme doesnt mention that

the dev tools shows like this image

can you send me the built files(the packed aw-watcher-input and bundle.js), because the files i built manually using makefile dont work thank you very much!

scarrrr316 commented 2 years ago

image and i cant find the graph in activites page

scarrrr316 commented 2 years ago

any suggestion?

ErikBjare commented 2 years ago

Hmm, the error "Access to XMLHttpRequest at ... from origin null has been blocked" seems weird. Not sure how the origin gets set to null, maybe because you're trying to open the HTML visualization directly in your browser? (don't do that, it won't work, unless you disable CORS checks on the server entirely, but that opens a security hole)

To get the visualization to show in the Activity dashboard vis menu, you need to run a more recent version of aw-server. Either v0.12.0b1, or latest from source.

Mr-Ples commented 2 years ago

i have the same issue on Version: v0.12.0b1

scarrrr316 commented 2 years ago

Hmm, the error "Access to XMLHttpRequest at ... from origin null has been blocked" seems weird. Not sure how the origin gets set to null, maybe because you're trying to open the HTML visualization directly in your browser? (don't do that, it won't work, unless you disable CORS checks on the server entirely, but that opens a security hole)

To get the visualization to show in the Activity dashboard vis menu, you need to run a more recent version of aw-server. Either v0.12.0b1, or latest from source.

how can i add the visualization into the dashboard menu. can you tell me the steps and i will try. thx

Mr-Ples commented 2 years ago

issue persists on Version: v0.12.1 https://s3.eu-central-1.amazonaws.com/cos-dev-attachments/ShareX/notsimon/iYwpkRkQZynbTVBL.mp4

aw-server log gives this:

2022-10-14 18:40:46 [INFO ]: Received heartbeat after pulse window, inserting as new event. (bucket: aw-watcher-input_simon-ms7b89)  (aw_server.api:279)
2022-10-14 18:43:17 [INFO ]: 404 (127.0.0.1): GET /pages/aw-watcher-input/?hostname=simon-ms7b89&start=2022-09-27T00%3A00%3A00+02%3A00&end=2022-09-27T22%3A00%3A00.000Z HTTP/1.1  (flask:25)
2022-10-14 18:58:04 [INFO ]: 404 (127.0.0.1): GET /api/0/buckets//events/703029 HTTP/1.1  (flask:25)
ErikBjare commented 1 year ago

I just tried this watcher again, and could get it working.

image

Pushed a new commit with some README improvements, should clarify some things.

futurisold commented 1 year ago

Open issue for me as well. Error reported is: Static content: index.html of watcher: aw-watcher-input not found!. I did follow all the steps as described in the README.md. Posting more info:

[server-testing] host = localhost port = 5666 storage = peewee cors_origins =

[server.custom_static] aw-watcher-input = "/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-input/visualization/dist/"


* `index.html` is inside the `dist` folder

Any thoughts?
ErikBjare commented 1 year ago

@leoentersthevoid You are editing the wrong/old config file. We switched to toml config in v0.11.0 (iirc).

futurisold commented 1 year ago

Update

I messed up the config. After the correction, it works. Posting it here for tracking:

[server]
host = "localhost"
port = "5600"
storage = "peewee"
cors_origins = ""

[server.custom_static]
aw-watcher-input = "/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-input/visualization/dist/"

[server-testing]
host = "localhost"
port = "5666"
storage = "peewee"
cors_origins = ""

@ErikBjare, thanks! Just switched to .toml, which has the following config now:

[server]
host = "localhost"
port = "5600"
storage = "peewee"
cors_origins = ""

[server-testing]
host = "localhost"
port = "5666"
storage = "peewee"
cors_origins = ""

[server-testing.custom_static]
aw-watcher-input = "/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-input/visualization/dist/"

It doesn't seem to solve the issue. I'm currently running the v0.12.1, if that helps.

ErikBjare commented 1 year ago

@leoentersthevoid Are you running in testing mode?

If not, you put the config under the wrong section (should be under server.custom_static, not server-testing.custom_static).

Edit: just now say your edit (didn't see that from the notification email), nice you got it working!