sketch/embedded: embed webui in outie
This makes the web interface work with -unsafe.
I hate to add a third copy of webui to outie.
There are any number of workarounds for this, including (but surely
not limited to):
- copy webui into the container, like before
- have innie forward all webui requests to outie
- for releases, load content-addressable webui from a CDN
- have outie parse and grab webui from an innie binary for -unsafe
But for now, let's keep things simple and straightforward.
Fixes #195
diff --git a/embedded/embedded_outie.go b/embedded/embedded_outie.go
index 42b32b7..14e5bb3 100644
--- a/embedded/embedded_outie.go
+++ b/embedded/embedded_outie.go
@@ -3,6 +3,7 @@
package embedded
import (
+ "embed"
_ "embed"
"io/fs"
)
@@ -24,8 +25,12 @@
return nil
}
-// WebUIFS returns the embedded webui filesystem.
+//go:embed webui-dist
+var webUIAssets embed.FS
+
+// WebUIFS returns the embedded webui filesystem for direct serving
func WebUIFS() fs.FS {
- // webUIAssets are not present in outie
- return nil
+ // TODO: can we avoid this fs.Sub somehow?
+ webuiFS, _ := fs.Sub(webUIAssets, "webui-dist")
+ return webuiFS
}