🎨 加入只读模式配置
This commit is contained in:
parent
58611c8f1e
commit
24d4654030
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue