🎨 加入只读模式配置

This commit is contained in:
Liang Ding 2022-08-09 10:01:55 +08:00
parent 68fee17793
commit 9076912b9d
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,12 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
result := gulu.Ret.NewResult() result := gulu.Ret.NewResult()
defer gulu.Ret.RetResult(w, r, result) 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) session, _ := session.HTTPSession.Get(r, session.CookieName)
if session.IsNew { if session.IsNew {
http.Error(w, "Forbidden", http.StatusForbidden) http.Error(w, "Forbidden", http.StatusForbidden)