Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #71

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft

Refactor #71

wants to merge 37 commits into from

Conversation

zyxkad
Copy link
Member

@zyxkad zyxkad commented Jun 26, 2024

No description provided.

@zyxkad zyxkad self-assigned this Jun 26, 2024
@LiterMC LiterMC deleted a comment from github-actions bot Jun 26, 2024
Copy link

Change for better format

diff api/user.go.orig api/user.go
--- api/user.go.orig
+++ api/user.go
@@ -56,7 +56,7 @@
 )
 
 type User struct {
-	Username string
-	Password string // as sha256
+	Username    string
+	Password    string // as sha256
 	Permissions PermissionFlag
 }
diff utils/http.go.orig utils/http.go
--- utils/http.go.orig
+++ utils/http.go
@@ -193,7 +193,7 @@
 	Options http.Handler
 	Trace   http.Handler
 
-	allows string
+	allows     string
 	allowsOnce sync.Once
 }
 

Copy link

Change for better format

diff api/user.go.orig api/user.go
--- api/user.go.orig
+++ api/user.go
@@ -56,7 +56,7 @@
 )
 
 type User struct {
-	Username string
-	Password string // as sha256
+	Username    string
+	Password    string // as sha256
 	Permissions PermissionFlag
 }
diff utils/http.go.orig utils/http.go
--- utils/http.go.orig
+++ utils/http.go
@@ -193,7 +193,7 @@
 	Options http.Handler
 	Trace   http.Handler
 
-	allows string
+	allows     string
 	allowsOnce sync.Once
 }
 

Copy link

Change for better format

diff utils/http.go.orig utils/http.go
--- utils/http.go.orig
+++ utils/http.go
@@ -193,7 +193,7 @@
 	Options http.Handler
 	Trace   http.Handler
 
-	allows string
+	allows     string
 	allowsOnce sync.Once
 }
 

Copy link

Change for better format

diff api/stats.go.orig api/stats.go
--- api/stats.go.orig
+++ api/stats.go
@@ -82,7 +82,7 @@
 type AccessStatData struct {
 	Date statTime `json:"date"`
 	accessStatHistoryData
-	Prev  accessStatHistoryData         `json:"prev"`
+	Prev  accessStatHistoryData   `json:"prev"`
 	Years map[string]statInstData `json:"years"`
 
 	Accesses map[string]int `json:"accesses"`
diff utils/http.go.orig utils/http.go
--- utils/http.go.orig
+++ utils/http.go
@@ -193,7 +193,7 @@
 	Options http.Handler
 	Trace   http.Handler
 
-	allows string
+	allows     string
 	allowsOnce sync.Once
 }
 

@zyxkad zyxkad mentioned this pull request Jul 5, 2024
@zyxkad zyxkad linked an issue Aug 8, 2024 that may be closed by this pull request
Copy link

Change for better format

diff cluster/storage.go.orig cluster/storage.go
--- cluster/storage.go.orig
+++ cluster/storage.go
@@ -21,6 +21,8 @@
 
 import (
 	"context"
+	"crypto"
+	"encoding/hex"
 	"fmt"
 	"io"
 	"net/http"
@@ -30,9 +32,7 @@
 	"strconv"
 	"sync"
 	"sync/atomic"
-	"crypto"
 	"time"
-	"encoding/hex"
 
 	"github.com/hamba/avro/v2"
 	"github.com/klauspost/compress/zstd"
diff main.go.orig main.go
--- main.go.orig
+++ main.go
@@ -44,8 +44,8 @@
 
 	doh "github.com/libp2p/go-doh-resolver"
 
-	"github.com/LiterMC/go-openbmclapi/config"
 	"github.com/LiterMC/go-openbmclapi/cluster"
+	"github.com/LiterMC/go-openbmclapi/config"
 	"github.com/LiterMC/go-openbmclapi/database"
 	"github.com/LiterMC/go-openbmclapi/internal/build"
 	"github.com/LiterMC/go-openbmclapi/lang"

@zyxkad zyxkad linked an issue Aug 13, 2024 that may be closed by this pull request
Copy link

Change for better format

diff cluster/storage.go.orig cluster/storage.go
--- cluster/storage.go.orig
+++ cluster/storage.go
@@ -643,7 +643,7 @@
 	defer res.Body.Close()
 	if res.StatusCode != http.StatusOK {
 		err = utils.NewHTTPStatusErrorFromResponse(res)
-	}else {
+	} else {
 		switch ce := strings.ToLower(res.Header.Get("Content-Encoding")); ce {
 		case "":
 			r = res.Body

zyxkad added 4 commits August 17, 2024 15:55
now we download first then calculate the hash, which support zero copy
Copy link

Change for better format

diff utils/crypto.go.orig utils/crypto.go
--- utils/crypto.go.orig
+++ utils/crypto.go
@@ -82,7 +82,7 @@
 }
 
 func LoadOrCreateHmacKey(dataDir string, name string) (key []byte, err error) {
-	path := filepath.Join(dataDir, name + ".hmac.private_key")
+	path := filepath.Join(dataDir, name+".hmac.private_key")
 	buf, err := os.ReadFile(path)
 	if err != nil {
 		if !errors.Is(err, os.ErrNotExist) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant