fix_: linter and some more

This commit is contained in:
Igor Sirotin 2024-09-19 00:15:27 +01:00
parent 6696e6fb9e
commit 46ce050d39
No known key found for this signature in database
GPG Key ID: 425E227CAAB81F95
4 changed files with 15 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"flag"
"github.com/ethereum/go-ethereum/log"
"github.com/status-im/status-go/cmd/statusd/server"
@ -13,7 +14,6 @@ var (
)
func main() {
srv := server.NewServer()
srv.Setup()

View File

@ -1,8 +1,8 @@
package server
import "github.com/status-im/status-go/mobile"
import statusgo "github.com/status-im/status-go/mobile"
var EndpointsWithResponse = []func(string) string {
var EndpointsWithResponse = []func(string) string{
statusgo.InitializeApplication,
statusgo.ExtractGroupMembershipSignatures,
statusgo.SignGroupMembership,
@ -54,7 +54,7 @@ var EndpointsWithResponse = []func(string) string {
statusgo.AddCentralizedMetric,
}
var EndpointsNoRequest = []func() string {
var EndpointsNoRequest = []func() string{
statusgo.GetNodeConfig,
statusgo.ResetChainData,
statusgo.Logout,
@ -70,7 +70,7 @@ var EndpointsNoRequest = []func() string {
statusgo.CentralizedMetricsInfo,
}
var EndpointsUnsupported = []string {
var EndpointsUnsupported = []string{
"VerifyAccountPassword",
"VerifyDatabasePassword",
"MigrateKeyStoreDir",
@ -93,6 +93,7 @@ var EndpointsUnsupported = []string {
"ConvertToKeycardAccount",
"ConvertToRegularAccount",
"SwitchFleet",
"GenerateImages",
"InputConnectionStringForBootstrapping",
"InputConnectionStringForBootstrappingAnotherDevice",
"InputConnectionStringForImportingKeypairsKeystores",

View File

@ -1,20 +1,20 @@
package server
import "github.com/status-im/status-go/mobile"
import statusgo "github.com/status-im/status-go/mobile"
var EndpointsWithResponse = []func(string) string {
var EndpointsWithResponse = []func(string) string{
{{- range .FunctionsWithResp }}
{{ $.PackageName }}.{{ . }},
{{- end }}
}
var EndpointsNoRequest = []func() string {
var EndpointsNoRequest = []func() string{
{{- range .FunctionsNoArgs }}
{{ $.PackageName }}.{{ . }},
{{- end }}
}
var EndpointsUnsupported = []string {
var EndpointsUnsupported = []string{
{{- range .UnsupportedEndpoints }}
"{{ . }}",
{{- end }}

View File

@ -126,7 +126,7 @@ func (s *Server) signals(w http.ResponseWriter, r *http.Request) {
func (s *Server) addEndpointWithResponse(handler func(string) string) {
endpoint := endpointName(functionName(handler))
log.Info("adding endpoint", "name", endpoint)
log.Debug("adding endpoint", "name", endpoint)
s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
request, err := io.ReadAll(r.Body)
if err != nil {
@ -145,7 +145,7 @@ func (s *Server) addEndpointWithResponse(handler func(string) string) {
func (s *Server) addEndpointNoRequest(handler func() string) {
endpoint := endpointName(functionName(handler))
log.Info("adding endpoint", "name", endpoint)
log.Debug("adding endpoint", "name", endpoint)
s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
response := handler()
@ -158,7 +158,7 @@ func (s *Server) addEndpointNoRequest(handler func() string) {
func (s *Server) addUnsupportedEndpoint(name string) {
endpoint := endpointName(name)
log.Info("marking unsupported endpoint", "name", endpoint)
log.Debug("marking unsupported endpoint", "name", endpoint)
s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotImplemented)
})