diff --git a/cmd/main.go b/cmd/main.go index 77a4e55..8793854 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,6 +7,7 @@ import ( "localsend_cli/internal/discovery" "localsend_cli/internal/handlers" "localsend_cli/internal/pkg/server" + "localsend_cli/static" "log" "net/http" "os" @@ -30,7 +31,7 @@ func main() { //如果启用http文件服务器,启用下面的路由 httpServer.HandleFunc("/", handlers.IndexFileHandler) httpServer.HandleFunc("/uploads/", handlers.FileServerHandler) - httpServer.Handle("/static/", http.FileServer(http.Dir("."))) + httpServer.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(static.EmbeddedStaticFiles)))) } /*发送接收部分*/ if config.ConfigData.Functions.LocalSendServer { diff --git a/static/embed.go b/static/embed.go new file mode 100644 index 0000000..9f20ccb --- /dev/null +++ b/static/embed.go @@ -0,0 +1,6 @@ +package static + +import "embed" + +//go:embed * +var EmbeddedStaticFiles embed.FS