Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24e5f86

Browse files
muetyanuraghazra
andauthored
feat: allow to customize wakatime range (anuraghazra#874)
* chore: allow to customize wakatime data range* docs: document wakatime range parameterdocs: add wakatime section to german readmeCo-authored-by: Anurag Hazra <hazru.anurag@gmail.com>
1 parent922f716 commit24e5f86

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

‎api/wakatime.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = async (req, res) => {
2626
locale,
2727
layout,
2828
api_domain,
29+
range,
2930
border_radius,
3031
}=req.query;
3132

@@ -36,7 +37,7 @@ module.exports = async (req, res) => {
3637
}
3738

3839
try{
39-
conststats=awaitfetchWakatimeStats({ username, api_domain});
40+
conststats=awaitfetchWakatimeStats({ username, api_domain, range});
4041

4142
letcacheSeconds=clampValue(
4243
parseInt(cache_seconds||CONSTANTS.TWO_HOURS,10),

‎docs/readme_de.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
-[GitHub Statistiken-Karte](#github-statistiken-karte)
6464
-[GitHub Extra Pins](#github-extra-pins)
6565
-[Top Programmiersprachen-Karte](#top-programmiersprachen-karte)
66+
-[Wakatime Wochen-Statistik](#wakatime-wochen-statistik)
6667
-[Erscheinungsbild/Themes](#erscheinungsbildthemes)
6768
-[Anpassungen/Personalisierung](#anpassungenpersonalisierung)
6869
-[Selber betreiben](#betreibe-es-auf-deiner-eigenen-vercel-instanz)
@@ -166,6 +167,16 @@ Du kannst mehrere, mit Kommas separierte, Werte in der bg_color Option angeben,
166167
>Sprachennamen sollten uri-escaped sein, wie hier angegeben:[Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
167168
>(z.B.:`c++` sollte zu`c%2B%2B` werden,`jupyter notebook` sollte zu`jupyter%20notebook` werden, usw.)
168169
170+
####Exklusive Optionen der WakaTime-Karte:
171+
172+
-`hide_title` -_(boolean)_
173+
-`line_height` - Legt die Zeilenhöhe des Texts fest_(number)_
174+
-`hide_progress` - Verbirgt die Fortschrittanzeige und Prozentzahl_(boolean)_
175+
-`custom_title` - Legt einen benutzerdefinierten Titel fest
176+
-`layout` - Wechselt zwischen zwei verschiedenen Layouts:`default` &`compact`
177+
-`api_domain` - Legt eine benutzerdefinierte API Domain fest, z.B. für[Hakatime](https://github.com/mujx/hakatime) oder[Wakapi](https://github.com/muety/wakapi)
178+
-`range` – Fragt eine eine Zeitspanne an, als die standardmäßig in WakaTime hinterlegte, z.B.`last_7_days`. Siehe[WakaTime API Dokumentation](https://wakatime.com/developers#stats).
179+
169180
---
170181

171182
#GitHub Extra Pins
@@ -232,6 +243,24 @@ Du kannst die `&layout=compact` Option nutzen, um das Karten Design zu ändern.
232243

233244
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)](https://github.com/anuraghazra/github-readme-stats)
234245

246+
#Wakatime Wochen-Statistik
247+
248+
Ändere`?username=` in den eigenen[Wakatime](https://wakatime.com) Benutzernamen.
249+
250+
```md
251+
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats)
252+
```
253+
254+
###Beispiel
255+
256+
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats)
257+
258+
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats)
259+
260+
- Kompaktes Layout
261+
262+
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod&layout=compact)](https://github.com/anuraghazra/github-readme-stats)
263+
235264
---
236265

237266
###Alle Beispiele

‎readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ You can provide multiple comma-separated values in bg_color option to render a g
195195
-`hide_progress` - Hides the progress bar and percentage_(boolean)_
196196
-`custom_title` - Sets a custom title for the card
197197
-`layout` - Switch between two available layouts`default` &`compact`
198-
-`api_domain` - Set a custom api domain for the card
198+
-`api_domain` - Set a custom API domain for the card, e.g. to use services like[Hakatime](https://github.com/mujx/hakatime) or[Wakapi](https://github.com/muety/wakapi)
199+
-`range` – Request a range different from your WakaTime default, e.g.`last_7_days`. See[WakaTime API docs](https://wakatime.com/developers#stats) for list of available options.
199200

200201
---
201202

‎src/fetchers/wakatime-fetcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
constaxios=require("axios");
22

3-
constfetchWakatimeStats=async({ username, api_domain})=>{
3+
constfetchWakatimeStats=async({ username, api_domain, range})=>{
44
try{
55
const{ data}=awaitaxios.get(
66
`https://${
77
api_domain ?api_domain.replace(/[^a-z-.0-9]/gi,"") :"wakatime.com"
8-
}/api/v1/users/${username}/stats?is_including_today=true`,
8+
}/api/v1/users/${username}/stats/${range||''}?is_including_today=true`,
99
);
1010

1111
returndata.data;

‎tests/fetchWakatime.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("Wakatime fetcher", () => {
105105
constusername="anuraghazra";
106106
mock
107107
.onGet(
108-
`https://wakatime.com/api/v1/users/${username}/stats?is_including_today=true`,
108+
`https://wakatime.com/api/v1/users/${username}/stats/?is_including_today=true`,
109109
)
110110
.reply(200,wakaTimeData);
111111

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp