athul / waka-readme

Wakatime Weekly Metrics on your Profile Readme.
https://github.com/athul
MIT License
1.53k stars 301 forks source link

Allow to configure API URL #59

Closed muety closed 3 years ago

muety commented 3 years ago

In order to support WakaTime alternatives like Wakapi or hakatime, it'd be cool to be able to configure the API's base URL via en environment variable. This way, https://wakatime.com/api/ could easily be replaced by https://wakapi.dev/api, for instance.

athul commented 3 years ago

Hey, Really sorry for the late reply.

We could make this work by adding a Env Flag for GitHub Actions but I don't know about the API compatibility. If Wakapi or Hakatime returns the same response as Wakatime API response then we're in luck for implementing this ✨

I haven't done much search for both these platforms. Also would add to ask about the auth system for wakapi or hakatime since we'll need to add that to the code.

muety commented 3 years ago

From what I've seen, waka-readme only uses the /v1/users/current/stats/last_7_days endpoint, which is entirely compatible in Wakapi (and I believe Hakatime as well). Authentication is compatible, too, it happens through basic auth using an API token.

I'll see if I can do a PR some time soon.