Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 72c612d

Browse files
committed
basic structure
1 parent c91068d commit 72c612d

25 files changed

Lines changed: 100 additions & 1436 deletions

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.idea
2-
node_modules
1+
*.exe
2+
.idea

.replit

Lines changed: 0 additions & 77 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

api.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"github.com/sirupsen/logrus"
6+
"io"
7+
"net/http"
8+
"os"
9+
"strings"
10+
)
11+
12+
func GetToken() []string {
13+
data := os.Getenv("TOKEN")
14+
return strings.Split(data, "|")
15+
}
16+
17+
func Get(uri string, token string) (res map[string]interface{}, err error) {
18+
req, err := http.NewRequest("GET", "https://api.github.com/"+uri, nil)
19+
if err != nil {
20+
return nil, err
21+
}
22+
23+
req.Header.Set("Accept", "application/json")
24+
req.Header.Set("Authorization", "Bearer "+token)
25+
26+
client := &http.Client{}
27+
resp, err := client.Do(req)
28+
if err != nil {
29+
return nil, err
30+
}
31+
32+
defer func(Body io.ReadCloser) {
33+
err := Body.Close()
34+
if err != nil {
35+
logrus.Infoln()
36+
}
37+
}(resp.Body)
38+
39+
var data map[string]interface{}
40+
err = json.NewDecoder(resp.Body).Decode(&data)
41+
if err != nil {
42+
return nil, err
43+
}
44+
return data, nil
45+
}

cache.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

config.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/screenshot.png

-186 KB
Binary file not shown.

go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module code-statistic
2+
3+
go 1.20
4+
5+
require (
6+
github.com/sirupsen/logrus v1.9.2 // indirect
7+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
8+
)

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4+
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
5+
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
6+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
9+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
11+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)