fix_: linter and some more
This commit is contained in:
parent
6696e6fb9e
commit
46ce050d39
|
@ -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()
|
||||
|
||||
|
|
|
@ -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,9 +93,10 @@ var EndpointsUnsupported = []string {
|
|||
"ConvertToKeycardAccount",
|
||||
"ConvertToRegularAccount",
|
||||
"SwitchFleet",
|
||||
"GenerateImages",
|
||||
"InputConnectionStringForBootstrapping",
|
||||
"InputConnectionStringForBootstrappingAnotherDevice",
|
||||
"InputConnectionStringForImportingKeypairsKeystores",
|
||||
"EncodeTransfer",
|
||||
"EncodeFunctionCall",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
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 }}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue