mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: add check to validate wakatime api key before accepting it
This commit is contained in:
@ -13,11 +13,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
WakatimeApiUrl = "https://wakatime.com/api/v1"
|
||||
WakatimeApiHeartbeatsEndpoint = "/users/current/heartbeats.bulk"
|
||||
)
|
||||
|
||||
/* Middleware to conditionally relay heartbeats to Wakatime */
|
||||
type WakatimeRelayMiddleware struct {
|
||||
httpClient *http.Client
|
||||
@ -68,7 +63,7 @@ func (m *WakatimeRelayMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Reque
|
||||
|
||||
go m.send(
|
||||
http.MethodPost,
|
||||
WakatimeApiUrl+WakatimeApiHeartbeatsEndpoint,
|
||||
config.WakatimeApiUrl+config.WakatimeApiHeartbeatsEndpoint,
|
||||
bytes.NewReader(body),
|
||||
headers,
|
||||
)
|
||||
|
Reference in New Issue
Block a user