Compare commits
No commits in common. "master" and "v0.3.12" have entirely different histories.
@ -24,10 +24,10 @@ linters:
|
||||
- ireturn
|
||||
- gocritic
|
||||
- whitespace
|
||||
- wsl
|
||||
- stylecheck
|
||||
- exportloopref
|
||||
- godot
|
||||
- gofumpt
|
||||
|
||||
linters-settings:
|
||||
gomnd:
|
||||
|
@ -4,8 +4,7 @@ pipeline:
|
||||
commands:
|
||||
- go build -o gpaste-client ./cmd/client/client.go
|
||||
- go build -o gpaste-server ./cmd/server/server.go
|
||||
- go test -cover -coverprofile="/tmp/cover.out" ./...
|
||||
- go tool cover -func="/tmp/cover.out"
|
||||
- go test -cover ./...
|
||||
- go vet ./...
|
||||
when:
|
||||
branch: master
|
||||
|
@ -13,7 +13,6 @@ type RequestAPILogin struct {
|
||||
type ResponseAPILogin struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
type ResponseAPIFilePost struct {
|
||||
Message string `json:"message"`
|
||||
Files []ResponseAPIFilePostFiles `json:"files"`
|
||||
|
1
auth.go
1
auth.go
@ -58,6 +58,7 @@ func (as *AuthService) ValidateToken(rawToken string) (*Claims, error) {
|
||||
token, err := jwt.ParseWithClaims(rawToken, claims, func(t *jwt.Token) (interface{}, error) {
|
||||
return as.hmacSecret, nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ func (c *Client) WriteConfigToWriter(w io.Writer) error {
|
||||
encoder := json.NewEncoder(w)
|
||||
return encoder.Encode(c)
|
||||
}
|
||||
|
||||
func (c *Client) WriteConfig() error {
|
||||
dir := configdir.LocalConfig("gpaste")
|
||||
// Ensure dir exists
|
||||
|
@ -23,7 +23,6 @@ func NewFSFileStore(dir string) (*FSFileStore, error) {
|
||||
|
||||
return s, err
|
||||
}
|
||||
|
||||
func (s *FSFileStore) Store(f *File) error {
|
||||
defer f.Body.Close()
|
||||
|
||||
|
10
go.mod
10
go.mod
@ -2,17 +2,19 @@ module git.t-juice.club/torjus/gpaste
|
||||
|
||||
go 1.17
|
||||
|
||||
require github.com/google/uuid v1.3.0
|
||||
|
||||
require github.com/go-chi/chi/v5 v5.0.7
|
||||
|
||||
require (
|
||||
github.com/go-chi/chi/v5 v5.0.7
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||
github.com/google/go-cmp v0.5.7
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/google/go-cmp v0.5.6
|
||||
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f
|
||||
github.com/pelletier/go-toml v1.9.4
|
||||
github.com/urfave/cli/v2 v2.3.0
|
||||
go.etcd.io/bbolt v1.3.6
|
||||
go.uber.org/zap v1.20.0
|
||||
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8
|
||||
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
|
||||
)
|
||||
|
||||
|
8
go.sum
8
go.sum
@ -11,8 +11,8 @@ github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
|
||||
github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f h1:dKccXx7xA56UNqOcFIbuqFjAWPVtP688j5QMgmo6OHU=
|
||||
@ -51,8 +51,8 @@ go.uber.org/zap v1.20.0 h1:N4oPlghZwYG55MlU6LXk/Zp00FVNE9X9wrYO8CEs4lc=
|
||||
go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 h1:kACShD3qhmr/3rLmg1yXyt+N4HcwutKyPRB93s54TIU=
|
||||
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI=
|
||||
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
|
@ -15,7 +15,7 @@ type BoltUserStore struct {
|
||||
}
|
||||
|
||||
func NewBoltUserStore(path string) (*BoltUserStore, error) {
|
||||
db, err := bbolt.Open(path, 0o666, nil) // nolint: gomnd
|
||||
db, err := bbolt.Open(path, 0666, nil) // nolint: gomnd
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -45,6 +45,7 @@ func (s *BoltUserStore) Get(username string) (*User, error) {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -71,7 +72,6 @@ func (s *BoltUserStore) Delete(username string) error {
|
||||
return bkt.Delete([]byte(username))
|
||||
})
|
||||
}
|
||||
|
||||
func (s *BoltUserStore) List() ([]string, error) {
|
||||
var ids []string
|
||||
|
||||
|
@ -15,7 +15,6 @@ type MemoryUserStore struct {
|
||||
func NewMemoryUserStore() *MemoryUserStore {
|
||||
return &MemoryUserStore{users: make(map[string]*User)}
|
||||
}
|
||||
|
||||
func (s *MemoryUserStore) Get(username string) (*User, error) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
@ -46,7 +45,6 @@ func (s *MemoryUserStore) Delete(username string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *MemoryUserStore) List() ([]string, error) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user