Open oreHGA opened 1 year ago
@oreHGA Can you point me to where the resulting data from the API calls would go?
If using aw-client-js, there might be some work I need to do first since aw-client-js doesn't have the same handy built-in queries as aw-client-python (same ones as in aw-webui) which do most the heavy lifting (AFK filtering, categorization, etc).
Hey! Sorry I'm just getting back to this.
The api calls will go specifically in this file - neurofusion/next-client/src/components/features/integrations/modals/activitywatch-modal.tsx
The integrations folder contains all the logic for other connectors.
Re: aw-client-js: I looked through the docs and I was that I had to provide my hostname and bucket information... @ErikBjare , I'll give it a shot & try to input from my browser.
Hey @ErikBjare , I tried using the aw-client-js
to list the active buckets but I'm getting a CORS error as the response. Is there somewhere I need to set Fusion's domain was an an allowed origin from ActivityWatch?
Code snippet I used after installing the library:
const awClient = new AWClient("fusionClient");
awClient.getBuckets().then((buckets) => {
console.log(buckets);
});
};
@oreHGA Yes, see: https://github.com/ActivityWatch/aw-webui#cors
Basically you can add allowed CORS origins in the config files. Not the most user-friendly experience, but somewhat easy to do.
Thanks @ErikBjare this worked (had to restart activitywatch for it to take effect)
We'll add the steps for this in the integration instructions:
Windows: %LocalAppData%\activitywatch\activitywatch
macOS: ~/Library/Application\ Support/activitywatch/
Linux: ~/.config/activitywatch, or the path defined by the $XDG_CONFIG_HOME environment variable.
- File `aw-server/aw-server.toml`
`cors_origins = "https://localhost:3000"`
(in prod it'll be https://usefusion.app)
- Restart ActivityWatch app (they'll only have to do this once)
<img width="1170" alt="Screenshot 2023-12-06 at 6 06 51 PM" src="https://github.com/NEUROFUSIONInc/fusion/assets/13490968/3fd969ed-578e-4173-babd-8c3c50fd84f9">
This is what we want to call afterwards to fetch screentime history - https://github.com/ActivityWatch/aw-client-js/blob/39868c71e48a23193aed77167894917ea423f812/src/aw-client.ts#L316
@abena07 here's where we're tracking activity watch integrations in the web client
@oreHGA okay! will like to be more clear on a few things so will schedule a call for this weekend.
eventually, we'd want to eventually make a PR to activitywatch settings page that allows the user to update the allowed domains from here: http://localhost:5600/#/settings