Skip to content

Commit

Permalink
fix: 修复网页样式丢失的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
meowrain committed Jun 16, 2024
1 parent 58d6274 commit a18dcc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions static/embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package static

import "embed"

//go:embed *
var EmbeddedStaticFiles embed.FS

0 comments on commit a18dcc0

Please sign in to comment.