diff --git a/starship/charts/devnet/defaults.yaml b/starship/charts/devnet/defaults.yaml index cbaacfc9..0c9d13f3 100644 --- a/starship/charts/devnet/defaults.yaml +++ b/starship/charts/devnet/defaults.yaml @@ -736,6 +736,9 @@ defaultChains: name: Hyper display: hyper symbol: HYPR + logo_URIs: + png: "https://gist.githubusercontent.com/Anmol1696/bea1b3835dfb0fce3ab9ed993f5a0792/raw/7065493384a51c888752284be7c1afbf6135b50a/logo-png.png" + svg: "https://gist.githubusercontent.com/Anmol1696/bea1b3835dfb0fce3ab9ed993f5a0792/raw/7065493384a51c888752284be7c1afbf6135b50a/logo-svg.svg" denom_units: - denom: uhyper exponent: 0 diff --git a/starship/faucet/app.go b/starship/faucet/app.go index eb7f370c..e621a050 100644 --- a/starship/faucet/app.go +++ b/starship/faucet/app.go @@ -10,6 +10,7 @@ import ( "time" "github.com/go-chi/chi/middleware" + "github.com/go-chi/cors" grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" grpczap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" grpcrecovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" @@ -83,7 +84,7 @@ func NewAppServer(config *Config) (*AppServer, error) { } httpServer := &http.Server{ Addr: fmt.Sprintf("%s:%s", config.Host, config.HTTPPort), - Handler: app.panicRecovery(app.loggingMiddleware(mux)), + Handler: app.panicRecovery(app.corsMiddleware(app.loggingMiddleware(mux))), } app.httpServer = httpServer @@ -186,6 +187,18 @@ func (a *AppServer) panicRecovery(next http.Handler) http.Handler { return http.HandlerFunc(fn) } +func (a *AppServer) corsMiddleware(next http.Handler) http.Handler { + corsOptions := cors.Options{ + AllowedOrigins: []string{"*"}, // Adjust this to your needs + AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, + AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, + ExposedHeaders: []string{"Link"}, + AllowCredentials: true, + MaxAge: 300, // Maximum value not ignored by any of major browsers + } + return cors.New(corsOptions).Handler(next) +} + func (a *AppServer) Run() error { a.logger.Info("App starting", zap.Any("config", a.config))