mujx / hakatime

Wakatime server implementation & analytics dashboard
https://hakatime.mtx-dev.xyz
The Unlicense
610 stars 45 forks source link

Add `url` heartbeat type #59

Closed georgy-komarov closed 2 years ago

georgy-komarov commented 2 years ago

This PR is an attempt to fix import error when data[0] type is url Error message: msg=json decoding failed: "Error in $.data[0].type: Value can only be one of ['file', 'app', 'domain']"

If we look at the docs, we'll see that is correct. However Wakatime Chrome plugin also sends url type. It is now missing in the docs. Here is an example:

{
    "branch": null,
    "category": "browsing",
    "created_at": "2022-03-01T00:18:29Z",
    "cursorpos": null,
    "dependencies": [],
    "entity": "http://localhost:8060",
    "id": "9e4a69c0-a4d1-4c6e-9d06-75a4f586bc31",
    "is_write": null,
    "language": null,
    "lineno": null,
    "lines": null,
    "machine_name_id": "f13d8c4b-fd8d-43ab-87db-75cf06ccc303",
    "project": "frontend",
    "time": 1646093909.0,
    "type": "url",
    "user_agent_id": "1efe69f2-4c95-4c76-b778-d790901ecb86",
    "user_id": "d820e1be-34c6-423b-b5c1-9060fed2e97d"
}

I am not a haskell developer. That's why not quite sure if these changes are correct. I'll try to build an image and check if everything is working. UPD. It now works great. However, I had to update ubuntu image for Dockerfile.arm up to 21.04 version.

mujx commented 2 years ago

Thanks a lot @georgy-komarov for the fix!