From 24d46540306b6afd36e2956e7fc2d7f231d92182 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 9 Aug 2022 10:09:38 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=8A=A0=E5=85=A5=E5=8F=AA=E8=AF=BB?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/build.go | 6 ++++++ playground/file.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/playground/build.go b/playground/build.go index 2ac9652..31746a2 100644 --- a/playground/build.go +++ b/playground/build.go @@ -32,6 +32,12 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { result := gulu.Ret.NewResult() defer gulu.Ret.RetResult(w, r, result) + if conf.Wide.ReadOnly { + result.Code = -1 + result.Msg = "readonly mode" + return + } + httpSession, _ := session.HTTPSession.Get(r, session.CookieName) if httpSession.IsNew { http.Error(w, "Forbidden", http.StatusForbidden) diff --git a/playground/file.go b/playground/file.go index 30fff59..302d2d9 100644 --- a/playground/file.go +++ b/playground/file.go @@ -34,6 +34,12 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) { result := gulu.Ret.NewResult() defer gulu.Ret.RetResult(w, r, result) + if conf.Wide.ReadOnly { + result.Code = -1 + result.Msg = "readonly mode" + return + } + session, _ := session.HTTPSession.Get(r, session.CookieName) if session.IsNew { http.Error(w, "Forbidden", http.StatusForbidden)