diff --git a/tools/walletextension/Dockerfile b/tools/walletextension/Dockerfile index b399a471dd..5a25543b06 100644 --- a/tools/walletextension/Dockerfile +++ b/tools/walletextension/Dockerfile @@ -18,9 +18,6 @@ FROM system as get-dependencies RUN mkdir -p /home/obscuro/go-obscuro -# Install Node.js and npm (needed for frontend) -RUN apk add --update nodejs npm - # Ensures container layer caching when dependencies are not changed WORKDIR /home/obscuro/go-obscuro COPY go.mod . @@ -32,21 +29,6 @@ FROM get-dependencies as build-wallet # make sure the geth network code is available COPY . /home/obscuro/go-obscuro -# Create .env file for frontend -WORKDIR /home/obscuro/go-obscuro/tools/walletextension/frontend -RUN if [ "$TESTNET_TYPE" = "dev-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://dev-testnet.ten.xyz" > .env; \ - elif [ "$TESTNET_TYPE" = "uat-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://uat-testnet.ten.xyz" > .env; \ - elif [ "$TESTNET_TYPE" = "sepolia-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://testnet.ten.xyz" > .env; \ - else \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=http://127.0.0.1:3000" > .env; \ - fi -# Run npm build for frontend -RUN npm install -RUN npm run build - # build the gateway executable WORKDIR /home/obscuro/go-obscuro/tools/walletextension/main RUN --mount=type=cache,target=/root/.cache/go-build \ @@ -55,19 +37,12 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ # Lightweight final build stage. Includes bare minimum to start wallet extension FROM alpine:3.18 -# Install NGINX -RUN apk update && apk add nginx - # copy over the gateway executable COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/bin /home/obscuro/go-obscuro/tools/walletextension/bin # copy over the .sql migration files COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/storage/database /home/obscuro/go-obscuro/tools/walletextension/storage/database -# copy over the NGINX configuration file -COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/nginx.conf /etc/nginx/nginx.conf - - # copy over the entrypoint script COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/tools/walletextension/api/server.go b/tools/walletextension/api/server.go deleted file mode 100644 index 3552888ae0..0000000000 --- a/tools/walletextension/api/server.go +++ /dev/null @@ -1,24 +0,0 @@ -package api - -import ( - "embed" - "fmt" - "io/fs" - "net/http" -) - -//go:embed all:static -var staticFiles embed.FS - -const ( - staticDir = "static" -) - -func StaticFilesHandler(prefix string) http.Handler { - // Serves the web assets for the management of viewing keys. - fileSystem, err := fs.Sub(staticFiles, staticDir) - if err != nil { - panic(fmt.Sprintf("could not serve static files. Cause: %s", err)) - } - return http.StripPrefix(prefix, http.FileServer(http.FS(fileSystem))) -} diff --git a/tools/walletextension/api/static/favicon.ico b/tools/walletextension/api/static/favicon.ico deleted file mode 100644 index 0e8dea2f71..0000000000 Binary files a/tools/walletextension/api/static/favicon.ico and /dev/null differ diff --git a/tools/walletextension/common/constants.go b/tools/walletextension/common/constants.go index 5b72b8ee35..f0d3b83192 100644 --- a/tools/walletextension/common/constants.go +++ b/tools/walletextension/common/constants.go @@ -15,7 +15,6 @@ const ( ) const ( - PathStatic = "/static/" PathReady = "/ready/" PathJoin = "/join/" PathGetMessage = "/getmessage/" diff --git a/tools/walletextension/entrypoint.sh b/tools/walletextension/entrypoint.sh index f470d7de86..716c84d28b 100644 --- a/tools/walletextension/entrypoint.sh +++ b/tools/walletextension/entrypoint.sh @@ -1,8 +1,5 @@ #!/bin/sh -# Start NGINX in the background -nginx & - # Start wallet_extension_linux with parameters passed to the script /home/obscuro/go-obscuro/tools/walletextension/bin/wallet_extension_linux "$@" diff --git a/tools/walletextension/main/main.go b/tools/walletextension/main/main.go index cc6d60e493..2d7ba6e058 100644 --- a/tools/walletextension/main/main.go +++ b/tools/walletextension/main/main.go @@ -69,7 +69,7 @@ func main() { walletExtensionAddr := fmt.Sprintf("%s:%d", common.Localhost, config.WalletExtensionPortHTTP) fmt.Printf("💡 Wallet extension started \n") // Some tests rely on seeing this message. Removed in next PR. - fmt.Printf("💡 Obscuro Gateway started - visit http://%s/static to use it.\n", walletExtensionAddr) + fmt.Printf("💡 Obscuro Gateway started - visit http://%s/\n", walletExtensionAddr) select {} } diff --git a/tools/walletextension/nginx.conf b/tools/walletextension/nginx.conf deleted file mode 100644 index b0a1e266b6..0000000000 --- a/tools/walletextension/nginx.conf +++ /dev/null @@ -1,27 +0,0 @@ -events { - worker_connections 4096; -} - -http { - server { - listen 80; - - location = / { - proxy_pass http://localhost:8080/static/; # Redirects only the root URL - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - - location / { - proxy_pass http://localhost:8080; # Pass all other requests to the app - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - } -} \ No newline at end of file diff --git a/tools/walletextension/walletextension_container.go b/tools/walletextension/walletextension_container.go index f5bf5d36f7..f6499ec6c7 100644 --- a/tools/walletextension/walletextension_container.go +++ b/tools/walletextension/walletextension_container.go @@ -1,14 +1,11 @@ package walletextension import ( - "net/http" "os" "time" "github.com/ten-protocol/go-ten/go/common/subscription" - "github.com/ten-protocol/go-ten/tools/walletextension/api" - "github.com/ten-protocol/go-ten/tools/walletextension/httpapi" "github.com/ten-protocol/go-ten/tools/walletextension/rpcapi" @@ -92,16 +89,6 @@ func NewContainerFromConfig(config wecommon.Config, logger gethlog.Logger) *Cont }, }) - // register the static files - // todo - remove this when the frontend is no longer served from the enclave - staticHandler := api.StaticFilesHandler(wecommon.PathStatic) - rpcServer.RegisterRoutes([]node.Route{{ - Name: wecommon.PathStatic, - Func: func(resp http.ResponseWriter, req *http.Request) { - staticHandler.ServeHTTP(resp, req) - }, - }}) - return &Container{ stopControl: stopControl, rpcServer: rpcServer,