hamaluik / timecop

A time tracking app that respects your privacy and the gets the job done without being fancy.
https://timecop.app/
Apache License 2.0
831 stars 155 forks source link

Integrate with an online service #4

Open 12people opened 4 years ago

12people commented 4 years ago

It'd be great if this app could sync with Clockify. It should be possible using their official API

(It's the app my work uses and it has a completely unusable mobile app, so I'd love to replace it with Time Cop.)

hamaluik commented 4 years ago

Clockify was the app that caused me to write Time Cop (because of their unusable mobile app). I didn't realize they had an API, but I'll certainly look into it!

greigdp commented 4 years ago

Are there any open source or self-hostable time tracker APIs that could be used as well? Either that, or an open implementation of the Clockify API, based on their docs?

There could be an opportunity here for Time Cop to have its own open source time tracking server, with a paid "hosted for you" offering for people wanting to support the project. This model has worked well before for other open source tools like the Standard Notes project.

12people commented 4 years ago

Thinking it through now, Clockify has a lot more features than Time Cop does (like billability, teams, organizations, etc.) and if I were to use sync, I would not want to lose any data I have there. Perhaps Clockify sync isn't such a good idea yet...

An open source time tracking server with a paid hosted option sounds great, though. Perhaps I could convince my company to switch over then...

greigdp commented 4 years ago

As a rough idea for comment, how about integration with Kimai v2? It's open source (MIT license), self-hostable, and has a nice Swagger-documented API - https://demo.kimai.org/api/doc, login info for the demo instance available here.

At a first glance, the data model is a bit more complex on the server-side - it expects a "project" and an "activity" for each time entry, and a start/end time. That's not hugely different to Time Cop however, and might well work as a sync back-end.

I imagine in the first instance, Time Cop could map the current "Projects" to Kimai "projects", and (for now) use a single Kimai "activity" for all time recording, and passing through the Time Cop description into the optional Kimai description field.

The only "gotcha" might be that Time Cop lets you track time not to a specific project - perhaps if there's no project set, Time Cop would create a new "project" via the API called "No Project", and avoid that issue. Down the line, if splitting time on projects into activity types was desired, this could be implemented using the Kimai activity field.

In terms of "settings", Time Cop would likely only need to have a user-specified URL for your Kimai instance, and a field for username/password (or API token). As you said, @12people, it would be important to ensure no "extra" data like billability/teams/organisations would be lost on the backend, but I think in the first instance, it looks possible to sync with a Kimai server and just skip over these fields, and set them on the server-side. As long as Time Cop didn't overwrite "unknown" aspects of the JSON response (i.e. billing rate, customer, activity etc.), it shouldn't affect server-side data, and leaves the door open in future for supporting those features if users needed it.

12people commented 3 years ago

@greigdp Great idea! I changed the issue title to allow for broader integrations rather than be focused on Clockify.

I haven't heard about Kimai before, it seems like a better fit for TimeCop than Clockify.

bmhj2 commented 2 years ago

Possibly only slightly related to this issue - but now there's a Linux version, is there any way to have Timecop work across several devices using the same database? I can't work out how this would happen. Would love to know - I have two Linux PCs (a laptop and a desktop) and an Android phone, and it'd be super-useful to be able to have them all log time to the same target (though not necessarily simultaneously).

12people commented 2 years ago

@bmhj2 As long as the database stays local, I'm afraid there isn't a way to keep it synced across platforms. In theory, it could be synced across devices on the desktop — you'd pick a folder where you want to keep the database and then sync that folder via your cloud sync provider of choice. On mobile, though, each app has a separate storage space and has to always ask to access external storage, so there I don't think this would work.

Even on the desktop, the experience would probably be relatively lousy as Time Cop is not set up to deal with merge conflicts.

bmhj2 commented 2 years ago

Never mind - thanks for the answer!

alexanderadam commented 2 years ago

Just my two cents: maybe the architecture could be done in an plugin-like manner if that'd be possible. This way there could be a plugin for GitLab, one for OpenProject, one for NextCloud apps, one for Clockify and so on.

FredericGuilbault commented 1 year ago

+1 for having a sqlite file or something equivalent that could be hosted on dropbox or something to be shared across installs of timecop.

+1 to connect to the nextcloud timemanager