feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths. - Frontend wallet and liquidity surfaces; MetaMask token list alignment. - Deployment docs, verification scripts, address inventory updates. Check: go build ./... under backend/ (pass). Made-with: Cursor
This commit is contained in:
@@ -40,6 +40,12 @@ func (s *Server) proxyRouteTreeEndpoint(w http.ResponseWriter, r *http.Request,
|
||||
}
|
||||
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
originalDirector := proxy.Director
|
||||
proxy.Director = func(req *http.Request) {
|
||||
originalDirector(req)
|
||||
req.URL.Path = joinProxyPath(target.Path, path)
|
||||
req.URL.RawPath = req.URL.Path
|
||||
}
|
||||
proxy.ErrorHandler = func(rw http.ResponseWriter, req *http.Request, proxyErr error) {
|
||||
writeError(rw, http.StatusBadGateway, "bad_gateway", fmt.Sprintf("route tree proxy failed for %s: %v", path, proxyErr))
|
||||
}
|
||||
@@ -47,6 +53,17 @@ func (s *Server) proxyRouteTreeEndpoint(w http.ResponseWriter, r *http.Request,
|
||||
proxy.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func joinProxyPath(basePath, path string) string {
|
||||
switch {
|
||||
case strings.HasSuffix(basePath, "/") && strings.HasPrefix(path, "/"):
|
||||
return basePath + path[1:]
|
||||
case !strings.HasSuffix(basePath, "/") && !strings.HasPrefix(path, "/"):
|
||||
return basePath + "/" + path
|
||||
default:
|
||||
return basePath + path
|
||||
}
|
||||
}
|
||||
|
||||
func firstNonEmptyEnv(keys ...string) string {
|
||||
for _, key := range keys {
|
||||
if value := strings.TrimSpace(os.Getenv(key)); value != "" {
|
||||
|
||||
Reference in New Issue
Block a user