diff --git a/README.md b/README.md index 7f940c0fd..0eae44624 100644 --- a/README.md +++ b/README.md @@ -41,16 +41,6 @@ We always require the latest Go release, currently Go 1.21. (While we build releases with our [Go fork](https://github.com/tailscale/go/), its use is not required.) -To include the embedded web client (accessed via the `tailscale web` command), -first build the client assets using: - -``` -./tool/yarn --cwd client/web install -./tool/yarn --cwd client/web build -``` - -Build the `tailscale` and `tailscaled` binaries: - ``` go install tailscale.com/cmd/tailscale{,d} ``` diff --git a/build_dist.sh b/build_dist.sh index e77d7315a..0c757c26d 100755 --- a/build_dist.sh +++ b/build_dist.sh @@ -5,9 +5,6 @@ # information into the binaries, so that we can track down user # issues. # -# To include the embedded web client, build the web client assets -# before running this script. See README.md for details. -# # If you're packaging Tailscale for a distro, please consider using # this script, or executing equivalent commands in your # distro-specific build system. diff --git a/client/web/assets.go b/client/web/assets.go index 9e1c7f8a9..ad6dc4970 100644 --- a/client/web/assets.go +++ b/client/web/assets.go @@ -4,8 +4,6 @@ package web import ( - "embed" - "io/fs" "log" "net/http" "net/http/httputil" @@ -15,36 +13,16 @@ import ( "path/filepath" "strings" - "tailscale.com/util/must" + prebuilt "github.com/tailscale/web-client-prebuilt" ) -// This contains all files needed to build the frontend assets. -// Because we assign this to the blank identifier, it does not actually embed the files. -// However, this does cause `go mod vendor` to include the files when vendoring the package. -// External packages that use the web client can `go mod vendor`, run `yarn build` to -// build the assets, then those asset bundles will be embedded. -// -//go:embed yarn.lock index.html *.js *.json src/* -var _ embed.FS - -//go:embed build/* -var embeddedFS embed.FS - -// staticfiles serves static files from the build directory. -var staticfiles http.Handler - -func init() { - buildFiles := must.Get(fs.Sub(embeddedFS, "build")) - staticfiles = http.FileServer(http.FS(buildFiles)) -} - func assetsHandler(devMode bool) (_ http.Handler, cleanup func()) { if devMode { // When in dev mode, proxy asset requests to the Vite dev server. cleanup := startDevServer() return devServerProxy(), cleanup } - return staticfiles, nil + return http.FileServer(http.FS(prebuilt.FS())), nil } // startDevServer starts the JS dev server that does on-demand rebuilding diff --git a/client/web/vite.config.ts b/client/web/vite.config.ts index 6677195b1..98873bc72 100644 --- a/client/web/vite.config.ts +++ b/client/web/vite.config.ts @@ -32,7 +32,7 @@ export default defineConfig({ ], build: { outDir: "build", - sourcemap: true, + sourcemap: false, }, esbuild: { logOverride: { diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index f0e3810ea..fcda084e4 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -53,6 +53,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep github.com/tailscale/goupnp/soap from github.com/tailscale/goupnp+ github.com/tailscale/goupnp/ssdp from github.com/tailscale/goupnp L 💣 github.com/tailscale/netlink from tailscale.com/util/linuxfw + github.com/tailscale/web-client-prebuilt from tailscale.com/client/web github.com/tcnksm/go-httpstat from tailscale.com/net/netcheck github.com/toqueteos/webbrowser from tailscale.com/cmd/tailscale/cli L 💣 github.com/vishvananda/netlink/nl from github.com/tailscale/netlink diff --git a/go.mod b/go.mod index 86e202ec8..205d10ecb 100644 --- a/go.mod +++ b/go.mod @@ -65,6 +65,7 @@ require ( github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89 github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 + github.com/tailscale/web-client-prebuilt v0.0.0-20230919163828-68bd39ee4109 github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8 github.com/tc-hib/winres v0.2.0 github.com/tcnksm/go-httpstat v0.2.0 diff --git a/go.sum b/go.sum index 3d6a4720b..3b02cfe6a 100644 --- a/go.sum +++ b/go.sum @@ -881,6 +881,8 @@ github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89 h1:7xU7AFQE83h0wz/ github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89/go.mod h1:OGMqrTzDqmJkGumUTtOv44Rp3/4xS+QFbE8Rn0AGlaU= github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 h1:zrsUcqrG2uQSPhaUPjUQwozcRdDdSxxqhNgNZ3drZFk= github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85/go.mod h1:NzVQi3Mleb+qzq8VmcWpSkcSYxXIg0DkI6XDzpVkhJ0= +github.com/tailscale/web-client-prebuilt v0.0.0-20230919163828-68bd39ee4109 h1:QPRZXpvopDySnmNobTe7Dyc/w6ULt1uCN+3/9cTJwjo= +github.com/tailscale/web-client-prebuilt v0.0.0-20230919163828-68bd39ee4109/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ= github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8 h1:V9kSpiTzFp7OTgJinu/kSJlsI6EfRs8wJgQ+Q+5a8v4= github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8/go.mod h1:QRIcq2+DbdIC5sKh/gcAZhuqu6WT6L6G8/ALPN5wqYw= github.com/tc-hib/winres v0.2.0 h1:gly/ivDWGvlhl7ENtEmA7wPQ6dWab1LlLq/DgcZECKE=