From f6c81389f2486caebef61092db6db46a9fde231e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Fri, 26 Sep 2025 21:34:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=98=B2=E8=B7=A8?= =?UTF-8?q?=E7=AB=99=E9=85=8D=E7=BD=AE=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/bootstrap/http.go | 4 ++-- internal/data/website.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/bootstrap/http.go b/internal/bootstrap/http.go index 9bafb264..4e889546 100644 --- a/internal/bootstrap/http.go +++ b/internal/bootstrap/http.go @@ -27,10 +27,10 @@ func NewRouter(t *gotext.Locale, middlewares *middleware.Middlewares, http *rout return r, nil } -func NewHttp(conf *koanf.Koanf, r *chi.Mux) (*hlfhr.Server, error) { +func NewHttp(conf *koanf.Koanf, mux *chi.Mux) (*hlfhr.Server, error) { srv := hlfhr.New(&http.Server{ Addr: fmt.Sprintf(":%d", conf.MustInt("http.port")), - Handler: http.AllowQuerySemicolons(r), + Handler: mux, MaxHeaderBytes: 2048 << 20, }) srv.HttpOnHttpsPortErrorHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/internal/data/website.go b/internal/data/website.go index 5f5c3147..5f22dcb9 100644 --- a/internal/data/website.go +++ b/internal/data/website.go @@ -527,8 +527,9 @@ func (r *websiteRepo) Update(req *request.WebsiteUpdate) error { } userIni := filepath.Join(req.Root, ".user.ini") if req.OpenBasedir { - if !io.Exists(userIni) { - if err = io.Write(userIni, fmt.Sprintf("open_basedir=%s:/tmp/", req.Path), 0644); err != nil { + if !io.Exists(userIni) || req.Root != website.Path { + // 之前没有开启,或者修改了运行目录,重新写入 + if err = io.Write(userIni, fmt.Sprintf("open_basedir=%s:%s:/tmp/", req.Root, req.Path), 0644); err != nil { return err } }