git-time-metric / gtm

Simple, seamless, lightweight time tracking for Git
MIT License
973 stars 52 forks source link

[Feature request] browser plugins #79

Open 13steinj opened 6 years ago

13steinj commented 6 years ago

I'm putting this would also mean a valid way to import/export time in some special file format.

A simple "on/off" switch and export import system would work, tracking time spent.

Bonus points for tracking history of websites or domains themselves per page, and allowing this to be expanded/contracted in the report. If websites, POST requests and don't track paramaters/fragments for security purposes.

I'd say do this for Chrome, Firefox, maybe opera/safari/edge.

Of course, screw IE-- that's the only browser that would require a completely different codebase (in a different language even) whereas the others would be the same major codebase with only a few changes for different browser APIs

mschenk42 commented 6 years ago

I'm not familiar with what is allowed or possible for browser plugins. For integrating with gtm it would be easy enough to call the CLI from a browser plugin. However, I am working on new feature for application monitoring. So stay tuned :).

13steinj commented 6 years ago

The problem with calling the CLI is I don't believe browser plugins are allowed to execute arbitrary commands-- they're generally written in JS and contained at the browser level, and very specific on allowed permissions. Application monitoring is also a gigantic plus, however if splitting the timing at the webpage level, this would allow the user to see where his time is actually spent in working on the project (SO/SE, the docs of the language, misc, or procrastination).

devkabiir commented 5 years ago

One possible solution would be that gtm runs a lightweight local HTTP server that accepts POST and GET requests. This removes the need for any native binaries to be installed. And also the browser-extension will be simple to implement which using the current tooling can be made cross-browser compatible. I've made simple extensions before and I can tell from experience this approach would be the most easiest to implement and maintain.

The browser extensions can then simply POST to that local server like This would be configured by the users of the browser extension.

{"site": "https://github.com/project-related/repo", "repo":"~/my-project"}

Upon receiving such request gtm then just runs it's gtm record $site --web in the $repo directory. This would also allow users to record time from certain sites to be included for particular project.

Here --web is a hypothetical flag which means the recorded activity is a web activity.

EDIT: Another "Enterprise" use case of this feature would be that companies can host and run the gtm server and their employees would configure the browser extension to use https://gtm.my-company?user=devkabiir server instead of localhost. There are a number of ways to utilize this.

mschenk42 commented 5 years ago

We did consider this approach and it does have advantages. But we decided early on to have GTM be a command line tool and not a server. However you could create a HTTP server that uses GTM. That might be a good option to try.