Fix the abnormal path retrieval issue in some systems.

This commit is contained in:
2026-04-09 01:00:31 +08:00
parent 76f0d815aa
commit 792f547dc3
7 changed files with 453 additions and 336 deletions

View File

@@ -2,12 +2,14 @@ package server
import (
"NetworkAuth/public"
"NetworkAuth/utils"
"io"
"io/fs"
"net/http"
"net/http/httputil"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/gin-gonic/gin"
@@ -48,6 +50,9 @@ func registerFrontendRoutes(r *gin.Engine) {
return // 反向代理接管了所有非 API 路由,直接返回
} else {
// 使用本地外部目录
if !filepath.IsAbs(distConfig) {
distConfig = filepath.Join(utils.GetRootDir(), distConfig)
}
fileServer = http.FileServer(http.Dir(distConfig))
// 拦截并处理静态资源请求